ScrollAreaGadget limitation?

Everything else that doesn't fall into one of the other PB categories.
dige
Addict
Addict
Posts: 1247
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

ScrollAreaGadget limitation?

Post by dige »

Duno if its an improper use of the scrollareagadget, but I like
to fill it with 1.000 and more ImageGadgets like this:
but..

Code: Select all

Anz = 999
w = 190 : h = 160
x = Int(800/(w+2))
If Anz % 4
  y = (Anz / x) + 1
Else
  y = (Anz / x)
EndIf

OpenWindow(0, 0, 0, 800, 600, "", #WS_OVERLAPPEDWINDOW )
ScrollAreaGadget(0, 0, 0, 800, 600, 800, 600) 

Debug "Needed Height:" + str(y * (h+2))  
SetGadgetAttribute(0, #PB_ScrollArea_InnerHeight, y * (h+2))

; Seems that ScrollAreaHeight is limited to half WORD ($FFFF/2)
Debug "Have got: " + str(GetGadgetAttribute(0, #PB_ScrollArea_InnerHeight))
  
posy = 2

For i = 1 To y
  posx = 2
  For n = 1 To x
    Count + 1
    CreateImage(Count, w, h)
    If StartDrawing(ImageOutput(Count))
      Box(0,0,w,h, #White)  
      DrawText(10,10, Str(Count), #Blue, #White)
      StopDrawing()
    EndIf
    ButtonImageGadget(#PB_Any, posx, posy, w, h, ImageID(Count))
    posx + w + 2
  Next
  posy + h + 2
Next
CloseGadgetList()
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
Is it a pb or a generic limitation? if not, how to do it via API?
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: ScrollAreaGadget limitation?

Post by srod »

A scroll area uses a child control (a container if you like) to house all child gadgets. This container is moved around to simulate scrolling etc.

A windows limitation is that all windows/controls must have their dimensions and position (x, y) limited to 16 bits. This thus gives a max of 65535 pixels for width and height of the internal area of a scroll area gadget.
I may look like a mule, but I'm not a complete ass.
dige
Addict
Addict
Posts: 1247
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Re: ScrollAreaGadget limitation?

Post by dige »

thx srod for the info. but max of 65535 pixels is not
the pb limitation .. there's only round about 32.000 px
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Re: ScrollAreaGadget limitation?

Post by Kaeru Gaman »

sure?
16bit normally is -32768 to 32767...
the upper border is at "only round about 32.000 px", but the lower at minus "only round about 32.000 px", too.
oh... and have a nice day.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: ScrollAreaGadget limitation?

Post by srod »

Yes sorry, it is a signed 16-bit integer (check out the specs for MoveWindow_() for example) to allow for negative x/y.

This gives max width of 32767 as you can easily confirm with a scrollarea.
I may look like a mule, but I'm not a complete ass.
Post Reply