Xbrowse Autosort disabled when inserting a column in code

Xbrowse Autosort disabled when inserting a column in code

Postby Rick Lipkin » Thu Mar 29, 2012 12:57 pm

To All

I have noticed that when I ADD a column ( 2 ) with code the Autosort for that column has been disabled.

I have a first name and last name field in a recordset and I use an Add column ..

Is there a way to turn on the Autosort for this column FWH 1202 ?

Thanks
Rick Lipkin

Code: Select all  Expand view

DEFINE DIALOG oWork RESOURCE "WORKBROW" of oWndChild

       REDEFINE xBROWSE oLBX         ;
         RECORDSET oRsRepair         ;
         COLUMNS "RN",               ;
                 "ADDR1",            ;
                 "CITY",             ;
                 "PH",               ;
                 "RT",               ;
                 "STATUS",           ;
                 "TN",               ;
                 "PN",               ;
                 "MN",               ;
                 "MODEL",            ;
                 "SNUM"              ;
         COLSIZES 65,150,85,85,85,85,85,85,120,120,120  ;
         HEADERS "Repair Num",       ;
                 "Address",          ;
                 "City",             ;
                 "Phone",            ;
                 "Request Type",     ;
                 "Status",           ;
                 "Tracking Num",     ;
                 "Pref Tech",        ;
                 "Manufacturer",     ;
                 "Model Number",     ;
                 "Serial Number"     ;
         ID 172 of oWork             ;
         AUTOCOLS LINES AUTOSORT CELL

       // autosort does not seem to work with columns added with code
      ADD oCol TO oLbx AT 2 DATA {|x| x := _ChkCust(oRsRepair:Fields("lname"):Value,;
                   oRsRepair:Fields("fname"):Value)  } HEADER "Customer Name" size 150
     

       ADD oCol TO oLbx AT 5 DATA {|x| x := _ChkComp(oRsRepair:Fields("cc"):Value) };
                   HEADER "Instructions" size 150

...
...
//-------------------
Static Func _ChkCust( cLast,cFirst )

Local cName

If cFirst = " " .or. empty( cFirst)
   cName := substr(alltrim( cLast )+space(40),1,40)
Else
   cName := substr(alltrim( cLast )+", "+alltrim(cFirst)+space(40),1,40)
Endif

Return(cName)

 


Image
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Xbrowse Autosort disabled when inserting a column in code

Postby nageswaragunupudi » Thu Mar 29, 2012 1:48 pm

We have to add SORT <uOrder> clause to the ADD TO oBrw command.

In your example, please try adding
Code: Select all  Expand view

SORT "LNAME,FNAME"
 

to the ADD TO oBrw command.
Because this is a browse of recordset, the expression oRs:Sort := "LNAME,FNAME" will be used by xbrowse for sorting this column.
Regards

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

Re: Xbrowse Autosort disabled when inserting a column in code

Postby Rick Lipkin » Thu Mar 29, 2012 3:18 pm

Rao

Thank you .. that did the trick ..

Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Xbrowse Autosort disabled when inserting a column in code

Postby Rick Lipkin » Thu Mar 29, 2012 9:52 pm

Rao

It seems that adding the sort allows the column to sort in Ascending order .. when I click on the heading again the order does not switch to Descending.

Is there a way to be able to switch between the orders when you alternate click on the heading ?

Thanks
Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Xbrowse Autosort disabled when inserting a column in code

Postby nageswaragunupudi » Thu Mar 29, 2012 10:39 pm

It seems that adding the sort allows the column to sort in Ascending order .. when I click on the heading again the order does not switch to Descending.

It should work.
Please check again.
Regards

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

Re: Xbrowse Autosort disabled when inserting a column in code

Postby Rick Lipkin » Fri Mar 30, 2012 3:23 pm

Rao

I noticed if I just selected the Sort "LNAME" ( instead of "LNAME,FNAME") everything worked as you suggested!

Thanks
Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA


Return to FiveWin for Harbour/xHarbour

Who is online

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