Page 1 of 1
How can I retrive setting of all gadgets in a window?
Posted: Mon Aug 27, 2007 8:05 am
by ankachen
I designed two windows in a program. When I press "F1", the preference window will pop up or close(if it's opened). I also have some gadgets in the preference window, something like option gadget, combobox gadget, scrollbar gadget, trackbar gadget, etc. My problem is how could I get my previous setting in those gadgets, when I open the preference window again? Any help will be Appreciated.
Anka
Posted: Mon Aug 27, 2007 9:33 am
by dige
One way is to use static variables inside the prefs window procedure and
control it with flags.
Code: Select all
Procedure PrefsWindow (flags.b); flags: 0-OpenWindow 1-CloseWindow, #PB_ANY-Swap
Static Value.b
If flags = #PB_Any
If IsWindow(...)
flags = 1
Else
flags = 0
EndIf
EndIf
If flags = 0
OpenWindow (...)
SetGadgetState( #CHECKBOX, Value )
Else
Value = GetGadgetState(#CHECKBOX)
CloseWindow(...)
EndIf
EndProcedure
Posted: Wed Aug 29, 2007 4:50 am
by electrochrisso
You could create a temporary file and write the settings to it and then read the file back and retrieve the settings. Then delete the file when the program ends.