Restored from previous forum. Originally posted by halo.
I got it to work, but it seems wrong:
Set it up...
SpinGadget(1,20,20,70,20,0,20)
SetGadgetState(1,20-5)
SetGadgetText(1,Str(20-GetGadgetState(1)))
and then...
Select WaitWindowEvent()
Case #PB_EventGadget
Select EventGadgetID()
Case 1
SetGadgetText(1,Str(20-GetGadgetState(1)))
Spin Gadget does some wierd stuff.
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by PB.
> I got it to work, but it seems wrong:
See the correct usage here: http://tinyurl.com/scq
PB - Registered PureBasic Coder
> I got it to work, but it seems wrong:
See the correct usage here: http://tinyurl.com/scq
PB - Registered PureBasic Coder
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Pupil.
Please Halo, post a small but working example that shows the weridness, so that those who try to help doesn't have to fill in all the gaps in the code to actually test what's weird with this and that...
Enough about that, i've created a little workaround for your problem, which is caused by the SetGadgetText() command. This command generates an event whenever it is called so you actually get a sort of endless loop when used the way that it is in your example...
PB beat me to it, disregard my example as the link in PB's post shows a much cleaner way!
Edited by - Pupil on 23 July 2002 18:58:35
Please Halo, post a small but working example that shows the weridness, so that those who try to help doesn't have to fill in all the gaps in the code to actually test what's weird with this and that...
Enough about that, i've created a little workaround for your problem, which is caused by the SetGadgetText() command. This command generates an event whenever it is called so you actually get a sort of endless loop when used the way that it is in your example...
Code: Select all
If OpenWindow(0,0,0,100,100,0,"test")
If CreateGadgetList(WindowID(0))
SpinGadget(1,20,20,70,20,0,20)
SetGadgetState(1,20-5)
SetGadgetText(1,Str(20-GetGadgetState(1)))
count = 2
Repeat
event.l = WaitWindowEvent()
type.l = EventType()
Select event
Case #PB_EventGadget
Select EventGadgetID()
Case 1
If type = 1 Or (type = -1 And count >= 2)
SetGadgetText(1,Str(20-GetGadgetState(1)))
count = 0
ElseIf type 1 And type -1
SetGadgetText(1, Str(20-GetGadgetState(1)))
count = 0
EndIf
count + 1
EndSelect
EndSelect
Until event = #PB_Event_CloseWindow
EndIf
EndIf
PB beat me to it, disregard my example as the link in PB's post shows a much cleaner way!
Edited by - Pupil on 23 July 2002 18:58:35
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by halo.
Doesn't it seem odd that you are setting the text to the maximum number minus the gadget state? This is because the up arrow decreases the gadget state, while the down arrow increases it. I mean, it works just fine like I have it set up, but it seems very strange.
Doesn't it seem odd that you are setting the text to the maximum number minus the gadget state? This is because the up arrow decreases the gadget state, while the down arrow increases it. I mean, it works just fine like I have it set up, but it seems very strange.
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by PB.
> the up arrow decreases the gadget state, while the down arrow increases it.
This is a known "bug" (or perhaps oversight). Just swap the min and max values
for the gadget, and then the up/down buttons will work correctly; until the next
release of PureBasic where they will work properly.
PB - Registered PureBasic Coder
> the up arrow decreases the gadget state, while the down arrow increases it.
This is a known "bug" (or perhaps oversight). Just swap the min and max values
for the gadget, and then the up/down buttons will work correctly; until the next
release of PureBasic where they will work properly.
PB - Registered PureBasic Coder