Disable scrollbar

Just starting out? Need help? Post your questions and find answers here.
coco2
Enthusiast
Enthusiast
Posts: 461
Joined: Mon Nov 25, 2013 5:38 am
Location: Australia

Disable scrollbar

Post by coco2 »

Is there any way to disable the scrollbars, ie make the actual scrollbar disappear and just have the background left? I'm looking for a cross platform solution.
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4995
Joined: Sun Apr 12, 2009 6:27 am

Re: Disable scrollbar

Post by RASHAD »

You didn't mention which Gadget you want to disable the scroll bar
Anyway you can use your gadget inside a ContainerGadget() with less dimensions to do not show the the scroll bar
I hope it's a cross platform solution
Or wait for Shardik to post a cross platform API solution :)
Egypt my love
coco2
Enthusiast
Enthusiast
Posts: 461
Joined: Mon Nov 25, 2013 5:38 am
Location: Australia

Re: Disable scrollbar

Post by coco2 »

I think it's a canvas gadget. I'm looking at years old code o.O
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4995
Joined: Sun Apr 12, 2009 6:27 am

Re: Disable scrollbar

Post by RASHAD »

Hi coco2
But CanvasGadget doesn't have a scroll bar
Can you post a simple snippet to show us what you want to do ?
Anyway with PB every thing is possible :wink:
Egypt my love
coco2
Enthusiast
Enthusiast
Posts: 461
Joined: Mon Nov 25, 2013 5:38 am
Location: Australia

Re: Disable scrollbar

Post by coco2 »

Hi Rashad,

If you run this code you will see the scrollbar is maximum size meaning you can't move it left or right. I am wondering since the scrollbar is "maxed out" can it be disabled to show that you cannot scroll. Or do you think it is better to have the scrollbar there?

Code: Select all

OpenWindow(0, 0, 0, 400, 400, "Test Scrollbar", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ScrollBarGadget(0, 10, 380, 380, 20, 0, 32, 8)
SetGadgetAttribute(0, #PB_ScrollBar_Maximum, 0)
SetGadgetAttribute(0, #PB_ScrollBar_PageLength, 1)
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
mestnyi
Addict
Addict
Posts: 1103
Joined: Mon Nov 25, 2013 6:41 am

Re: Disable scrollbar

Post by mestnyi »

Code: Select all

OpenWindow(0, 0, 0, 400, 400, "Test Scrollbar", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ScrollBarGadget(0, 10, 380, 380, 20, 0, 32, 8)
SetGadgetAttribute(0, #PB_ScrollBar_Maximum, 0)
SetGadgetAttribute(0, #PB_ScrollBar_PageLength, 1)

If GetGadgetAttribute(0, #PB_ScrollBar_Maximum) < GetGadgetAttribute(0, #PB_ScrollBar_PageLength)
   DisableGadget(0, 1 )
EndIf

Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
coco2
Enthusiast
Enthusiast
Posts: 461
Joined: Mon Nov 25, 2013 5:38 am
Location: Australia

Re: Disable scrollbar

Post by coco2 »

Thanks code works perfectly for me :D
Post Reply