xBrowse and bSetUp

xBrowse and bSetUp

Postby Otto » Wed May 13, 2009 9: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: Select all  Expand view


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.
//----------------------------------------------------------------------------//

 
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Re: xBrowse and bSetUp

Postby nageswaragunupudi » Wed May 13, 2009 3:50 pm

Alternative-1:

Code: Select all  Expand view

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
User avatar
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: xBrowse and bSetUp

Postby Otto » Wed May 13, 2009 6: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
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Re: xBrowse and bSetUp

Postby nageswaragunupudi » Wed May 13, 2009 7: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: Select all  Expand view

.... 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
User avatar
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: xBrowse and bSetUp

Postby Otto » Thu May 14, 2009 8:39 am

Hello Mr. NagegesWaraRao,
thank you for your help. I will try.
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 97 guests