Xbrowse Header possible to change at runtime ?

Xbrowse Header possible to change at runtime ?

Postby richard-service » Wed Jan 06, 2016 9:32 am

Hi
I have two DBF and relationship.
1 DBF data below:
A ->set A1 A2 A3
B ->set B1 B2 B3
C ->set C1 C2 C3
D ->set D1 D2 D3
......

When 1.Xbrowse show A data, 2.XBrowse need to show A1 A2 A3 within Header and runtime
When 1.Xbrowse show B data, 2.XBrowse need to show B1 B2 B3 within Header and runtime

Code: Select all  Expand view

      ::oCol := ::oBrw:AddCol()
      ::oCol:cHeader       := "A1"
      ::oCol:nHeadStrAlign := AL_CENTER
      ::oCol:bStrData      := { || ::oDB:Data1 }
      ::oCol:nWidth        :=  90

      ::oCol := ::oBrw:AddCol()
      ::oCol:cHeader       := "A2"
      ::oCol:nHeadStrAlign := AL_CENTER
      ::oCol:bStrData      := { || ::oDB:Data2 }
      ::oCol:nWidth        := 120
     
      ::oCol := ::oBrw:AddCol()
      ::oCol:cHeader       := "A3"
      ::oCol:nHeadStrAlign := AL_CENTER
      ::oCol:bStrData      := { || ::oDB:Data3 }
      ::oCol:nWidth        :=  90

 
Best Regards,

Richard

Harbour 3.2.0dev (r2402101027) => Borland C++ v7.7 32bit
MySQL v8.0 /ADS v10
Harbour 3.2.0dev (r2011030937) => Borland C++ v7.4 64bit
User avatar
richard-service
 
Posts: 803
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan

Re: Xbrowse Header possible to change at runtime ?

Postby RenOmaS » Wed Jan 06, 2016 10:34 am

Also:
Code: Select all  Expand view

...
...

Static Function ChangeBrw( oBrw, oDb )

  oBrw:aCols[ 1 ]:cHeader := oDb:FieldName( 1 )
  oBrw:aCols[ 1 ]:bStrData := { || oDb:FieldGet( 1 ) }

  oBrw:aCols[ 2 ]:cHeader := oDb:FieldName( 2 )
  oBrw:aCols[ 2 ]:bStrData := { || oDb:FieldGet( 2 ) }

  oBrw:aCols[ 3 ]:cHeader := oDb:FieldName( 3 )
  oBrw:aCols[ 3 ]:bStrData := { || oDb:FieldGet( 3 ) }

  oBrw:SetoDbf( oDb )
  oBrw:Refresh()

 
Saludos/regards
RenOmaS

skype: americo.balboa
User avatar
RenOmaS
 
Posts: 205
Joined: Fri Oct 07, 2005 5:07 pm

Re: Xbrowse Header possible to change at runtime ?

Postby nageswaragunupudi » Thu Jan 07, 2016 2:52 am

You can change headers at any time during runtime.
In your case suggest you incorporate the change in First Browses' bChange codeblock.

Assume field name CODE has values 'A', 'B', 'C', etc in first browse ( oBrw1 )
We need to change headers of second browse : oBrw2

Then
Code: Select all  Expand view
oBrw1:bChange := { || oBrw2:cHeaders := { FIELD->CODE + '1', FIELD->CODE + '2', FIELD->CODE + '3' }, oBrw2:RefreshHeaders() }
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 110 guests