Code: Select all
#MIN_WW = 100
#MIN_WH = 100
ww = 400
wh = 300
#MIN_SW = 500
#MIN_SH = 500
sw = 500
sh = 500
If OpenWindow(0, #CW_USEDEFAULT, #CW_USEDEFAULT, ww, wh, #PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_SizeGadget|#PB_Window_TitleBar, "Test")
If CreateGadgetList(WindowID())
ScrollAreaGadget(1, 10, 10, ww - 20, wh - 20, sw, sh, 20)
ButtonGadget(2, 0, 0, #MIN_SW, #MIN_SH, "You suck! ;)")
CloseGadgetList()
EndIf
Repeat
ev.l = WaitWindowEvent()
While ev
Select ev
Case #PB_Event_CloseWindow
quit = 1
Case #PB_Event_SizeWindow
ww = WindowWidth() : If ww < #MIN_WW : ww = #MIN_WW : redo = 1 : EndIf
wh = WindowHeight() : If wh < #MIN_WH : wh = #MIN_WH : redo = 1 : EndIf
If redo : redo = 0 : ResizeWindow(ww, wh) : EndIf
If (ww-20)>sw : sw = ww-20 : EndIf
If sw < #MIN_SW : sw = #MIN_SW : EndIf
If (wh-20)>sh : sh = wh-20 : EndIf
If sh < #MIN_SW : sh = #MIN_SW : EndIf
ResizeGadget(1, 10, 10, ww-20, wh-20)
SetGadgetAttribute(1, #PB_ScrollArea_InnerWidth, sw)
SetGadgetAttribute(1, #PB_ScrollArea_InnerHeight, sh)
EndSelect
ev = WindowEvent()
Wend
Until quit=1
CloseWindow(0)
EndIf
End
Even if I make the inner sizes smaller than the window size (by the width of the border, which according to the docs I shouldn't do) it still doesn't work. What I'm trying to achieve here is to have the scrollbars appear only when the area goes below a certain size and for the area just to be displayed plainly when it is above this size.
Perhaps my code just sucks, but it does appear as if the gadget cannot decide when it should have scrollbars.
Any takers?
Cheers.
