spingadget

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by crown.

hello,

does somebody know how to use the spingadget, i mean how to
incease/decrease the value in it with the buttons?



(registered PureBasic user)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by GPI.

copy form editor-source

Code: Select all

             Case #GADGET_Preference_TabLengthUpDown
                  TabLengthTemp = GetGadgetState(#GADGET_Preference_TabLengthUpDown)
                  SetGadgetText(#GADGET_Preference_TabLengthText, Str(TabLengthTemp))
the gadgetstate will update with clicking on the buttons, but you must set the text.

PII 333, 256MB, Asus TNT2Ultra 32MB, AWE Gold 64 4MB
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Justin.

here is a complete code, you need the windowevent()

Code: Select all

;GADGET IDs
#Spin0=0
;WINDOW ID
#Window1=0

;WINDOW
OpenWindow(#Window1,243,130,280,131,#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_TitleBar|#PB_Window_ScreenCentered,"Spin")
CreateGadgetList(WindowID(#Window1))

SpinGadget(#Spin0,20,16,100,24,0,10)

;EVENT LOOP
Repeat
  EventID=WaitWindowEvent()
    Select EventID
      Case #PB_EventGadget
        Select EventGadgetID()
          Case #Spin0

            SetGadgetText(#Spin0,Str(GetGadgetState(#Spin0)))
            WindowEvent()

        EndSelect
    EndSelect
Until EventID=#PB_EventCloseWindow
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by crown.

thanks... this will help me :)

(registered PureBasic user)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by ebs.

This might be old news, but I sometimes use a spin gadget as a sort of "combo box without the list", like this:

Code: Select all

;GADGET IDs
#Spin0=0
;WINDOW ID
#Window1=0

Dim SpinList.s(4)

SpinList(0) = "Item Number One"
SpinList(1) = "Second Item"
SpinList(2) = "Item #3"
SpinList(3) = "4th Item"
SpinList(4) = "Item Five (last)"

;WINDOW
OpenWindow(#Window1,243,130,280,131,#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_TitleBar|#PB_Window_ScreenCentered,"Spin")
CreateGadgetList(WindowID(#Window1))

SpinGadget(#Spin0,20,16,120,24,0,4)
SetGadgetText(#Spin0,SpinList(0))
WindowEvent()


;EVENT LOOP
Repeat
  EventID=WaitWindowEvent()
    Select EventID
      Case #PB_EventGadget
        Select EventGadgetID()
          Case #Spin0
            SetGadgetText(#Spin0,SpinList(GetGadgetState(#Spin0)))
            WindowEvent()
        EndSelect
    EndSelect
Until EventID=#PB_EventCloseWindow
It's a non-standard user interface (for Windows), but it may be appropriate in certain circumstances. I believe the Mac GUI uses an element like this.

Eric
Originally posted by Justin

here is a complete code, you need the windowevent()

Code: Select all

;GADGET IDs
#Spin0=0
;WINDOW ID
#Window1=0

;WINDOW
OpenWindow(#Window1,243,130,280,131,#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_TitleBar|#PB_Window_ScreenCentered,"Spin")
CreateGadgetList(WindowID(#Window1))

SpinGadget(#Spin0,20,16,100,24,0,10)

;EVENT LOOP
Repeat
  EventID=WaitWindowEvent()
    Select EventID
      Case #PB_EventGadget
        Select EventGadgetID()
          Case #Spin0

            SetGadgetText(#Spin0,Str(GetGadgetState(#Spin0)))
            WindowEvent()

        EndSelect
    EndSelect
Until EventID=#PB_EventCloseWindow
Post Reply