FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour xBrowse and bSetUp
Posts: 6984
Joined: Fri Oct 07, 2005 07:07 PM
xBrowse and bSetUp
Posted: Wed May 13, 2009 09:56 AM
Hello NagesWaraRao,

would you please show me how to use
Report() with a xBrowse of an ARRAY.

I would like to hide some columns.
I tried like this but with no success.

Thanks in advance
Otto

Code (fw): Select all Collapse
DEFINE BUTTON FILE ".\bmpMenu\info.bmp"  OF oBar ;
      ACTION  oBrw:Report( 'TestReport', , ,  { |oRep, oBrw| MySetUp( oRep, oBrw) } )  ;
      PROMPT "Info" +CRLF + "Druck"
//----------------------------------------------------------------------------//


static function MySetUp( oRep, oBrw)

   oBrw:aCols[1]:lHide = .t.
   oBrw:aCols[5]:lHide = .t.
    oBrw:aCols[6]:lHide = .t.
  return .t.
//----------------------------------------------------------------------------//
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse and bSetUp
Posted: Wed May 13, 2009 03:50 PM
Alternative-1:

Code (fw): Select all Collapse
define button ...... action MyReport( oBrw )
...
...

static function MyReport( oBrw )

   oBrw:aCols[ 1 ]:lHide := .t.
   oBrw:aCols[ 5 ]:lHide := .t.
   oBrw:Report( 'Title')
   oBrw:aCols[ 1 ]:lHide := .f.
   oBrw:aCols[ 5 ]:lHide := .f.
   oBrw:Refresh()
   oBrw:SetFocus()

return nil

This is simpler. But can occasionally show up the browse with columns hidden before the printing is finished. This works well when preview is used.

Alternative - 2 is to define all your own report columns in the setup block and return .t.. When the bSetUp returns .t., the xbrowse does not add any columns by itself.
Regards



G. N. Rao.

Hyderabad, India
Posts: 6984
Joined: Fri Oct 07, 2005 07:07 PM
Re: xBrowse and bSetUp
Posted: Wed May 13, 2009 06:00 PM

Hello Mr. NagegesWaraRao,

thank you for your help.

I tested alternative 1.
It is working well.
What I did not found out is if I could also change the width?
oLbx:aCols[3]:nWidth := 20
This is not working for me.

Maybe you have some more code how to use the alterantive 2.
I am not clear how to use bSetUp.

Thanks for taking time.
Best regards,
Otto

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse and bSetUp
Posted: Wed May 13, 2009 07:50 PM
XBrowse widths are in screen pixels. Report column sizes are in number of characters. Chaning browse column size has no effect on the report column sizes.
Actually xbrowse report method's bSetUp block is called twice ( from version 9.03 onwards ). First time it is called before creation of report columns. If the bsetup returns 2, it is called again after the columns are created. At that time, we can change the attributes of the report columns.
Code (fw): Select all Collapse
.... action oBrw:Report( cTitle ....... { | oRep, oBrw, n| RepSetUp( oRep, oBrw, n ) }

....

static function RepSetUp( oRep, oBrw, n )

   if n == 1   // called first time
      return 2   // by returning 2, we are asking for a second call
   else   // called second time after report columns are created
      oRep:aCols[ 3 ]:nSize := 20   // number of characters
   endif

return nil
Regards



G. N. Rao.

Hyderabad, India
Posts: 6984
Joined: Fri Oct 07, 2005 07:07 PM
Re: xBrowse and bSetUp
Posted: Thu May 14, 2009 08:39 AM

Hello Mr. NagegesWaraRao,
thank you for your help. I will try.
Best regards,
Otto

Continue the discussion