PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
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.
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
c is Control
c <- ControlCreate("cTable", typTable, 50, 50, 300, 400, True)
ControlCreate("cTable.COL1", typColumn)
c..InputType = typInputText

ControlCreate("cTable.COL2", typColumn)
c..InputType = typInputText

ControlCreate("cTable.COL3", typColumn)
c..InputType = typInputText

TableAddLine(c, "Col 1", "Col 2", "Col 3")
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 the control to create. For example: "Tab[1].Button2".
  • Creating an edit column in a Table control: specify the typColumn type and the name of the Table control before the name of the column. 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 the column and the name of the Table control before the name of the column. For example:
    // Image column
    c2 is Control <- ControlCreate("Table1.Col3", typImage)
    c2..Width = 50
  • Creating tab panes : specify the typTabPane type and the name of the tab. For example:
    ControlCreate("TAB1", typTabPane)
<Type>: Integer constant
Type of control to create:
typActiveXActiveX control
typOrganizerOrganizer control
typScrollbarScrollbar control
typToolbarToolbar control
typToolboxSidebar control
typButtonButton control
typCalendarCalendar control
typCarouselCarousel control
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
typCubeCube control
typDateDate edit control
typDurationDuration edit control
typInternalWindowInternal Window control
Versions 21 and later
typWire
New in version 21
typWire
typWire
Wire control
typShapeShape/Drawing control
typGanttGantt Chart column
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
typStaticStatic control
typListList Box control
typListViewListView control
typCurrencyCurrency edit control
typMultimediaMultimedia control
typRatingRating control
Versions 21 and later
typRepositionableNote
New in version 21
typRepositionableNote
typRepositionableNote
Repositionable Note control
typNumNumeric edit control
typOleOLE control
typTabTab control
typOrganizationChartOrganization Chart control
typSchedulerScheduler control
typSliderSlider control
typRotativeSliderRound Slider control
typRibbonRibbon control
typSelectRadio Button control
typSplitterSplitter control
typSpinSpin control
typSuperControlSupercontrol
typTableTable control
typPivotTablePivot Table control
Versions 19 and later
typDashboard
New in version 19
typDashboard
typDashboard
Dashboard control
typTreeviewTableTreeView Table control
Versions 20 and later
typSpreadsheet
New in version 20
typSpreadsheet
typSpreadsheet
Spreadsheet control
typTextText edit control
typHideShowHideShow control
Versions 22 and later
typWordProcessing
New in version 22
typWordProcessing
typWordProcessing
Word Processing control
typTreeMapTreeMap control
typTreeViewTreeView control
typTabPaneTab Pane control
typWebCamWeb Camera control
typXamlXaml control
typMultilineZoneMultiline Zone control
typLooperLooper control

A WLanguage error occurs if the type is invalid.
<X>: Optional integer
X coordinate of the control to create (position on the X axis) in pixels. Horizontal position of the top left corner of the control in relation to the top left corner of the client area of the 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 the control is set to 0.
Then, this value can be modified by ..X.
<Y>: Optional integer
Y coordinate of the control to create (position on the Y axis) in pixels. Vertical position of the top left corner of the control in relation to the top left corner of the window client area (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 the control is set to 0.
Then, this value can be modified by ..Y.
<Width>: Optional integer
Width of the control to create (expressed in pixels). This parameter corresponds to ..InitialWidth.
If this parameter is not specified, the width of the control is set to 0.
Then, this value can be modified by ..Height.
<Height>: Optional integer
Height of the control to create (expressed in pixels). This parameter corresponds to ..InitialHeight.
If this parameter is not specified, the height of the control 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
  • 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 after: the display of new controls will be optimized and the effect of progressive appearance will be removed.
  • To configure the characteristics of the 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 the created control:
    • use ChangeStyle. Then, all you have to do is assign a style found in the style sheet of the 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
Reports and Queries wd220obj.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
Criando Bloco Notas
https://youtu.be/0VwRnb943xE
amarildo
14 Dec. 2018
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