Browse Presentation Parameters

This forum is for general support of Xbase++
Post Reply
Message
Author
reganc
Posts: 257
Joined: Thu Jan 28, 2010 3:08 am
Location: Hersham, Surrey, UK
Contact:

Browse Presentation Parameters

#1 Post by reganc »

Hi all

I know that a browse object is made up of various other objects being displayed on a background static object.

What I have never understood is how a single cell and a frame fit together. I have always presumed that a cell goes inside a frame and the frame is therefore what makes up a row.

Say, for instance, that you have a font with a height of 16 pixels and you want each row in a browse to be large enough to show that font to it's full height.

I presume that each frame type may need at least 2 pixels to show correctly around the outside of a cell. And using XBPFRAME_NONE means you don't need a border.

Does that sound right?

So with a 2 pixel frame, I would need to set XBP_PP_COL_DA_CELLHEIGHT to 16 and XBP_PP_COL_DA_ROWHEIGHT to 20 to show the full contents.
And with XBPFRAME_NONE, those numbers would both be 16.

Have I got the right idea about this?

I have played around with these numbers in the past and become completely confused and seen some odd sizing that I could not explain. I just thought I'd ask if anyone else had a clue...

Regan
Regan Cawkwell
Real Business Applications Ltd
http://www.rbauk.com

User avatar
Auge_Ohr
Posts: 1407
Joined: Wed Feb 24, 2010 3:44 pm

Re: Browse Presentation Parameters

#2 Post by Auge_Ohr »

hi,

if you "just want" big Font try to use XBP_PP_FONT with Font Object instead of XBP_PP_COMPOUNDNAME

if you want more Control try Ownerdraw with customDrawCell with this Calculation

Code: Select all

CLASS XbpCellGroupT FROM XbpCellGroup
...
METHOD XbpCellGroupT:CalculateOffset
*****************************
   LOCAL cBuffer1:= Space( 16 )
   LOCAL cBuffer2:= cBuffer1
   LOCAL aRect1  := ::cellRect( 1, .T. )
   LOCAL aRect2  := ::cellRect( 1, .F. )

   DllCall("User32.DLL", DLL_STDCALL,"GetWindowRect", ::getHwnd(), @cBuffer1 )
   DllCall("User32.DLL", DLL_STDCALL,"GetWindowRect", ::oDrawingArea:getHwnd(), @cBuffer2 )

   ::nXOffset:= Bin2U( left( cBuffer1, 4 ) )       - Bin2U( left( cBuffer2, 4 ) )
   ::nYOffset:= Bin2U( substr( cBuffer2, 13, 4 ) ) - Bin2U( substr( cBuffer1, 13, 4 ) )

   ::nXInner:= aRect1[ 1 ] - aRect2[ 1 ]
   ::nYInner:= aRect1[ 2 ] - aRect2[ 2 ]
RETURN self

METHOD XbpCellGroupT:customDrawCell( oPS, aInfo )
******************************************
...
   aInfo[ 4, 1 ] -= ::nXInner
   aInfo[ 4, 2 ] -= ::nYInner
   aInfo[ 4, 3 ] += ::nXInner
   aInfo[ 4, 4 ] += ::nYInner

   ::oLogoBMP:draw( oPS, aInfo[ 4 ], { aInfo[ 4, 1 ] + ::nXOffset, aInfo[ 4, 2 ] + ::nYOffset, ;
                                       aInfo[ 4, 3 ] + ::nXOffset, aInfo[ 4, 4 ] + ::nYOffset } )
RETURN self
these Coordinate are for each Cell include "Frame" where i draw my own visual Style to get a hole Image as Background.
Attachments
each Cell draw a Part of hole Image as visual Style
each Cell draw a Part of hole Image as visual Style
Browse_with_Image_as_Background.PNG (465.68 KiB) Viewed 13867 times
greetings by OHR
Jimmy

reganc
Posts: 257
Joined: Thu Jan 28, 2010 3:08 am
Location: Hersham, Surrey, UK
Contact:

Re: Browse Presentation Parameters

#3 Post by reganc »

[quote="Auge_Ohr"]hi,

if you "just want" big Font try to use XBP_PP_FONT with Font Object instead of XBP_PP_COMPOUNDNAME

[/quote]

Thanks Jimmy but it's not really about getting a big font although we do adjust the font size based on resolution. It's more about me understanding how the individual components make up a browse object and how the height of each affects the display of the browse.

I found a message in the v2.0 newsgroup that basically says that 1.9 and earlier messed up the setting of a row height because it always added an extra 6 pixels to the height. There was code in there that showed a way to workaround the issue.

But my main question is 'What is the height of a row going to be in the following situations?'

1. CELLHEIGHT is 12 pixels, FRAMEHEIGHT is 20 pixels.

2. CELLHEIGHT is 20 pixels, FRAMEHEIGHT is 12 pixels.

I believe that 1 should be 20 and 2 should be 12. Am I right?

So following on from that, I would ask:

1. Do you need to set both?
2. As the default appears to be AUTOSIZE, does that mean that you really only need to set the CELLHEIGHT?
3. How does the use of MULTIROWs affect the height setting? Is the pixel height for a single cell or for the combined 'multi-cell'?

Any ideas?
Regan Cawkwell
Real Business Applications Ltd
http://www.rbauk.com

User avatar
Auge_Ohr
Posts: 1407
Joined: Wed Feb 24, 2010 3:44 pm

Re: Browse Presentation Parameters

#4 Post by Auge_Ohr »

hi,

you are talking about combination of Xbase++ Presentation Parameter and its secrets : how does XbpBrowse() "measure" hight of Item ?
have a look into XbpBrowse Source for DataAreaLayout ...



if no PP used, Windows will "calculate" on "active" Font.

if Row height is set, than Frame*** will adjust to it

Code: Select all

LOCAL aPP := {{XBP_PP_COL_DA_ROWHEIGHT       , 40 }}
   oBrowse := XbpBrowse():new( oParent,, aPos, aSize,aPP, .F. ):create()
if Font (Name) is used, Frame*** will calculate on "that" Font

Code: Select all

LOCAL aCC := {{XBP_PP_COL_DA_COMPOUNDNAME    ,"40.Times New Roman" }}
   oBrowse := XbpBrowse():new( oParent,, aPos, aSize,aCC, .F. ):create()
***Frame : ( 1 Line +1 "light" +1 "shadow" ) * 2 = 6
40 Pixel
40 Pixel
Browse_40.PNG (44.85 KiB) Viewed 13830 times
for multiline your Row height must be

Code: Select all

   nItemheight := oFont:height
   nRowheight := nItemheight * nItemRow
   aPP := {{XBP_PP_COL_DA_ROWHEIGHT      , nRowheight }}
   oBrowse := XbpBrowse():new( oParent,, aPos, aSize,aPP, .F. ):create()
my Tip : using Ownerdraw will give you more Control over your Browse.
greetings by OHR
Jimmy

reganc
Posts: 257
Joined: Thu Jan 28, 2010 3:08 am
Location: Hersham, Surrey, UK
Contact:

Re: Browse Presentation Parameters

#5 Post by reganc »

Auge_Ohr wrote: you are talking about combination of Xbase++ Presentation Parameter and its secrets : how does XbpBrowse() "measure" height of Item ?
have a look into XbpBrowse Source for DataAreaLayout ...
I'm not sure I have the source for both 1.9 and 2.0.
Auge_Ohr wrote: if no PP used, Windows will "calculate" on "active" Font.

if Row height is set, than Frame*** will adjust to it

Code: Select all

LOCAL aPP := {{XBP_PP_COL_DA_ROWHEIGHT       , 40 }}
   oBrowse := XbpBrowse():new( oParent,, aPos, aSize,aPP, .F. ):create()
if Font (Name) is used, Frame*** will calculate on "that" Font

Code: Select all

LOCAL aCC := {{XBP_PP_COL_DA_COMPOUNDNAME    ,"40.Times New Roman" }}
   oBrowse := XbpBrowse():new( oParent,, aPos, aSize,aCC, .F. ):create()
***Frame : ( 1 Line +1 "light" +1 "shadow" ) * 2 = 6for multiline your Row height must be

Code: Select all

   nItemheight := oFont:height
   nRowheight := nItemheight * nItemRow
   aPP := {{XBP_PP_COL_DA_ROWHEIGHT      , nRowheight }}
   oBrowse := XbpBrowse():new( oParent,, aPos, aSize,aPP, .F. ):create()
my Tip : using Ownerdraw will give you more Control over your Browse.
Thanks for the clarification here, Jimmy.

But what happens when you use the frame type NOFRAME in the browse pres params? Is the extra height of 6 pixels still added to the overall row height? If yes, then that jsut confuses things as it means that you actually cannot get rid of the frame area on a browse row.

We never set the font for a browse in the presentation parameters. We set it using the FONT clause of a DCBROWSE command. I've just had a quick look into the code in dc_XbpBrowse and it does take the font and put it into the presentation parameters as a COMPOUNDNAME entry for the header, data and footer areas.

At the moment I am trying to understand why, in Xbase++ v2.0, the presentation parameters are not automatically inherited by browse columns from the parent browse object. I can see in the dc_XbpColumn that the parent pres array is cloned and then any explicit pres parameters passed are 'merged' into that array. As far as I have seen, this just does not seem to work in v2.0.
Regan Cawkwell
Real Business Applications Ltd
http://www.rbauk.com

User avatar
Auge_Ohr
Posts: 1407
Joined: Wed Feb 24, 2010 3:44 pm

Re: Browse Presentation Parameters

#6 Post by Auge_Ohr »

reganc wrote:At the moment I am trying to understand why, in Xbase++ v2.0, the presentation parameters are not automatically inherited by browse columns from the parent browse object. I can see in the dc_XbpColumn that the parent pres array is cloned and then any explicit pres parameters passed are 'merged' into that array. As far as I have seen, this just does not seem to work in v2.0.
when try 1st v2.x beta from Devcon Hannover 2012 Presentation Parameters of XbpBrowse was total wrong and no Alaska Sample run without Ownerdraw.

remember there is NO "Browse" Windows Control ... but you have ListView in Windows OS.
XBP_PP* Constante are from Alaska for XbParts but i`m not sure if there is a API equivalent.

using Font with Windows API will work with XbParts too when using Ownerdraw.
Font will be active for all Child as long as you does not change Font.

Ownerdraw have two Part : "measureItem" and "drawItem"
"measureItem" will calculate on active Font but XbpBrowse does not have that Callback Slot ?!
( Steffen once say XbpBrowse have "measureItem" but i never found it ... )

normal Ownerdraw call "measureItem" once while advance Ownerdraw will call it on every Item.
XbpBrowse():DrawMode say it have XBP_DRAW_OWNERADVANCED but i was not able yet to modify height "for each Row" at Runtime.

i think, as Alaska have build v2.0 on Xbase++ < 1.9.331, some "visual Style" are still not working like in v1.9.355 SL1 + Hotfix
greetings by OHR
Jimmy

Post Reply