ControlCreate (Function) In french: ChampCrée Creates a new control (of any type) in a window by programming. Versions 23 and later New in version 23
c is Control c <- ControlCreate("BUTTON_1", typButton, 30, 40, 140, 20) c.Label = "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 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(<nom> , <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 made with the operator '<-'. If ControlCreate is used directly, the control is created in the window and it is visible by default. <nom>: 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 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)
Versions 24 and laterCreating 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
New in version 24Creating 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
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:
| | typActiveX | ActiveX control | typOrganizer | Organizer control | typScrollbar | Scrollbar control | typToolbar | Toolbar control | typToolbox | Sidebar control | typButton | Button control | typCalendar | Calendar control | typCarousel | Carousel control | Versions 20 and latertypMap New in version 20typMap typMap | Map control | typClick | Clickable Image control | typBarCode | Bar Code control | typColumn | Table Column control | typComboWE | Editable Combo Box control | typComboNE | Non-editable Combo Box control | Versions 22 and latertypConference New in version 22typConference typConference | Conference control | Versions 23 and latertypNativeContainer New in version 23typNativeContainer typNativeContainer | Native Container control | typCube | Cube control | typDate | Date edit control | typDuration | Duration edit control | Versions 23 and latertypImageEditor New in version 23typImageEditor typImageEditor | Image Editor control | typInternalWindow | Internal Window control | Versions 21 and latertypWire New in version 21typWire typWire | Wire control | typShape | Shape/Drawing control | typGantt | Gantt Chart column | typChart | Chart control | typTime | Time edit control | typHTML | HTML Static control | typImage | Image control | typCheckBox | Check Box control | Versions 24 and latertypSwitch New in version 24typSwitch typSwitch | Switch control | typProgressBar | Progress Bar control | Versions 20 and latertypInfiniteProgressBar New in version 20typInfiniteProgressBar typInfiniteProgressBar | Infinite Progress Bar control | Versions 23 and latertypPDFReader New in version 23typPDFReader typPDFReader | PDF Reader control | typStatic | Static control | typList | List Box control | typListView | ListView control | typCurrency | Currency edit control | typMultimedia | Multimedia control | typRating | Rating control | Versions 21 and latertypRepositionableNote New in version 21typRepositionableNote typRepositionableNote | Repositionable Note control | typNum | Numeric edit control | typOle | OLE control | typTab | Tab control | typOrganizationChart | Organization Chart control | Versions 24 and latertypPanel New in version 24typPanel typPanel | Dockable Panel control | typScheduler | Scheduler control | typSlider | Slider control | typRotativeSlider | Round Slider control | Versions 24 and latertypRangeSlider New in version 24typRangeSlider typRangeSlider | Range Slider control | typRibbon | Ribbon control | typSelect | Radio Button control | typSplitter | Splitter control | typSpin | Spin control | typSuperControl | Supercontrol | typTable | Table control | typPivotTable | Pivot Table control | Versions 19 and latertypDashboard New in version 19typDashboard typDashboard | Dashboard control | typTreeviewTable | TreeView Table control | Versions 20 and latertypSpreadsheet New in version 20typSpreadsheet typSpreadsheet | Spreadsheet control | typText | Text edit control | typDrawer | Drawer control | Versions 22 and latertypWordProcessing New in version 22typWordProcessing typWordProcessing | Word Processing control | typTreeMap | TreeMap control | typTreeView | TreeView control | typTabPane | Tab Pane control | typWebCam | Web Camera control | typXaml | Xaml control | typMultilineZone | Multiline Zone control | typLooper | Looper 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 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 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 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 If several fields are created in the same window in a single operation, it is advisable to deactivate the Property DisplayEnabled before creating the fields and then reactivate it afterwards: 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.Label = "Click me c.Process[trtClick] = myProcedure
- To change the style of created control:
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 lateruse Style. This property is used to copy the style of an existing control into another control. New in version 20use 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 treatments/events associated with the field, use the Property Process.
- To delete a control created by ControlCreate, use ControlDelete.
Business / UI classification : UI Code
This page is also available for…
|
|
|
| |
| 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 |
|
|
|
| |
| |
| |
|
| | https://youtu.be/0VwRnb943xE |
|
|
|
| |
| |
| |
|
| 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. |
|
|
|
| |
| |
| |
|
| 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
|
|
|
|
| |
| |
| |
| |
| |
| |
| | |
|