Adds OI controls to panel.
Syntax
rv = Send_Message(Ctrl, "OLE.AddCtrls", CtrlArray)
Parameters
Parameter | Description |
---|---|
CtrlArray | A dynamic array of OI controls to place into the panel |
Remarks
The AddCtrls method adds one or more preexisting OI controls to the panel. Typically, these are controls that already exist on the same form as the SRP Panel control. If successfully added, the controls are moved from the OI form into the panel.
The only parameter is a dynamic array of controls to be added. Each field (@FM delimited) must include the following values:
Pos | Name | Type | Description |
---|---|---|---|
<1, 1> | Handle | Integer | The windows handle to the control to add, returned from its HANDLE property |
<1, 2> | X | Integer | The control's x position in the panel |
<1, 3> | Y | Integer | The control's y position in the panel |
<1, 4> | Width | Integer | The control's width in the panel |
<1, 5> | Height | Integer | The control's height in the panel |
<1, 6> | Color | Color | The control's text color |
<1, 7> | Background | Color | The control's background color |
The first value for each field is the windows handle (HWND) to the control, is you can get by getting the control's HANDLE property.
The remaining values are equivalent to the control's ORIG_SIZE property. In fact, you can pass the ORIG_SIZE property as is if you want your controls to reside inside the SRP Panel Control in the same place it was added to the form.
You can supply negative values for X, Y, Width, or Height to indicate auto sizing. When negative, the value indicates it's distance from the left or bottom of the panel. This chart explains the effects:
Value | Description |
---|---|
X | When negative, the left edge of the control is placed that many pixels from the right edge. For example, -500 places the left edge of the control 500 pixels from the right edge of the panel. This is equivalent to selecting Right Anchor in Form Designer. |
Y | When negative, the top edge of the control is placed that many pixels from the bottom edge. For example, -1000 places the top edge of the control 1000 pixels from the bottom edge of the panel. This is equivalent to selecting Bottom Anchor in Form Designer. |
Width | When negative, the right edge of the control is placed that many pixels from the right edge. For example, -10 places the right edge of the control 10 pixels from the right edge of the panel. This is equivalent to selecting Autosize Width in Form Designer. |
Height | When negative, the bottom edge of the control is placed that many pixels from the bottom edge. For example, -20 places the bottom edge of the control 20 pixels from the bottom edge of the panel. This is equivalent to selecting Autosize Height in Form Designer. |
Color
Don't use the Form Designer to set the control's colors if you plan to put it into a Panel control. It won't stick. There are technical reasons for this, but the easiest work around is to pass the desired foreground and background colors into this method.
Example
CtrlArray = "" // Add the label, placing it in the same place it was added to the form hWnd = Get_Property(@Window:".LABEL", "HANDLE") OrigSize = Get_Property(@Window:".LABEL", "ORIG_SIZE") Convert @FM to @VM in OrigSize CtrlArray<-1> = hWnd:@VM:OrigSize // Add the editline, placing it in the same place it was added to the form hWnd = Get_Property(@Window:".EDITLINE", "HANDLE") OrigSize = Get_Property(@Window:".EDITLINE", "ORIG_SIZE") Convert @FM to @VM in OrigSize CtrlArray<-1> = hWnd:@VM:OrigSize // Add the controls Send_Message(@Window:".OLE_PANEL", "OLE.AddCtrls", CtrlArray)