OverviewPropertiesAdvancedExamples
This example shows how you can detect when a button is pressed on the Buttons screen and react using action script. The action script below can be found by default on the On Ctrl Message event tab when a Buttons screen is added to your project. The On Ctrl Message event can be found on the Actions tab of the screen's properties.
-- These actions are triggered by the controls on the screen.
if (e_MsgID == MSGID_CLICKED) then
-- a control was clicked...
if (e_CtrlID == CTRL_BUTTON_01) then
-- Insert your button handling code here
Dialog.Message("Click","You clicked on Button 01", MB_OK, MB_ICONNONE);
end
if (e_CtrlID == CTRL_BUTTON_02) then
-- Insert your button handling code here
Dialog.Message("Click","You clicked on Button 02", MB_OK, MB_ICONNONE);
end
end
This action script first detects the message ID to see if a button was clicked. If a button control was clicked, a check is then performed to see which one was actually clicked using their control IDs. This example shows a dialog message being shown, however this can be replaced with custom action script to handle your update needs. For example, you could open a file using the File.Open action.