Select Message

Home Scripting Messages Select Message

The message select is sent to a control of type Command when the menu entry for the control (in the menu Cmds) is selected, or when there is a button for the command and that button is tapped or selected.

The select message is probably the most important and most often used message in MoStacks, and most of the scripts that you will write, if any, will react to this message.

Indeed, if you have a Command control with the flag Standard command? not set, that control only makes sense if it has a script responding to the select message, because without such a script nothing ever happens in regard to the control.

The following is a small example of a script for a select message:

on select
  put field "Amount" / 100 * 5 into field "Percents"
  if field "Percents" > 10 then
    answer "Warning: Expensive"
  end if
end select

Write that script directly at the control, by clicking on the Script... button in the Edit Fields and Controls Window.