FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How do I know the field name in xbrowse:column
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: How do I know the field name in xbrowse:column
Posted: Tue Feb 01, 2022 05:04 AM
In the above example, assume we want to deal with the 'Quantity' column, which is the 3rd column at the time of creation, we can find the column object in the following ways, whatever be the position at runtime and whether hidden or not:
Code (fw): Select all Collapse
oCol := oBrw:oCol( 3 ) --> Quantity column object, which is the 3rd column at the time of creation.
oCol := oBrw:oCol( "Quantity" ) --> Quantity column object, whose header is "Quantity"
oCol := oBrw:Quantity --> Same as above

Once we get the column object we want, then:
Code (fw): Select all Collapse
oCol:lHide --> Whether the column is hidden or not
oCol:nPos --> Visible column number at runtime if not hidden


Now, please explain what are you trying to do but having problems/confusion.
Regards



G. N. Rao.

Hyderabad, India
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: How do I know the field name in xbrowse:column
Posted: Tue Feb 01, 2022 08:21 AM
Dear Master,

nageswaragunupudi wrote:
Now, please explain what are you trying to do but having problems/confusion.


For this example
===============
Code (fw): Select all Collapse
COLUMNS "ITEM","UPPER(NAME)","QTY","PRICE","QTY * PRICE" ;
HEADERS "Item", "Name", "Quantity", "Rate", "Amount" ;


If I hide oBrw:aCols[1]. I need to know when I click on column #2. Is it "QTY" column?
Because when I hide column#1 and click on column#2. It shows "NAME" instead.

Thank you in advance,
Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Re: How do I know the field name in xbrowse:column
Posted: Tue Feb 01, 2022 11:40 AM
Maybe this idea can help ...

I have a browse where I select the fields that I want to show in the originale browse.

Then I select the headers that I dont want to see anymore.
The
? obrw:ocol(3):cheader // will always stay as the started header (no changes)
but
? aNewfields[3] // The array with the new headers I want to see will give the correct header name..

So the idea is to use a second array with the fields shown. The function just retrieve the fields that have a tag to display




Code (fw): Select all Collapse
function Reorderbrowse(oBrw)
   local aNewfields:={}
   xlsfields->(dbgotop())
   DBEVAL( { || If(   xlsfields->nouse = .F. ,AAdd( aNewfields, alltrim(xlsfields->xlsfield)),NIL) } )
   oBrw:ReArrangeCols( aNewfields )
   ? obrw:ocol(3):cheader
   ? aNewfields[3]
   oBrw:refresh()
return NIL
Marc Venken

Using: FWH 23.08 with Harbour
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: How do I know the field name in xbrowse:column
Posted: Sun Dec 17, 2023 05:35 PM
Dear Mst.Rao and Maurizio,
I got another problem for ::nFreeze. If you scroll to right until the column hide under freeze, the :cExpr will show incorrected.
Maurizio wrote:I use

cField := oBrw:aCols[oBrw:nColSel]:cExpr

Maurizio
Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 842
Joined: Mon Oct 10, 2005 01:29 PM
Re: How do I know the field name in xbrowse:column
Posted: Mon Dec 18, 2023 02:13 PM
I don't know if this is correct but you can try with :nColOffSet
Code (fw): Select all Collapse
 oBrw:bLDblClick := <|| 
           Local  n := oBrw:nColSel
           if oBrw:nColOffSet >  1
              n+= oBrw:nColOffSet - 1 
           endif 
           ? oBrw:aCols[n]:cExpr
           Return nil 
         }
Maurizio
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: How do I know the field name in xbrowse:column
Posted: Mon Dec 18, 2023 03:45 PM
Dear Maurizio,

It's work correct, thanks.
Maurizio wrote:I don't know if this is correct but you can try with :nColOffSet
Code (fw): Select all Collapse
 oBrw:bLDblClick := <|| 
           Local  n := oBrw:nColSel
           if oBrw:nColOffSet >  1
              n+= oBrw:nColOffSet - 1 
           endif 
           ? oBrw:aCols[n]:cExpr
           Return nil 
         }
Maurizio
Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: How do I know the field name in xbrowse:column
Posted: Mon Dec 18, 2023 04:45 PM
dutch wrote:Dear Mst.Rao and Maurizio,
I got another problem for ::nFreeze. If you scroll to right until the column hide under freeze, the :cExpr will show incorrected.
I use

cField := oBrw:aCols[oBrw:nColSel]:cExpr

Maurizio
Try
Code (fw): Select all Collapse
cField := oBrw:SelectedCol():cExpr
Regards



G. N. Rao.

Hyderabad, India
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: How do I know the field name in xbrowse:column
Posted: Tue Dec 19, 2023 06:20 PM
nageswaragunupudi wrote:
Dear Mst.Rao and Maurizio,
I got another problem for ::nFreeze. If you scroll to right until the column hide under freeze, the :cExpr will show incorrected. I use

cField := oBrw:aCols[oBrw:nColSel]:cExpr

Maurizio
Dear Master,

It works correctly. Thx.

Try
Code (fw): Select all Collapse
cField := oBrw:SelectedCol():cExpr
Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)

Continue the discussion