GuiAddCtl()

Adds a control to an already open window.


Synopsis

error = GuiAddCtl(Description, Window, ButtonNum)


Args

Description is a string specifying the type of control to be added, its position and size, its styles, etc. For more information about the format of this line, see the reference page for each individual control under the section Controls Reference.

Window is the handle to the desired window into which the control will be created. If omitted, the window handle is gotten from the GuiWindow variable (set by GuiCreateWindow).

ButtonNum is supplied only for RADIO buttons. It indicates which button (number) within the group. For example, if this were the first RADIO button you were adding to a group, then you would pass a 1. (You should also set the GROUP style for the first button, but not for subsequent buttons). For the second button in the same group, you would pass a 2. Etc. Only the first button needs to have a REXX variable associated with it.


Returns

If successful, an empty string is returned. If an error, an error message is returned.


Notes

You can remove a control with GuiRemoveCtl().

The control is set to use the last FONT that was specified in the WINDOW definition when the window was created. You can change a control's font by sending it a SETFONT message.

GuiAddCtl may return the following error numbers/messages. If you choose to raise a condition, then from your CATCH instructions, you can use CONDITION('D') to fetch the message, and CONDITION('E') to fetch the number. Note that where you see part of a message enclosed within < and >, this will be replaced by some other, more detailed text in the error message.

Number Message
101Out of memory for this operation
108Control x, y, width, and height must be whole numbers
109No open windows
113Not a window
114Not a defined type of control
119Can't find the STRING definition named <name>
120STRING definition is missing its DEND
121Error adding the string: <string>
198Message will vary. It concerns bad styles, or extra sytles, specified for the control.
199Message will vary. It concerns the operating system unable to create the control.