General Control Functions |
Top Previous Next |
The functions can commands outlined here are for communicating with and initializing various control types. See the individual sections on each control for other possible operations and commands. SETCONTROLCOLOR window|dialog, ID, fg, bg Changes the foreground and background colors of a control in a window or dialog. When used with controls in a dialog use SETCONTROLCOLOR in response to the @IDINITDIALOG message. The foreground color is used by text displayed in the controls. These colors can be specified using the RGB function. SETCONTROLTEXT window | dialog, ID, text SETCONTROLTEXT is used to change the text of a control. If the control is a bitmap button or bitmap static control then the text is the path to a bitmap file. text$ = GETCONTROLTEXT (window | dialog, ID) GETCONTROLTEXT is used to retrieve the text of a control. GETCONTROLTEXT and SETCONTROLTEXT will work with single and multi-line edit controls to get/set the typed text. For any other control the caption is get/set. GETCONTROLTEXT returns the result as a string. return = CONTROLEXISTS (window | dialog, ID) Returns 1 if the specified control exists in the dialog or window. Returns 0 if the control could not be found. Useful for controls that are dynamically created based on user options. SETSCROLLRANGE window | dialog, ID, min, max SETSCROLLRANGE Sets the minimum and maximum range of a scrollbar control to min and max. All values returned by the scrollbar will be between min and max. If ID = -1 then sets the range of the windows horizontal scrollbar. If ID = -2 then sets the range of the windows vertical scrollbar. ID must be a scrollbar control. GETSCROLLRANGE window | dialog, ID, varMin, varMax Stores the scrollbars range into the variables specified by varMin and varMax. The variables must be of type INT. If ID = -1 then stores the range of the windows horizontal scrollbar. If ID = -2 then stores the range of the windows vertical scrollbar. ID must be a scrollbar control. : SETSCROLLPOS window | dialog, ID, position Sets the slider position of a scrollbar. If ID = -1 then sets the scroll position of the windows horizontal scrollbar. If ID = -2 then sets the scroll position of the windows vertical scrollbar. Any other ID value is a user-defined scrollbar. Position must be between the minimum and maximum values set by the SETSCROLLRANGE statement. position = GETSCROLLPOS (window | dialog, ID) Returns the slider position of a scrollbar. If ID = -1 then returns the scroll position of the windows horizontal scrollbar. If ID = -2 then returns the scroll position of the windows vertical scrollbar. Any other ID value is a user-defined scrollbar. position = GETTHUMBPOS(window | dialog, ID) Returns the current thumb track position of a scrollbar. If ID = -1 then returns the thumb track position of the windows horizontal scrollbar. If ID = -2 then returns the thumb track position of the windows vertical scrollbar. Any other ID value is a user-defined scrollbar. SETSELECTED window | dialog, ID, position Sets the currently selected item in a list or combo box control. The position value is zero-based and the list or combo box must contain a string at that position. index = GETSELECTED (window | dialog, ID) Returns the zero-based index of the currently selected item in the list box of a combo or single selection list box. Returns -1 if no item is selected. ID must be a list box or combo box. selected = ISSELECTED (window | dialog, ID, position) Returns TRUE if the string at position is selected in a multi-selection list or combo box. count = GETSTRINGCOUNT (window | dialog, ID) Returns the number of strings in a list box or combo box control. text$ = GETSTRING (window | dialog, ID, position) Returns the string at position in a list box or combobox. Position is a zero based index. ADDSTRING window | dialog, ID, string Adds a string to a list box or combo box control. String is added to the end of the list unless sorting is specified in the style of the control. INSERTSTRING window | dialog, ID, position, text Inserts a string into a combo or listbox control at position. All other strings are moved down by one position. DELETESTRING window | dialog, ID, position Removes a string from a list box or combo box control. Remaining strings are moved up to fill the empty position.: SETLBCOLWIDTH window | dialog, ID, width Sets the width of columns in a multi-column list box. The list box must have been created with the style @CTLISTMULTI either in the CONTROL statement or by selecting the multicolumn checkbox in the dialog editor. SETHORIZEXTENT window | dialog, ID, width Sets the horizontal scroll width of a list box or list box portion of a combo box. Control must have been created with the @HSCROLL style. The width is specified in pixels. SETSTATE window | dialog, ID, state Sets or resets a checkbox or radio button control. State can either be 0 to uncheck the control or 1 to check the control. state = GETSTATE (window | dialog, ID) Returns the state of a checkbox or radio button control. Returns 1 if control is checked and 0 if control is unchecked. Radio buttons in a group are mutually exclusive. When a radio button is selected your program will receive an @IDCONTROL message with @CONTROLID containing the newly selected radio button. If the radio button is created outside of a group, you will need to use GETSTATE to determine whether the button is selected. ENABLECONTROL window | dialog, ID, 0 | 1 The ENABLECONTROL function enables or disables a control in a window or dialog. Controls that are disables are grayed out and cannot be selected. Use 0 to disable the control or 1 to enable. Example: ENABLECONTROL mydialog, 2, 0 SETFOCUS window | dialog {,ID} Activates the window, dialog or control and sets the input focus. {return = } SENDMESSAGE ( window | dialog | hwnd, msg, wparam, lparam {,ID} ) Sends a message to the window, dialog or control if ID is specified. msg and wparam are numeric values. lparam can be a numeric value, string, pointer or memory variable depending on the message being sent. See the sample file dirselector.eba for a complete example of using SENDMESSAGE {return =} CONTROLCMD( window | dialog, ID ,command, {,param1...} ) Used to communicate with edit, rich edit, list view, status window and toolbar controls. See the sections on using those controls for more details. |