How to get columns name from XBROWSE *Done*

How to get columns name from XBROWSE *Done*

Postby dutch » Thu Jun 30, 2016 2:03 am

Dear All,

I use FWH1512/xHarbour/TDolphin.
I need to use TXbrowse:cSetOrder to set autosort (ASC or DESC) but I don't understand how to use it. I need global set for all columns in XBROWSE but I cannot get columns for resorting columns.

Code: Select all  Expand view
oBrw:SetDolphin( oBrw:oMySql )
    for n := 1 to len(oBrw:aCols)
         oBrw:aCols[n]:bLClickHeader = { | nMRow, nMCol, nFlags, Self | SqlOrder( oBrw:oMySql, oBrw:aCols[n]:xxxxxxx ) }   // xxxxx is columns name    
    next
...

*-----------------------------*
Function SqlOrder(oDbf,cOrder)
local cSetOrder := cOrder
if lower(cOrder) $ oDbf:cOrder
    if 'DESC' $ lower(oDbf:cOrder)
        cSetOrder += ' ASC'
    else
        cSetOrder += ' DESC'
    end
end
oDbf:SetOrder( cSetOrder, .T. )
return nil
 

Thank you in advance for any ideas or help.
Last edited by dutch on Thu Jun 30, 2016 11:14 pm, edited 1 time in total.
Regards,
Dutch

FWH 19.01 / 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)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: How to get columns name from XBROWSE

Postby FranciscoA » Thu Jun 30, 2016 3:25 am

ducht.
Using MySql I do this:
Code: Select all  Expand view
     For n := 1 to len(oBrw:aCols)
        oBrw:aCols[n]:bLClickHeader = { | nRow, nCol, nF, o | MsgInfo( o:cHeader ) }
      Next
 
Regards
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2158
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: How to get columns name from XBROWSE

Postby dutch » Thu Jun 30, 2016 4:44 am

Dear Francisco,

Thank you for your help.
The first columns, it shows "Room" but I need "RMS_RMNO" instead for sorting columns 1.
Code: Select all  Expand view
 REDEFINE XBROWSE oBrow FIELDS RMS:RMS_RMNO, RMS:RMT_DESC, trans(RMS:RMS_BEDS,'@Z 99'), RMS:RMS_VIEW ;
           HEADERS 'Room', 'Description','Bed','View' ;
           FIELDSIZES 45, 150, 30, 150 ;
           JUSTIFY 0, 0, 2, 0 ;
           DATASOURCE RMS ;
           AUTOSORT ;
           UPDATE ;
           ID 101 ;
           OF oDlg ;
           ON DBLCLICK (EditRms(.F.,oDlg,RMS), oBrow:Refresh(), oBrow:SetFocus())

    oBrow:aCols[1]:bLClickHeader := { | nMRow, nMCol, nFlags, o | MsgInfo( o:cHeader ) }

FranciscoA wrote:ducht.
Using MySql I do this:
Code: Select all  Expand view
     For n := 1 to len(oBrw:aCols)
        oBrw:aCols[n]:bLClickHeader = { | nRow, nCol, nF, o | MsgInfo( o:cHeader ) }
      Next
 
Regards
Regards,
Dutch

FWH 19.01 / 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)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: How to get columns name from XBROWSE

Postby Maurizio » Thu Jun 30, 2016 7:33 am

Have you tried oCol:cExpr ?

Maurizio
www.nipeservice.com
User avatar
Maurizio
 
Posts: 824
Joined: Mon Oct 10, 2005 1:29 pm

Re: How to get columns name from XBROWSE

Postby nageswaragunupudi » Thu Jun 30, 2016 8:30 am

Mr Dutch

Sorting of columns with Dolphin is AUTOMATIC.
Just add the clause AUTOSORT while defining XBrowse.
You will get good results with xbrowse as long as you do not add any code for sorting.
While defining xbrowse, use columns clause and not fields clause.
Regards

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

Re: How to get columns name from XBROWSE

Postby dutch » Thu Jun 30, 2016 10:21 am

Dear Mr.Rao,

I try to add AUTOSORT, how can I change the sorting. I try to ::bLClickHeader but nothing change. Have you got an example to use AUTOSORT action ?

Thank you in advance.
nageswaragunupudi wrote:Mr Dutch

Sorting of columns with Dolphin is AUTOMATIC.
Just add the clause AUTOSORT while defining XBrowse.
You will get good results with xbrowse as long as you do not add any code for sorting.
While defining xbrowse, use columns clause and not fields clause.
Regards,
Dutch

FWH 19.01 / 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)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: How to get columns name from XBROWSE

Postby nageswaragunupudi » Thu Jun 30, 2016 10:26 am

Please let me see your xbrowse statement.
Regards

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

Re: How to get columns name from XBROWSE

Postby dutch » Thu Jun 30, 2016 1:59 pm

Dear Mr.Rao,

The statement is above.
nageswaragunupudi wrote:Please let me see your xbrowse statement.
Regards,
Dutch

FWH 19.01 / 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)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: How to get columns name from XBROWSE

Postby nageswaragunupudi » Thu Jun 30, 2016 5:00 pm

I am very sorry I did not notice

Recommended code:
Code: Select all  Expand view
REDEFINE XBROWSE oBrow ;
           COLUMNS "RMS_RMNO", "RMS_DESC", "RMS_BEDS", "RMS_VIEW" ;
           PICTURES nil, nil, "99" ;
           HEADERS 'Room', 'Description','Bed','View' ;
           FIELDSIZES 45, 150, 30, 150 ; // JUSTIFY 0, 0, 2, 0 ; numbers are automatically right justified
           DATASOURCE RMS ;
           AUTOSORT ;
           UPDATE ;
           ID 101 ;
           OF oDlg ;
           ON DBLCLICK (EditRms(.F.,oDlg,RMS), oBrow:Refresh(), oBrow:SetFocus())
 
Regards

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

Re: How to get columns name from XBROWSE

Postby dutch » Thu Jun 30, 2016 11:08 pm

Dear Mr.Rao,

Thank you so much, it works great as expectation.
Regards,
Dutch

FWH 19.01 / 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)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 94 guests