Alaska Software Inc. - Determing XbpBrowse Size
Username: Password:
AuthorTopic: Determing XbpBrowse Size
Carlos a Beling Determing XbpBrowse Size
on Thu, 23 Mar 2017 11:00:50 -0300
Good morning.
Please how can I know the current size of XbpBrowse object after to 
insert a XbpColumn?

Fraternally
Beling
Carlos a Beling Re: Determing XbpBrowse Size - Clarifying
on Tue, 28 Mar 2017 16:30:43 -0300
Good afternoon.
As I could see XbpBrowse() defaults its size to its 
:setParent():drawingArea:currenSize(), shows up the vertical scroll bar 
in the right side of its SetParent():drawingArea and returns its size 
the same as :setParent():drawingArea:currenSize().
I want to put the vertical scroll bar at the right of the last visible 
column when the XbpBrowse():currentSize() (???) is less than the size of 
its :setParent():drawingArea:currentSize().
Can someone tell me how to do it?

Fraternally
Beling




Em 23/03/2017 11:00, Carlos a Beling escreveu:
> Good morning.
> Please how can I know the current size of XbpBrowse object after to
> insert a XbpColumn?
>
> Fraternally
> Beling
Andreas Gehrs-Pahl
Re: Determing XbpBrowse Size - Clarifying
on Wed, 29 Mar 2017 04:36:40 -0400
Carlos,

>As I could see XbpBrowse() defaults its size to its 
>:setParent():drawingArea:currenSize(), shows up the vertical scroll bar 
>in the right side of its SetParent():drawingArea and returns its size 
>the same as :setParent():drawingArea:currenSize().

If you do not set a size when you :Create() an XbpBrowse table, the size 
will default to ::SetParent:CurrentSize() -- no ":DrawingArea" is involved, 
as the parent usually is the :DrawingArea of an XbpDialog, unless you do 
something really weird.

>I want to put the vertical scroll bar at the right of the last visible 
>column when the XbpBrowse():currentSize() (???) is less than the size of 
>its :setParent():drawingArea:currentSize().

To enable the Vertical ScrollBar, set ::vScroll to .t. before you :Create() 
the browse table, or use :Configure() to change it after you have created 
the browse table.

The actual position of the vertical scroll bar is always the far right of 
the XbpBrowse() object. You can't change that position, as the Scroll bars 
are siblings of the Background object, which is the parent of the Scrolling 
Background object, which itself is the parent of the XbpColumns.

To accomplish what you want to do, you would have to resize the Background 
object to be the same width as the Scrollable-Background object, and then 
move the Vertical ScrollBar object to the left, to be adjacent to it. You 
might also want to shorten the Horizontal Scrollbar object and move the 
little Corner Square, too, for aesthetic reasons.

>Can someone tell me how to do it?

As the Background object and the Scrolling Background object, as well as the 
little Corner Square object, are protected, you can only modify their size 
and position by changing the original code or creating a derived class.

You can find the source code for the XbpBrowse class in the xbp-browse*.prg 
files in the "...\Source\Runtime\DUI\" directory, if you want to modify the 
original implementation or if you want to see how it works. The position of 
the vertical scroll bar is set and calculated in the ::Rearrange() method. 

Alternatively, you could simply set the size of the entire Browse table to 
be as wide as all its Columns (plus the ScrollBar), which would give you 
pretty much the same result. You can calculate the width by either using the 
current width of the Scrolling Background object or the X-Position of the 
last XbpColumn plus its Width, plus the width of the Vertical ScrollBar.

For example, the following will resize the Browse table to place the 
ScrollBar next to the last Column:

oColumn := oBrowse:GetColumn(oBrowse:ColCount)
oScroll := oBrowse:GetVScrollObject()
oBrowse:SetSize({oColumn:CurrentPos()[1] + oColumn:CurrentSize()[1] + ;
oScroll:CurrentSize()[1], oBrowse:CurrentSize()[2]})

In either case, increasing the size of columns or adding new columns would 
be more difficult, if the ScrollBar is next to the last column. Also, if you 
dynamically re-size the Browse table, for example when re-sizing its parent,
(the Dialog's DrawingArea), the available space for the columns couldn't be 
made to increase, without moving the ScrollBar to the right.

Hope that helps,

Andreas

Andreas Gehrs-Pahl
Absolute Software, LLC

phone: (989) 723-9927
email: Andreas@AbsoluteSoftwareLLC.com
web:   http://www.AbsoluteSoftwareLLC.com
[F]:   https://www.facebook.com/AbsoluteSoftwareLLC
Carlos a Beling Re: Determing XbpBrowse Size - Clarifying
on Wed, 29 Mar 2017 14:59:29 -0300
Hello Andreas:
many thanks again.
I will do what you coded below.

Fraternally
Beling


Em 29/03/2017 05:36, Andreas Gehrs-Pahl escreveu:
> Carlos,
>
>> As I could see XbpBrowse() defaults its size to its
>> :setParent():drawingArea:currenSize(), shows up the vertical scroll bar
>> in the right side of its SetParent():drawingArea and returns its size
>> the same as :setParent():drawingArea:currenSize().
>
> If you do not set a size when you :Create() an XbpBrowse table, the size
> will default to ::SetParent:CurrentSize() -- no ":DrawingArea" is involved,
> as the parent usually is the :DrawingArea of an XbpDialog, unless you do
> something really weird.
>
>> I want to put the vertical scroll bar at the right of the last visible
>> column when the XbpBrowse():currentSize() (???) is less than the size of
>> its :setParent():drawingArea:currentSize().
>
> To enable the Vertical ScrollBar, set ::vScroll to .t. before you :Create()
> the browse table, or use :Configure() to change it after you have created
> the browse table.
>
> The actual position of the vertical scroll bar is always the far right of
> the XbpBrowse() object. You can't change that position, as the Scroll bars
> are siblings of the Background object, which is the parent of the Scrolling
> Background object, which itself is the parent of the XbpColumns.
>
> To accomplish what you want to do, you would have to resize the Background
> object to be the same width as the Scrollable-Background object, and then
> move the Vertical ScrollBar object to the left, to be adjacent to it. You
> might also want to shorten the Horizontal Scrollbar object and move the
> little Corner Square, too, for aesthetic reasons.
>
>> Can someone tell me how to do it?
>
> As the Background object and the Scrolling Background object, as well as the
> little Corner Square object, are protected, you can only modify their size
> and position by changing the original code or creating a derived class.
>
> You can find the source code for the XbpBrowse class in the xbp-browse*.prg
> files in the "...\Source\Runtime\DUI\" directory, if you want to modify the
> original implementation or if you want to see how it works. The position of
> the vertical scroll bar is set and calculated in the ::Rearrange() method.
>
> Alternatively, you could simply set the size of the entire Browse table to
> be as wide as all its Columns (plus the ScrollBar), which would give you
> pretty much the same result. You can calculate the width by either using the
> current width of the Scrolling Background object or the X-Position of the
> last XbpColumn plus its Width, plus the width of the Vertical ScrollBar.
>
> For example, the following will resize the Browse table to place the
> ScrollBar next to the last Column:
>
> oColumn := oBrowse:GetColumn(oBrowse:ColCount)
> oScroll := oBrowse:GetVScrollObject()
> oBrowse:SetSize({oColumn:CurrentPos()[1] + oColumn:CurrentSize()[1] + ;
> oScroll:CurrentSize()[1], oBrowse:CurrentSize()[2]})
>
> In either case, increasing the size of columns or adding new columns would
> be more difficult, if the ScrollBar is next to the last column. Also, if you
> dynamically re-size the Browse table, for example when re-sizing its parent,
> (the Dialog's DrawingArea), the available space for the columns couldn't be
> made to increase, without moving the ScrollBar to the right.
>
> Hope that helps,
>
> Andreas
>
Jim LeeRe: Determing XbpBrowse Size
on Wed, 29 Mar 2017 12:58:01 +0200
> Please how can I know the current size of XbpBrowse object after to insert 
> a XbpColumn?

not sure about height but wide i calculate this way

   j := 1
   jMax := oBrowse:colCount
   FOR j := 1 TO jMax
      oCol  := oBrowse:getColumn( j )
      aSize := oCol:dataarea:currentsize()
      nSum  += aSize[ 1 ]  / wide
   NEXT
Jim LeeRe: Determing XbpBrowse Size
on Wed, 29 Mar 2017 13:01:19 +0200
>  nSum  += aSize[ 1 ]   / wide
    nSum  += aSize[ 1 ]    wide as comment