ScrollAreaGadget(): Permanently displaying scrollbars?
- Dreamland Fantasy
- Enthusiast
- Posts: 335
- Joined: Fri Jun 11, 2004 9:35 pm
- Location: Glasgow, UK
- Contact:
ScrollAreaGadget(): Permanently displaying scrollbars?
Hi there,
I was wondering, is it possible to permanently display scrollbars on a ScrollAreaGadget()? Specifically, I'm just looking to always have the vertical scrollbar displayed.
Kind regards,
Francis
I was wondering, is it possible to permanently display scrollbars on a ScrollAreaGadget()? Specifically, I'm just looking to always have the vertical scrollbar displayed.
Kind regards,
Francis
Re: ScrollAreaGadget(): Permanently displaying scrollbars?
Hi
Code: Select all
If OpenWindow(0, 0, 0, 500, 400, "Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
If ScrollAreaGadget(1, 10, 10, 480, 380, 450,350, 10, 0)
ButtonGadget(2, 10, 100, 100, 20, "Button", 0)
CloseGadgetList()
EndIf
ShowScrollBar_(GadgetID(1), #SB_BOTH, 1)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
End
EndSelect
ForEver
EndIf
Egypt my love
Re: ScrollAreaGadget(): Permanently displaying scrollbars?
You can change inner width and height of scroll area.
Code: Select all
Procedure BindScrollDatas()
SetWindowTitle(0, "ScrollAreaGadget " +
"(" +
GetGadgetAttribute(0, #PB_ScrollArea_X) +
"," +
GetGadgetAttribute(0, #PB_ScrollArea_Y) +
")" )
EndProcedure
Procedure UpdateWindow()
Protected dx, dy
dx = WindowWidth(0)
dy = WindowHeight(0)
If dy > 550
SetGadgetAttribute(0, #PB_ScrollArea_InnerHeight, dy - 20)
EndIf
SetGadgetAttribute(0, #PB_ScrollArea_InnerWidth, dx - 30 - 20)
ResizeGadget(0, 10, 10, dx - 20, dy - 20)
EndProcedure
#WinStyle = #PB_Window_SystemMenu | #PB_Window_SizeGadget
If OpenWindow(0, #PB_Ignore, #PB_Ignore, 420, 240, "ScrollAreaGadget", #WinStyle)
ScrollAreaGadget(0, 10, 10, 400, 220, 370, 550, 30)
ButtonGadget (1, 10, 10, 230, 30,"Button 1")
ButtonGadget (2, 50, 50, 230, 30,"Button 2")
ButtonGadget (3, 90, 90, 230, 30,"Button 3")
TextGadget (4,130,130, 230, 20,"This is the content of a ScrollAreaGadget!",#PB_Text_Right)
CloseGadgetList()
BindGadgetEvent(0, @ BindScrollDatas())
BindEvent(#PB_Event_SizeWindow, @UpdateWindow(), 0)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
End
Case #PB_Event_Gadget
Select EventGadget()
Case 0
Case 1
MessageRequester("Info","Button 1 was pressed!",#PB_MessageRequester_Ok)
Case 2
MessageRequester("Info","Button 2 was pressed!",#PB_MessageRequester_Ok)
Case 3
MessageRequester("Info","Button 3 was pressed!",#PB_MessageRequester_Ok)
EndSelect
EndSelect
ForEver
EndIf
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Re: ScrollAreaGadget(): Permanently displaying scrollbars?
Ok, with Rashad API
Code: Select all
Procedure UpdateWindow()
Protected dx, dy
dx = WindowWidth(0)
dy = WindowHeight(0)
ResizeGadget(0, 10, 10, dx - 20, dy - 20)
ShowScrollBar_(GadgetID(0), #SB_VERT, 1)
ShowScrollBar_(GadgetID(0), #SB_HORZ, 0)
EndProcedure
#WinStyle = #PB_Window_SystemMenu | #PB_Window_SizeGadget
If OpenWindow(0, 0, 0, 500, 400, "Window", #WinStyle)
If ScrollAreaGadget(0, 10, 10, 480, 380, 450, 350, 10, 0)
ButtonGadget(1, 10, 100, 100, 20, "Button", 0)
CloseGadgetList()
EndIf
ShowScrollBar_(GadgetID(0), #SB_VERT, 1)
ShowScrollBar_(GadgetID(0), #SB_HORZ, 0)
BindEvent(#PB_Event_SizeWindow, @UpdateWindow(), 0)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
End
EndSelect
ForEver
EndIf
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
- Dreamland Fantasy
- Enthusiast
- Posts: 335
- Joined: Fri Jun 11, 2004 9:35 pm
- Location: Glasgow, UK
- Contact:
Re: ScrollAreaGadget(): Permanently displaying scrollbars?
Thanks for the quick response RASHAD.
I actually already tried using ShowScrollBar_(), but I could not get it to work with my code. Your test code works fine, but if I plug the ShowScrollBar_(GadgetID(1), #SB_BOTH, 1) into my code only the horizontal bar is displayed.
I'm using Dialogs to create the window and gadgets. Stripping my code down to just the window and gadget creation works fine with the ShowScrollBar_(), so I'm very confused why it is not working in the full code.
Kind regards,
Francis
I actually already tried using ShowScrollBar_(), but I could not get it to work with my code. Your test code works fine, but if I plug the ShowScrollBar_(GadgetID(1), #SB_BOTH, 1) into my code only the horizontal bar is displayed.
I'm using Dialogs to create the window and gadgets. Stripping my code down to just the window and gadget creation works fine with the ShowScrollBar_(), so I'm very confused why it is not working in the full code.
Kind regards,
Francis
- Dreamland Fantasy
- Enthusiast
- Posts: 335
- Joined: Fri Jun 11, 2004 9:35 pm
- Location: Glasgow, UK
- Contact:
Re: ScrollAreaGadget(): Permanently displaying scrollbars?
You have to call the function ShowScrollBar after each change of size or inner size
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Re: ScrollAreaGadget(): Permanently displaying scrollbars?
Hi Francis
Try mk-soft idea
Try mk-soft idea
Code: Select all
Procedure scrollCB()
ShowScrollBar_(GadgetID(1), #SB_VERT, 1)
EndProcedure
If OpenWindow(0, 0, 0, 500, 400, "Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
If ScrollAreaGadget(1, 10, 10, 480, 380, 450,350, 10, 0)
ShowScrollBar_(GadgetID(1), #SB_VERT, 1)
ButtonGadget(2, 10, 100, 100, 20, "Button", 0)
CloseGadgetList()
EndIf
BindGadgetEvent(1,@scrollCB())
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
End
EndSelect
ForEver
EndIf
Egypt my love
- Dreamland Fantasy
- Enthusiast
- Posts: 335
- Joined: Fri Jun 11, 2004 9:35 pm
- Location: Glasgow, UK
- Contact: