FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour xBrowse: problems with column SORT
Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
xBrowse: problems with column SORT
Posted: Thu May 14, 2009 08:29 PM

Hi,
there is a problem browsing an array using the SORT command and non progressive elements.

In this self-contained sample I have a 6 elements array and I want to browse only elements 1 and 6.
As you can see if you try to change the order of the date column then the order is not correct.

See www.softwarexp.co.uk/beta/image1.png to see an image of the problem

Any ideas ?

Thanks in advance

include "FiveWin.ch"

include "xbrowse.ch"

function Main()

local oDlg, oBrw, aArray

set date french
set epoch to 1920

aArray:={}
aadd(aArray,{"Marc","Nil1","Nil2","Nil3","Nil4",ctod("31/12/2003")})
aadd(aArray,{"Luc","Nil1","Nil2","Nil3","Nil4",ctod("30/05/2004")})
aadd(aArray,{"George","Nil1","Nil2","Nil3","Nil4",ctod("31/12/2004")})
aadd(aArray,{"Simon","Nil1","Nil2","Nil3","Nil4",ctod("31/12/2005")})
aadd(aArray,{"Janie","Nil1","Nil2","Nil3","Nil4",ctod("31/12/2006")})
aadd(aArray,{"Robert","Nil1","Nil2","Nil3","Nil4",ctod("31/12/2007")})
aadd(aArray,{"Melanie","Nil1","Nil2","Nil3","Nil4",ctod("31/12/2008")})

DEFINE DIALOG oDlg SIZE 300, 200

@0,0 XBROWSE oBrw OF oDlg array aarray

oBrw:nMarqueeStyle := MARQSTYLE_HIGHLROW
oBrw:lRecordSelector := .f.

ADD COLUMN oCol TO XBROWSE oBrw DATA ARRAY ELEM 1;
    HEADER "Name" SIZE 100 ORDER 1

ADD COLUMN oCol TO XBROWSE oBrw DATA ARRAY ELEM 6;
    HEADER "Date" SIZE 80 ORDER 2

oBrw:CreateFromCode()

ACTIVATE DIALOG oDlg CENTER

return nil

Best Regards,



Marco Turco

SOFTWARE XP LLP
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse: problems with column SORT
Posted: Fri May 15, 2009 12:03 AM

ADD COLUMN oCol TO XBROWSE oBrw DATA ARRAY ELEM 6;
HEADER "Date" SIZE 80 ORDER 6 // not 2

Regards



G. N. Rao.

Hyderabad, India
Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
Re: xBrowse: problems with column SORT
Posted: Fri May 15, 2009 07:24 AM

Hi,
using ORDER 6 isn't possible to change the order for that column.

See source and executable sample on www.softwarex.co.uk/beta/sample.zip

Best Regards,



Marco Turco

SOFTWARE XP LLP
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse: problems with column SORT
Posted: Fri May 15, 2009 09:18 AM
Mr Marco

You are right. Please apply this fix to xbrowse.prg

Line 8708 ( Version 9.04 ) in Method SortArrayData

Existing code:
Code (fw): Select all Collapse
         if ValType( nAt ) == 'N' .and. nAt > 0 .and. nAt <= nLen


Change this line as :
Code (fw): Select all Collapse
         if ValType( nAt ) == 'N' .and. nAt > 0 .and. nAt <= Len( ::oBrw:aArrayData[ 1 ] )

Your sample is working fine with this fix in xbrowse.prg. You have to write ORDER 6 ( not 2 ) in your code.

Request Mr Antonio to examine the fix and incorporate if he considers correct.
Regards



G. N. Rao.

Hyderabad, India
Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
Re: xBrowse: problems with column SORT
Posted: Fri May 15, 2009 06:10 PM

All runs fine now. Thanks for your quick support.

Best Regards,



Marco Turco

SOFTWARE XP LLP

Continue the discussion