Bind function
Posted: Sat Jun 29, 2013 9:47 pm
I believe that in the function BindMenuEvent() should be a location parameter: If the MenuItem is not specified, then the Callback procedure is called for each menu item #Menu.
Callback procedure must include an argument MenuItem.But it would be nice if the Callback procedure would contain all the parameters Bind-function (other than the address Callback-procedure).Otherwise it will be difficult to assign a single procedure for the treatment of multiple events. For example, the procedure for appointing a few gadgets. How to find out which gadget event occurred?
Code: Select all
BindMenuEvent(#Menu, @Callback() [, MenuItem])
Callback procedure must include an argument MenuItem.
Code: Select all
Procedure Callback(MenuItem)
EndProcedure
Code: Select all
Procedure Callback()
Debug "Click"
EndProcedure
; Shows possible flags of ButtonGadget in action...
If OpenWindow(0, 0, 0, 222, 200, "ButtonGadgets", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ButtonGadget(0, 10, 10, 200, 20, "Standard Button")
ButtonGadget(1, 10, 40, 200, 20, "Left Button", #PB_Button_Left)
ButtonGadget(2, 10, 70, 200, 20, "Right Button", #PB_Button_Right)
ButtonGadget(3, 10,100, 200, 60, "Multi-line Button (longer text gets automatically wrapped)",
#PB_Button_MultiLine)
ButtonGadget(4, 10,170, 200, 20, "Toggle Button", #PB_Button_Toggle)
For i=0 To 4
BindGadgetEvent(i, @Callback())
Next i
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf