|
|
|
|
|
ControlCreate (Function) In french: ChampCrée Creates a new control (of any type) in a window through programming.
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"
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:
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:
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:
| | typActiveX | ActiveX control | typOrganizer | Organizer control | typScrollbar | Scrollbar control | typToolbar | Toolbar control | typToolbox | Sidebar control | typButton | Button control | typCalendar | Calendar control | typCarousel | Carousel control | typMap | Map control | typClick | Clickable Image control (Image control with the "This image is a clickable area" option). | typBarCode | Bar Code control | typColumn | Table Column control | typComboWE | Editable Combo Box control | typComboNE | Non-editable Combo Box control | typConference | Conference control | typNativeContainer | Native Container control | typCube | Cube control | typDate | Date Edit control | typDuration | Duration Edit control | typCodeEditor | Code Editor control | typDiagramEditor | Diagram Editor control | typHtmlEditor | HTML Editor control | typImageEditor | Image Editor control | typMobileImageEditor | Mobile Image Editor control | typInternalWindow | Internal Window control | typWire | Wire control | typShape | Shape/Drawing control | typGantt | Gantt Chart column | typChart | Chart control | typTime | Time Edit control | typHTML | HTML Display control | typImage | Image control | typCheckBox | Check Box control | typSwitch | Switch control | typProgressBar | Progress Bar control | typInfiniteProgressBar | Infinite Progress Bar control | typKanban | Kanban control
| typPDFReader | PDF Reader control | typStatic | Static control | typList | List Box control | typListView | ListView control | typKanbanList | Kanban List control
| typCurrency | Currency Edit control | typMultimedia | Multimedia control | typRating | Rating control | typRepositionableNote | Repositionable Note control | typNum | Numeric Edit control | typOle | OLE control | typTab | Tab control | typOrganizationChart | Organization Chart control | typPanel | Dockable Panel control | typScheduler | Scheduler control | typSlider | Slider control | typRotativeSlider | Round Slider control | 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 | typDashboard | Dashboard control | typTreeviewTable | TreeView Table control | typSpreadsheet | Spreadsheet control | typText | Text Edit control | typDrawer | Drawer control | 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 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 - 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:
- 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
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|