ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Controls, pages and windows / Control functions
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Creates a new control (of any type) in a window through programming.
Example
c is Control
c <- ControlCreate("BUTTON_1", typButton, 30, 40, 140, 20)
c.Caption = "Click here"
c.Process[trtClick] = myProcedure
ControlCreate("EDIT_1", typDate, 30, 40, 140, 20)
ctrl is Control
ctrl <- ControlCreate("DATE", typDate, 150, 150, 80, 20)
ctrl.CaptionWidth = 40
ctrl.Caption = "Date"
// Create a Table control with its columns
cTable is Control
cTable <- ControlCreate("cTable", typTable, 0, 0, 300, 250, True)
cTable.Anchor = anchorWidth + anchorHeight
col1 is Control <- ControlCreate("cTable.COL1", typColumn)
col1.InputType = typInputText
col2 is Control <- ControlCreate("cTable.COL2", typColumn)
col2.InputType = typInputTime
col3 is Control <- ControlCreate("cTable.COL3", typColumn)
col3.InputType = typInputNum
TableAddLine(c, "cTable", "Col 1", "1224", "25")
Syntax
<Result> = ControlCreate(<Name> , <Type> [, <X> [, <Y> [, <Width> [, <Height> [, <Visible>]]]]])
<Result>: Control variable
The new control can be handled with a variable of type Control. In this case, values must be assigned with the '<-' operator.
If ControlCreate is used directly, the control is created in the window and is visible by default.
<Name>: Character string
Name that will be given to the new control. This name will be used to handle the control through programming.
A WLanguage error occurs if this name already exists.
If this parameter corresponds to an empty string (""), a unique name is automatically created.
Special cases:
  • Creating a control in a "Parent" control: specify the full name of the control to be created. For example: "Tab[1].Button2".
  • Creating an edit column in a Table control: specify the typColumn type and name of the Table control before the column name. For example:
    // Edit + Date column
    c <- ControlCreate("TABLE1.COL3", typColumn)
    c.Width = 100
    c.InputType = typInputDate
  • Creating a simple column in a Table control: specify the type of column and the name of Table control before the column name. For example:
    // Image column
    c2 is Control <- ControlCreate("Table1.Col3", typImage)
    c2.Width = 50
  • Creating tab panes : specify the typTabPane type and the tab name. For example:
    ControlCreate("TAB1", typTabPane)
  • Creating a Text token edit control: Simply create a text edit control and enable tokens. For example:
    MyControl is Control <- ControlCreate("test", typText, 10, 10, 250, 25)
    MyControl.TokenEnabled = True
<Type>: Integer constant
Type of control to create:
typActiveXActiveX control
iPhone/iPadIOS WidgetMac Catalyst Not available.
typOrganizerOrganizer control
iPhone/iPadIOS WidgetMac Catalyst Not available.
typScrollbarScrollbar control
iPhone/iPadIOS WidgetMac Catalyst Not available.
typToolbarToolbar control
iPhone/iPadIOS WidgetMac Catalyst Not available.
typToolboxSidebar control
iPhone/iPadIOS WidgetMac Catalyst Not available.
typButtonButton control
typCalendarCalendar control
typCarouselCarousel control
iPhone/iPadIOS WidgetMac Catalyst Not available.
typMapMap control
typClickClickable Image control (Image control with the "This image is a clickable area" option).
typBarCodeBar Code control
typColumnTable Column control
typComboWEEditable Combo Box control
typComboNENon-editable Combo Box control
typConferenceConference control
typNativeContainerNative Container control
typCubeCube control
iPhone/iPadIOS WidgetMac Catalyst Not available.
typDateDate Edit control
typDurationDuration Edit control
iPhone/iPadIOS WidgetMac Catalyst Not available.
New in version 2024
typCodeEditor
Code Editor control
iPhone/iPadIOS WidgetMac Catalyst Not available.
typDiagramEditorDiagram Editor control
iPhone/iPadIOS WidgetMac Catalyst Not available.
typHtmlEditorHTML Editor control
IOS WidgetMac Catalyst Not available.
typImageEditorImage Editor control
iPhone/iPadIOS WidgetMac Catalyst Not available.
typMobileImageEditorMobile Image Editor control
WINDEVIOS WidgetMac Catalyst Not available.
typInternalWindowInternal Window control
typWireWire control
iPhone/iPadIOS WidgetMac Catalyst Not available.
typShapeShape/Drawing control
iPhone/iPadIOS WidgetMac Catalyst Not available.
typGanttGantt Chart column
iPhone/iPadIOS WidgetMac Catalyst Not available.
typChartChart control
typTimeTime Edit control
typHTMLHTML Display control
typImageImage control
typCheckBoxCheck Box control
typSwitchSwitch control
typProgressBarProgress Bar control
typInfiniteProgressBarInfinite Progress Bar control
typKanbanKanban control
iPhone/iPadIOS Widget
Not available.
typPDFReaderPDF Reader control
typStaticStatic control
typListList Box control
typListViewListView control
iPhone/iPadIOS WidgetMac Catalyst Not available.
typKanbanListKanban List control
iPhone/iPadIOS Widget
Not available.
typCurrencyCurrency Edit control
typMultimediaMultimedia control
typRatingRating control
typRepositionableNoteRepositionable Note control
iPhone/iPadIOS WidgetMac Catalyst Not available.
typNumNumeric Edit control
typOleOLE control
iPhone/iPadIOS WidgetMac Catalyst Not available.
typTabTab control
typOrganizationChartOrganization Chart control
iPhone/iPadIOS WidgetMac Catalyst Not available.
typPanelDockable Panel control
iPhone/iPadIOS WidgetMac Catalyst Not available.
typSchedulerScheduler control
typSliderSlider control
typRotativeSliderRound Slider control
typRangeSliderRange Slider control
typRibbonRibbon control
iPhone/iPadIOS WidgetMac Catalyst Not available.
typSelectRadio Button control
typSplitterSplitter control
iPhone/iPadIOS WidgetMac Catalyst Not available.
typSpinSpin control
iPhone/iPadIOS WidgetMac Catalyst Not available.
typSuperControlSupercontrol
typTableTable control
typPivotTablePivot Table control
iPhone/iPadIOS WidgetMac Catalyst Not available.
typDashboardDashboard control
typTreeviewTableTreeView Table control
iPhone/iPadIOS WidgetMac Catalyst Not available.
typSpreadsheetSpreadsheet control
iPhone/iPadIOS WidgetMac Catalyst Not available.
typTextText Edit control
typDrawerDrawer control
iPhone/iPadIOS WidgetMac Catalyst Not available.
typWordProcessingWord Processing control
iPhone/iPadIOS WidgetMac Catalyst Not available.
typTreeMapTreeMap control
iPhone/iPadIOS WidgetMac Catalyst Not available.
typTreeViewTreeView control
typTabPaneTab Pane control
typWebCamWeb Camera control
typXamlXaml control
iPhone/iPadIOS WidgetMac Catalyst Not available.
typMultilineZoneMultiline Zone control
typLooperLooper control

A WLanguage error occurs if the type is invalid.
<X>: Optional integer
X-coordinate of control to create (position on the X-axis) in pixels. Horizontal position of the upper-left corner of the control, relative to the upper-left corner of the window's client area (i.e. the window without title bar, menu bar or borders). This parameter corresponds to the XInitial property.
If this parameter is not specified, the X-coordinate of control is set to 0.
This value can be changed with the X property.
<Y>: Optional integer
Y-coordinate of control to create (position on the Y-axis) in pixels. Vertical position of the upper-left corner of the control, relative to the upper-left corner of the window's client area (i.e. the window without title bar, menu bar or borders). This parameter corresponds to the YInitial property.
If this parameter is not specified, the Y-coordinate of control is set to 0.
This value can be changed with the Y property.
<Width>: Optional integer
Width of control to create (expressed in pixels). This parameter corresponds to the InitialWidth property.
If this parameter is not specified, the control width is set to 0.
This value can be changed with the Height property.
<Height>: Optional integer
Height of control to create (expressed in pixels). This parameter corresponds to the InitialHeight property.
If this parameter is not specified, the control height is set to 0.
This value can be changed with the Width property.
<Visible>: Optional boolean
  • True (default value) if the control must be visible,
  • False to create an invisible control.
This value can be changed with the Visible property.
Remarks
  • WINDEV If multiple controls are created in the same window in a single operation, it is recommended to disable the DisplayEnabled property before creating the controls and re-enable it afterwards: the display of new controls will be optimized and the effect of progressive appearance will be removed.
  • To configure the characteristics of the new control, use the properties associated with its type:
    • If the control is created directly, the indirection operator can be used to handle the control by its name:
      ControlCreate("BUTTON_1", typButton, 30, 40, 140, 20) 

      {"BUTTON_1"}..Caption = "Send an email"
      {"BUTTON_1"}..Process[trtClick] = myProcedure
    • If the created control is associated with variable of type Control, use the control properties on the variable:
      c is Control
      c <- ControlCreate("BUTTON_1", typButton, 30, 40, 140, 20) 
      c.Caption = "Click here"
      c.Process[trtClick] = myProcedure
  • To change the style of the created control:
    • WINDEV use the ChangeStyle function. Simply assign a style in the style sheet of the project to the control.
    • use the Style property. This property copies the style of an existing control to another one.
  • To define the different processes/events associated with the control, use the Process property.
  • To delete a control created by ControlCreate, use ControlDelete.
Business / UI classification: UI Code
Component: wd290obj.dll
Minimum version required
  • Version 19
This page is also available for…
Comments
Criando vários checkbox usando Loop e ControlCreate
x is int = 0
LOOP(3)
x++
gRadio is Control
gRadio <- ControlCreate("Radio_0"+x,typCheckBox,572,80 * x ,100,56)
IF x = 1
gRadio..Caption = "Abacaxi"
gRadio..Value = 1 // marcado
ELSE IF x = 2
gRadio..Caption = "Limão"
ELSE IF x = 3
gRadio..Caption = "Laranja"
END
END
BOLLER
05 Jul. 2019
ControlCreate with Repositionable Notes
Hi, it's easy to create a repositionable note using ControlCreate, but it's impossible to create a button on that repositionable note! The same goes with the Repositionable Note Control - one can't place a button on it.
Guenter
13 Oct. 2017
ControlCreate - Vamos Criar um Bloco de Notas
bloco_notas is Control
bloco_notas <- ControlCreate("bloco_notas_1",typRepositionableNote)
bloco_notas..X=50
bloco_notas..Y=1
bloco_notas..Height=200
bloco_notas..Width=200

ReturnToCapture({"bloco_notas_1"})

// Blog com Video e exemplo

http://windevdesenvolvimento.blogspot.com.br/2017/02/aula-1070-windev-dicas-17-controlcreate.html

https://www.youtube.com/watch?v=GZJMT9A_se8

De matos
21 Feb. 2017

Last update: 02/28/2024

Send a report | Local help