PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Creates a new control (of any type) in a window by programming.
Versions 23 and later
iPhone/iPad This function is now available for the iPhone/iPad applications.
New in version 23
iPhone/iPad This function is now available for the iPhone/iPad applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Example
c is Control
c <- ControlCreate("BUTTON_1", typButton, 30, 40, 140, 20)
c..Caption = "Click me"
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 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 created control can be handled by a Control variable. In this case, the assignment must be performed by the '<-' operator.
If ControlCreate is used directly, the control is created in the window and it is visible by default.
<Name>: Character string (with quotes)
Name that will be given to the new control. This name will be used to handle the control by 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 control to create. For example: "Tab[1].Button2".
  • Creating an edit column in a Table control: specify the typColumn type and the name of Table control before the column name. For example:
    // Edit + Date column
    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)
<Type>: Integer constant
Type of control to create:
typActiveXActiveX control
iPhone/iPad Not available.
typOrganizerOrganizer control
iPhone/iPad Not available.
typScrollbarScrollbar control
iPhone/iPad Not available.
typToolbarToolbar control
iPhone/iPad Not available.
typToolboxSidebar control
iPhone/iPad Not available.
typButtonButton control
typCalendarCalendar control
typCarouselCarousel control
iPhone/iPad Not available.
Versions 20 and later
typMap
New in version 20
typMap
typMap
Map control
typClickClickable Image control
typBarCodeBar Code control
typColumnTable Column control
typComboWEEditable Combo Box control
typComboNENon-editable Combo Box control
Versions 22 and later
typConference
New in version 22
typConference
typConference
Conference control
Versions 23 and later
typNativeContainer
New in version 23
typNativeContainer
typNativeContainer
Native Container control
typCubeCube control
iPhone/iPad Not available.
typDateDate edit control
typDurationDuration edit control
iPhone/iPad Not available.
Versions 23 and later
typImageEditor
New in version 23
typImageEditor
typImageEditor
Image Editor control
iPhone/iPad Not available.
typInternalWindowInternal Window control
Versions 21 and later
typWire
New in version 21
typWire
typWire
Wire control
iPhone/iPad Not available.
typShapeShape/Drawing control
iPhone/iPad Not available.
typGanttGantt Chart column
iPhone/iPad Not available.
typChartChart control
typTimeTime edit control
typHTMLHTML Static control
typImageImage control
typCheckBoxCheck Box control
typGaugeProgress Bar control
Versions 20 and later
typInfiniteGauge
New in version 20
typInfiniteGauge
typInfiniteGauge
Infinite Progress Bar control
Versions 23 and later
typPDFReader
New in version 23
typPDFReader
typPDFReader
PDF Reader control
iPhone/iPad Not available.
typStaticStatic control
typListList Box control
typListViewListView control
iPhone/iPad Not available.
typCurrencyCurrency edit control
typMultimediaMultimedia control
typRatingRating control
Versions 21 and later
typRepositionableNote
New in version 21
typRepositionableNote
typRepositionableNote
Repositionable Note control
iPhone/iPad Not available.
typNumNumeric edit control
typOleOLE control
iPhone/iPad Not available.
typTabTab control
typOrganizationChartOrganization Chart control
iPhone/iPad Not available.
typSchedulerScheduler control
typSliderSlider control
typRotativeSliderRound Slider control
typRibbonRibbon control
iPhone/iPad Not available.
typSelectRadio Button control
typSplitterSplitter control
iPhone/iPad Not available.
typSpinSpin control
iPhone/iPad Not available.
typSuperControlSupercontrol
typTableTable control
typPivotTablePivot Table control
iPhone/iPad Not available.
Versions 19 and later
typDashboard
New in version 19
typDashboard
typDashboard
Dashboard control
typTreeviewTableTreeView Table control
iPhone/iPad Not available.
Versions 20 and later
typSpreadsheet
New in version 20
typSpreadsheet
typSpreadsheet
Spreadsheet control
iPhone/iPad Not available.
typTextText edit control
typHideShowHideShow control
iPhone/iPad Not available.
Versions 22 and later
typWordProcessing
New in version 22
typWordProcessing
typWordProcessing
Word Processing control
iPhone/iPad Not available.
typTreeMapTreeMap control
iPhone/iPad Not available.
typTreeViewTreeView control
typTabPaneTab Pane control
typWebCamWeb Camera control
typXamlXaml control
iPhone/iPad 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 top left corner of control in relation to the top left corner of client area of window (which means the window without title bar, menu bar and border). This parameter corresponds to ..XInitial.
If this parameter is not specified, the X coordinate of control is set to 0.
Then, this value can be modified by ..X.
<Y>: Optional integer
Y coordinate of control to create (position on the Y axis) in pixels. Vertical position of top left corner of control in relation to the top left corner of client area of window (which means the window without title bar, menu bar and border). This parameter corresponds to ..YInitial.
If this parameter is not specified, the Y coordinate of control is set to 0.
Then, this value can be modified by ..Y.
<Width>: Optional integer
Width of control to create (expressed in pixels). This parameter corresponds to ..InitialWidth.
If this parameter is not specified, the control width is set to 0.
Then, this value can be modified by ..Height.
<Height>: Optional integer
Height of control to create (expressed in pixels). This parameter corresponds to ..InitialHeight.
If this parameter is not specified, the control height is set to 0.
Then, this value can be modified by ..Width.
<Visible>: Optional boolean
  • True (default value) if the control must be visible,
  • False to create an invisible control.
Then, this value can be modified by ..Visible.
Remarks
  • WINDEV If several controls are created in the same window in a single operation, we advise you to disable ..DisplayEnabled before creating the controls and to re-enable it later: the display of new controls will be optimized and the effect of progressive appearance will be removed.
  • To configure the characteristics of created control, use the properties associated with the type of created control:
    • 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 a Control variable, all you have to do is use the control properties on the variable:
      c is Control
      c <- ControlCreate("BUTTON_1", typButton, 30, 40, 140, 20)

      c..Caption = "Click me"
      c..Process[trtClick] = myProcedure
  • To change the style of created control:
    • WINDEV use ChangeStyle. Then, all you have to do is assign a style found in the style sheet of project to the control.
    • Versions 20 and later
      use ..Style. This property is used to copy the style of an existing control into another control.
      New in version 20
      use ..Style. This property is used to copy the style of an existing control into another control.
      use ..Style. This property is used to copy the style of an existing control into another control.
  • To define the different processes associated with the control, use ..Process.
  • To delete a control created by ControlCreate, use ControlDelete.
Components
WINDEV wd230obj.dll
Linux wd230obj.so
Minimum required version
  • Version 19
This page is also available for…
Comments
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
Oct. 13 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
Feb. 21 2017