ErosOlmi
10-07-2008, 17:47
Next UI module will have Controls CALLBACKS implemented for at least basic Controls.
_________________________________________________
What are CALLBACKS? Are special functions associated with UI Controls (Buttons, Labels, ...) that are automaticalli executed when the relevant control is activated by an event.
For example, so far, when you wanted to handle a Button Click you had to add a SELECT CASE %WM_COMMAND in the main dialog message pump and than make a SELECT to determine which control fired the event, ... and so on.
In next UI module you will just tell the control which script funtion will be in charge to handle its events with the following syntax:
CONTROL ADD BUTTON, hwnd, ctrlID, txt, _
xPos, yPos, Width, Height, _
Style, _
ExStyle, _
CALL StringExpression _
Example:
callback function cbButton_Click() as long
printl CBHNDL, CBCTL, CBCTLMSG, CBLPARAM, CBWPARAM
'---Do something
function = %TRUE
end function
control add button, hDlg, %ID_CONTROL, "My Button", _
200, 270, 65, 14, _
%WS_CHILD or %WS_VISIBLE or %WS_TABSTOP or %BS_FLAT, _
0 _
CALL "cbButton_Click"
Inside a CALLBACK function 5 automatic variables will be populated:
CBHNDL: handle of the control parent window
CBCTL: control ID
CBCTLMSG: Message sent to the control
CBLPARAM: wParam
CBWPARAM: lParam
Hope you like it.
Eros
_________________________________________________
What are CALLBACKS? Are special functions associated with UI Controls (Buttons, Labels, ...) that are automaticalli executed when the relevant control is activated by an event.
For example, so far, when you wanted to handle a Button Click you had to add a SELECT CASE %WM_COMMAND in the main dialog message pump and than make a SELECT to determine which control fired the event, ... and so on.
In next UI module you will just tell the control which script funtion will be in charge to handle its events with the following syntax:
CONTROL ADD BUTTON, hwnd, ctrlID, txt, _
xPos, yPos, Width, Height, _
Style, _
ExStyle, _
CALL StringExpression _
Example:
callback function cbButton_Click() as long
printl CBHNDL, CBCTL, CBCTLMSG, CBLPARAM, CBWPARAM
'---Do something
function = %TRUE
end function
control add button, hDlg, %ID_CONTROL, "My Button", _
200, 270, 65, 14, _
%WS_CHILD or %WS_VISIBLE or %WS_TABSTOP or %BS_FLAT, _
0 _
CALL "cbButton_Click"
Inside a CALLBACK function 5 automatic variables will be populated:
CBHNDL: handle of the control parent window
CBCTL: control ID
CBCTLMSG: Message sent to the control
CBLPARAM: wParam
CBWPARAM: lParam
Hope you like it.
Eros