WinXP SP3
PB4.31 32bit
Thanx In Advance
JP
Code: Select all
ButtonGadget (#Add, #Col + 000, #Row + 000, #Width, #Height, "&Add Contact")
AddKeyboardShortcut(0, #PB_Shortcut_Control | #PB_Shortcut_A, #Add)
Code: Select all
ButtonGadget (#Add, #Col + 000, #Row + 000, #Width, #Height, "&Add Contact")
AddKeyboardShortcut(0, #PB_Shortcut_Control | #PB_Shortcut_A, #Add)
nope. why and what for?Is there a more elegant way of doing this with just one select case instead of 2?
LOL! Thanks,"elegant" is a fractal with a deep recursion, not a flat line.
Code: Select all
Enumeration
#ActionAdd
EndEnumeration
OpenWindow(0, 0, 0, 512, 384, "", #PB_Window_ScreenCentered | #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget)
ButtonGadget(#ActionAdd, 10, 10, 97, 25, "Click")
AddKeyboardShortcut(0, #PB_Shortcut_A | #PB_Shortcut_Control, #ActionAdd)
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget, #PB_Event_Menu
EventNumber = EventMenu()
If Event = #PB_Event_Gadget
EventGadget()
EndIf
Select EventNumber
Case #ActionAdd
Debug "Adddddd"
EndSelect
Case #PB_Event_CloseWindow
Break
EndSelect
ForEver
Code: Select all
EnableExplicit
; Button + Keyboard Shortcut multi control demo
; click on the Add button or press alt+A performs the same action
; same with alt+Q
Enumeration
#Add
#Quit
EndEnumeration
If OpenWindow(0, 0, 0, 512, 384, "Multi Control Demo", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
ButtonGadget (#Add, 10, 10, 97, 25, "&Add")
AddKeyboardShortcut(0, #PB_Shortcut_Alt | #PB_Shortcut_A, #Add)
ButtonGadget (#Quit, 10, 40, 97, 25, "&Quit")
AddKeyboardShortcut(0, #PB_Shortcut_Alt | #PB_Shortcut_Q, #Quit)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
CloseWindow(0)
End
Case #PB_Event_Gadget, #PB_Event_Menu
Select EventGadget()
Case #Add
Debug "Add was pressed"
Case #Quit
CloseWindow(0)
End
EndSelect
EndSelect
ForEver
EndIf
End
sorry, wrong notation. but correct meaning.I looked for Event_Type could not find it.. There is EventType() which is something completely different.