Description :
This instruction changes a bitmap into an interactive element which can react to the mouse.
Parameters :
-
Name of the procedure managing the events.
-
RELEASE_BUTTON
PRESS_LEFT_BUTTON
PRESS_RIGHT_BUTTON
RELEASE_LEFT_BUTTON
RELEASE_RIGHT_BUTTON
DOUBLE_CLICK_LEFT_BUTTON
DOUBLE_CLICK_RIGHT_BUTTON
EXIT_ZONE
ENTER_ZONE
RELEASE_BUTTON
Return Handle :
Notes :
In Alambik Script, there are three different ways to manage events.
The easiest way (which usually offers the best performance) is to assign a procedure to each event:
For example:
icon.display ("next_0.gif",100,100)
event.create (next, ALL)
icon.display ("view_0.gif",%x,100)
event.create (prev, ALL)
When using this method, Alambik easily differentiates events. There is therefore no need to use a “switch case”.
procedure next (%ObjectID, %status)
end procedure
procedure prev (%ObjectID, %status)
end procedure
Sometimes, it\'s appropriate to create just a single procedure. For example, when parts of the events are common:
icon.display ("next_0.gif",100,100)
%ev1=event.create (common, ALL)
icon.display ("view_0.gif",%x,100)
%ev2=event.create (common, ALL)
When using this method, you must differentiate the events:
procedure common (%event, %status)
switch (%event)
case (==%ev1)
case (==%ev2)
endswitch ()
end procedure
Finally, you can create events in a loop and call them using an index assigned when the event was created:
icon.display ("next_0.gif",100,100)
event.create (common,ALL,1)
icon.display ("view_0.gif",%x,100)
event.create (common,ALL,2)
When using this method, events are differentiated by their indices:
procedure common (%event, %status, %index)
switch (%index)
case (==1)
case (==2)
endswitch ()
end procedure
This last method should be reserved to loops.
Examples :
|