SpinGadget: Add an Increment value

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

SpinGadget: Add an Increment value

Post by IdeasVacuum »

SpinGadget(#Gadget, x, y, Width, Height, Minimum, Maximum, Increment [, Flags])

So, when #PB_Spin_Numeric flag is set, instead of the default increment of 1, Developer can specify 0.1, 2, 10, 100 etc.

IdeasVacuum
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: SpinGadget: Add an Increment value

Post by PB »

No, that's the coder's responsibility. All the SpinGadget does is go up or down; it's the coder who then changes the value by whatever increment they desire.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Re: SpinGadget: Add an Increment value

Post by Kaeru Gaman »

not correct.

I pimped the manual example to make a test:

Code: Select all

#Win_1 = 0
#Gad_Spin = 0

If Not OpenWindow(#Win_1, 0, 0, 140, 70, "SpinGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  End
EndIf
  SpinGadget     (#Gad_Spin, 20, 20, 100, 25, 0, 255)
  SetGadgetState (#Gad_Spin, 64) : SetGadgetText(#Gad_Spin, "64")

Repeat
  Event = WaitWindowEvent()
  EvGad = EventGadget()
  EvTyp = EventType()

  Select Event
    Case #PB_Event_CloseWindow
      EXIT = #True
    Case #PB_Event_Gadget
      Select EvGad
        Case #Gad_Spin
          Select EvTyp
            Case #PB_EventType_Change
            ; ** manual User input
              SetGadgetText( #Gad_Spin, Str( GetGadgetState( #Gad_Spin )))
            Case 1
            ; ** UP pressed
              SetGadgetState( #Gad_Spin, GetGadgetState( #Gad_Spin ) +3 )
              SetGadgetText( #Gad_Spin, Str( GetGadgetState( #Gad_Spin )))
            Case -1
            ; ** DOWN pressed
              SetGadgetState( #Gad_Spin, GetGadgetState( #Gad_Spin ) -3 )
              SetGadgetText( #Gad_Spin, Str( GetGadgetState( #Gad_Spin )))
          EndSelect
      EndSelect
  EndSelect
Until EXIT
as you see, I alter the current value by 3 to get a step of 4
the up/Down Event itself already changes the state by 1

... but I think those are SysInternals, I doubt it could be PureBasic's responsability to offer alternate step sizes.
oh... and have a nice day.
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: SpinGadget: Add an Increment value

Post by IdeasVacuum »

...I don't see it as wrong, a wish is a wish after all! :? Other languages I use do have this facility.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Re: SpinGadget: Add an Increment value

Post by Kaeru Gaman »

my remark "not correct" was the answer to "it's the coder who then changes the value by whatever increment they desire",
because the inc/dec of 1 is as shown directly connected with the event.

I just don't know if this step of 1 is connected with PureBasic's internals or with the OS' internals.
if the first, an alternate stepvalue would be easy to implement.
if the latter, it would mean to put some extra eventhandling upon the implementation, maybe via callback or whatever...
oh... and have a nice day.
Post Reply