How can I retrive setting of all gadgets in a window?

Everything else that doesn't fall into one of the other PB categories.
ankachen
User
User
Posts: 12
Joined: Tue Mar 27, 2007 2:52 am

How can I retrive setting of all gadgets in a window?

Post 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
dige
Addict
Addict
Posts: 1391
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Post 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
User avatar
electrochrisso
Addict
Addict
Posts: 989
Joined: Mon May 14, 2007 2:13 am
Location: Darling River

Post 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.
Post Reply