I'm working around with gadgets and think, windows behaviour can be emulated very often without big problems (and with quite nice code)...
Code: Select all
:
ButtonGadget(#copygadget,232,10,75,22,"Starte")
GadgetToolTip(#copygadget,"Starten des Kopiervorgangs")
ButtonGadget(#quitgadget,314,60,75,22,"Ende", #PB_Button_Default)
GadgetToolTip(#quitgadget,"Programm beenden")
:
AddKeyboardShortcut(1,#PB_Shortcut_S,#copygadget)
AddKeyboardShortcut(1,#PB_Shortcut_Escape,#quitgadget)
AddKeyboardShortcut(1,#PB_Shortcut_E,#quitgadget)
:
Repeat
Select WaitWindowEvent()
Case #PB_Event_Gadget,#PB_Event_Menu
Select EventGadget()
Case #copygadget
:
Case #calcgadget
:
Case #cleargadget
:
Case #quitgadget
quit=999
EndSelect
Case #PB_Event_CloseWindow
quit=999
EndSelect
Until quit>0
Code: Select all
:
CheckBoxGadget(#optautocopygadget,20,78,220,20,"Dateien &automatisch kopieren")
:
OptionGadget(#optemptyallgadget,20,168,220,20,"&One")
OptionGadget(#optemptyallgadget+1,20,188,220,20,"&Two")
OptionGadget(#optemptyallgadget+2,20,208,220,20,"T&hree")
:
SetGadgetState(#optemptyallgadget+SelectedOption,1)
:
AddKeyboardShortcut(2,#PB_Shortcut_Escape,#optokgadget)
AddKeyboardShortcut(2,#PB_Shortcut_A,#optautocopygadget)
AddKeyboardShortcut(2,#PB_Shortcut_O,#optemptyallgadget)
AddKeyboardShortcut(2,#PB_Shortcut_T,#optemptyallgadget+1)
AddKeyboardShortcut(2,#PB_Shortcut_H,#optemptyallgadget+2)
:
The Event structure has to be splitted when keyboard shortcuts are used, otherwise mouse clicking on an option key would not change its status. It's not a big deal to change the checkbox state, but more difficult to change the optiongadget status...
Code: Select all
Procedure InvertGadgetState(g.l)
SetGadgetState(g,1-GetGadgetState(g))
SetActiveGadget(g)
EndProcedure
:
Repeat
Select WaitWindowEvent()
Case #PB_Event_Gadget
If EventGadget()=#optokgadget
quit=999
EndIf
Case #PB_Event_Menu
button=EventGadget()
Select button
Case #optautocheckgadget,#optwinsizegadget,#optautocopygadget,#optrecursivegadget,#optautoremovegadget
InvertGadgetState(button)
Case #optemptyallgadget,#optemptyallgadget+1,#optemptyallgadget+2
SetGadgetState(button,1)
SetActiveGadget(button)
Case #optokgadget
quit=999
EndSelect
Case #PB_Event_CloseWindow
quit=999
EndSelect
Until quit>0
The result of an Optiongadget has to be "calculated"
Code: Select all
SelectedOption=GetGadgetState(#optemptyallgadget+1)+GetGadgetState(#optemptyallgadget+2)<<1+...
But something is still missing: Cursor Up/Down Handling within the OptionGadgets...