change the display of records in an xbrowse

change the display of records in an xbrowse

Postby Silvio.Falconi » Sat Sep 01, 2018 9:27 pm

I have a xbrowse as this



Now it is order by Numbersyou see at right

and I wish change the display ( position of the records)

I mean if exist a sample to SwapUp() and SwapDown() a record into xbrowse
Last edited by Silvio.Falconi on Tue Sep 11, 2018 12:43 pm, edited 1 time in total.
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7057
Joined: Thu Oct 18, 2012 7:17 pm

Re: change the display of records in an xbrowse

Postby FranciscoA » Sun Sep 02, 2018 3:44 pm

Maybe this can help you:
Code: Select all  Expand view
REDEFINE XBROWSE oConcepto ID 200 OF oDlg ;  
         AUTOCOLS ;
         HEADERS "CONCEPTO","VALOR" ;
         SIZES 580,120 ;
         ARRAY aConcepto ;
         CELL LINES

   WITH OBJECT oConcepto
      //Cambiando posicion de lineas en el Browse
      :bDragBegin       := { |r,c,f,o| SetDropInfo( { oConcepto:nArrayAt, oConcepto:aRow } ) }
      :bDropOver        := { |u,r,c,f| oConcepto:LButtonDown( r,c ), ;
                                       oConcepto:LButtonUp(), ;
                                       aDel( aConcepto, u[ 1 ] ), ;
                                       AIns( aConcepto, oConcepto:nArrayAt, u[ 2 ] ) }
   END
 

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: change the display of records in an xbrowse

Postby Silvio.Falconi » Sun Sep 02, 2018 4:00 pm

Francisco,
I use dbf no array
I have hard problems to converte on array and then reconverte into dbf
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7057
Joined: Thu Oct 18, 2012 7:17 pm

Re: change the display of records in an xbrowse

Postby Silvio.Falconi » Sun Sep 02, 2018 4:57 pm

Francisco I tried with array
I made
Code: Select all  Expand view
aArray:= EL->( FW_DbfToArray("ELNOME,ELORDINE" ) )
 


then I tried to move the records


now I have an arrayaAray with changed position

how I can make to save it on dbf ...there is a easy method ?
Last edited by Silvio.Falconi on Tue Sep 11, 2018 12:43 pm, edited 1 time in total.
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7057
Joined: Thu Oct 18, 2012 7:17 pm

Re: change the display of records in an xbrowse

Postby FranciscoA » Sun Sep 02, 2018 5:13 pm

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: change the display of records in an xbrowse

Postby Silvio.Falconi » Sun Sep 02, 2018 6:05 pm

yes of course..fw_dbftoarray -> fw_arraytodbf
but if you see the picture the records are changed the position but the second column (position) have the value not changed
if i resave to dbf then is as before

then it add record
I must save the new postion , dbzap my dbf and use FW_ArrayToDBF

but it seems to me that this operation is risky then the archive must be opened in an exclusive way to use dbzap.
I thought there was a less risky method like:
change the position and save the Norder field with the new position

For n= 1 to Len(aArray)
aArray[n][3]:=n //FIELD ELORDINE
next
SELECT EL
DbZap()
EL->( FW_ArrayToDBF( aArray, "ELNUMERO,ELNOME,ELORDINE,ELCOLORE,ELATTIVO,ELIMGLIB,ELIMGOCC,ELIMGALT,ELLOCK" ) )
EL->( DBGOTO)

It run ok but perhaps this is too risky method
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7057
Joined: Thu Oct 18, 2012 7:17 pm

Re: change the display of records in an xbrowse

Postby James Bott » Wed Sep 05, 2018 4:49 pm

First you should note that there is a memory DBF. It acts just like a DBF but it is in memory. You can even index it. Search the forum for an example.

When the array (or memory DBF) is changed, then you just write that record to disk (or just that field).

Then there is no exclusive use and zapping needed.
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: change the display of records in an xbrowse

Postby Silvio.Falconi » Mon Sep 10, 2018 8:18 am

Now run ok
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7057
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 106 guests