Bezeichnung
ONBUTTONCLICKALL -- user clicked any button (V1.5) / VERALTET
Übersicht
Label(ONBUTTONCLICKALL)
Beschreibung
Achtung: Dieser Befehl ist Teil der Hollywood 1.x Ereignisbibliothek. Sie sollten ihn nicht länger verwenden. Bitte benutzen Sie die Befehle der neuen Bibliothek ab Hollywood 2.0.

If you specify this event and it is enabled, Hollywood will always jump to this label when it gets an ONBUTTONCLICK event. If you want to know, which button caused the label jump, just call GetEventCode(). It will return which button caused the event.

This event is very useful if you have e.g. 100 or more buttons and every button just does a Gosub() to a sub-routine which receives an id which button was pressed. Instead of defining 100 labels now, you can just use ONBUTTONCLICKALL together with GetEventCode().

For example, if you have 3 buttons with id's from 1 to 3, Hollywood would normally jump to ONBUTTONCLICK1, ONBUTTONCLICK2 or ONBUTTONCLICK3 if one of those buttons was clicked. But if you define an ONBUTTONCLICKALL event, Hollywood will always jump to this label.

Eingaben
none

Beispiel
CreateButton(1,10,10,100,100)
CreateButton(2,130,130,230,230)
CreateButton(3,260,260,360,360)
CreateKeyDown(1,"F1")
CreateKeyDown(2,"F2")
CreateKeyDown(3,"F3")
While(quit = FALSE)
   WaitEvent
Wend

Label(ONBUTTONCLICKALL)
WhileMouseDown
id = GetEventCode()
Print("User left-clicked button # ")
Print(id)
Return

Label(ONBUTTONRIGHTCLICKALL)
WhileRightMouseDown
id = GetEventCode()
Print("User right-clicked button # ")
Print(id)
Return

Label(ONBUTTONOVERALL)
WhileMouseOn
id = GetEventCode()
Print("User moved mouse over button # ")
Print(id)
Return

Label(ONKEYDOWNALL)
WhileKeyDown
id = GetEventCode()
Print("User invoked keydown # ")
Print(id)
Return
The above code uses the ALL special events together with GetEventCode() to find out button events that occurred.

Navigation zeigen