Page 1 of 1

Panel Gadget with\without Spin Control [Windows]

Posted: Wed Oct 21, 2020 10:15 pm
by RASHAD
Hi

Code: Select all

Global Dim spin(5)

Procedure HideSpin(gad)
  hwnd = GetWindow_(GadgetID(gad),#GW_CHILD   )
  hSpin = FindWindowEx_(GadgetID(gad), hwnd, "msctls_updown32", 0)
  If hSpin
    spin(gad) = hSpin
  EndIf
EndProcedure

If OpenWindow(0, 0, 0, 350, 255, "PanelGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  PanelGadget     (0, 10, 10, 316, 203)
    AddGadgetItem (0, -1, "Panel 1")
      PanelGadget (1, 5, 5, 242, 166)
        AddGadgetItem(1, -1, "Sub-Panel 1")
        AddGadgetItem(1, -1, "Sub-Panel 2")
        AddGadgetItem(1, -1, "Sub-Panel 3")
        AddGadgetItem(1, -1, "Sub-Panel 4")
        AddGadgetItem(1, -1, "Sub-Panel 5")
        AddGadgetItem(1, -1, "Sub-Panel 6")
      CloseGadgetList()
    AddGadgetItem (0, -1,"Panel 2")
      ButtonGadget(2, 10, 15, 80, 24,"Button 1")
      ButtonGadget(3, 95, 15, 80, 24,"Button 2")
    AddGadgetItem (0, -1,"Panel 3")
    AddGadgetItem (0, -1,"Panel 4")
    AddGadgetItem (0, -1,"Panel 5")
    AddGadgetItem (0, -1,"Panel 6")
    AddGadgetItem (0, -1,"Panel 7")
    AddGadgetItem (0, -1,"Panel 8")
    AddGadgetItem (0, -1,"Panel 9")
    AddGadgetItem (0, -1,"Panel 10")
  CloseGadgetList()
  HideSpin(0)
  HideSpin(1)
  FrameGadget(#PB_Any,9,9,318,205,"",#PB_Frame_Flat)
  ButtonGadget(10,10,220,80,24,"Spin 0")
  ButtonGadget(20,100,220,80,24,"Spin 1")
  Repeat
    Select WaitWindowEvent()
      Case #PB_Event_CloseWindow
        Quit = 1
       
      Case #PB_Event_Gadget
        Select EventGadget()
          Case 10
            Run0 ! 1
            If Run0 = 0
              ShowWindow_(Spin(0),#SW_SHOW)
            Else
              ShowWindow_(Spin(0),#SW_HIDE)
            EndIf
           
          Case 20
            Run1 ! 1
            If Run1 = 0
              ShowWindow_(Spin(1),#SW_SHOW)
            Else
              ShowWindow_(Spin(1),#SW_HIDE)
            EndIf         
         
        EndSelect
    EndSelect
  Until Quit = 1
EndIf
Edit :Update

Re: Panel Gadget with\without Spin Control [Windows]

Posted: Wed Oct 21, 2020 10:50 pm
by Paul
I think I'm missing something...
What am I suppose to see here?

Re: Panel Gadget with\without Spin Control [Windows]

Posted: Thu Oct 22, 2020 2:14 am
by RASHAD
viewtopic.php?f=13&t=76119

You can hide or show the scroll control at the right edge at any time
That mean you can enable or disable the Panel gadget scroll

Re: Panel Gadget with\without Spin Control [Windows]

Posted: Thu Oct 22, 2020 4:28 am
by Paul
This is what I see when I run your example on Windows 10 Home...
(Pressing Spin0 or Spin1 shows nothing different)

Image


If I enable DPI aware I see this...
Image

Re: Panel Gadget with\without Spin Control [Windows]

Posted: Thu Oct 22, 2020 5:38 am
by RASHAD
Hi Paul
Previous post updated to show the purpose of this snippet

Re: Panel Gadget with\without Spin Control [Windows]

Posted: Thu Oct 22, 2020 3:05 pm
by Paul
Thanks RASHAD, arrows now appear.

Not sure why anyone would want to remove the arrows.
If you press the tab farthest right it will advance to the next tab and the tab farthest left will be removed, but without the arrows there is no way to return to the previous tabs once they are off the screen.

Re: Panel Gadget with\without Spin Control [Windows]

Posted: Thu Oct 22, 2020 3:58 pm
by Mohsen
Paul wrote: Not sure why anyone would want to remove the arrows.
If you press the tab farthest right it will advance to the next tab and the tab farthest left will be removed, but without the arrows there is no way to return to the previous tabs once they are off the screen.
Hi Paul
you are right, this may not useful for everyone. but I'm building my new visual designer and I needed that feature. I have no problem detecting clicks on tabs, but this spin control made it a little difficult for me, so I decided to get rid of it for now.

Image

Re: Panel Gadget with\without Spin Control [Windows]

Posted: Thu Oct 22, 2020 5:30 pm
by Paul
Like I said, without the arrows you lose the ability to go back to the beginning tabs.
As your animation demonstrates you had to increase the size of the panel just to get the tabs back into view.

This is just a "heads up" to anyone that decides to remove the navigation arrows and what the consequences might be for doing that :)

Thanks to RASHAD for the code to remove them but also the ability to easily bring them back!

Re: Panel Gadget with\without Spin Control [Windows]

Posted: Thu Oct 22, 2020 5:54 pm
by Mohsen
That's right, but I have a solution for that. I manage it. :wink: