It is currently Mon Sep 16, 2019 5:24 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: ScrollAreaGadget limitation?
PostPosted: Thu Oct 22, 2009 2:10 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Apr 30, 2003 8:15 am
Posts: 983
Location: Germany
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:
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?


Top
 Profile  
Reply with quote  
 Post subject: Re: ScrollAreaGadget limitation?
PostPosted: Thu Oct 22, 2009 2:22 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 10524
Location: Beyond the pale...
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: ScrollAreaGadget limitation?
PostPosted: Thu Oct 22, 2009 7:39 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Apr 30, 2003 8:15 am
Posts: 983
Location: Germany
thx srod for the info. but max of 65535 pixels is not
the pb limitation .. there's only round about 32.000 px


Top
 Profile  
Reply with quote  
 Post subject: Re: ScrollAreaGadget limitation?
PostPosted: Thu Oct 22, 2009 7:47 pm 
Offline
Addict
Addict
User avatar

Joined: Sun Mar 19, 2006 1:57 pm
Posts: 4828
Location: Germany
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: ScrollAreaGadget limitation?
PostPosted: Thu Oct 22, 2009 7:54 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 10524
Location: Beyond the pale...
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.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye