xBrowse: problems with column SORT

xBrowse: problems with column SORT

Postby Marco Turco » Thu May 14, 2009 8: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
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Re: xBrowse: problems with column SORT

Postby nageswaragunupudi » 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
User avatar
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: xBrowse: problems with column SORT

Postby Marco Turco » Fri May 15, 2009 7: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
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Re: xBrowse: problems with column SORT

Postby nageswaragunupudi » Fri May 15, 2009 9: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: Select all  Expand view
        if ValType( nAt ) == 'N' .and. nAt > 0 .and. nAt <= nLen


Change this line as :
Code: Select all  Expand view
        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
User avatar
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: xBrowse: problems with column SORT

Postby Marco Turco » Fri May 15, 2009 6:10 pm

All runs fine now. Thanks for your quick support.
Best Regards,

Marco Turco
SOFTWARE XP LLP
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 101 guests