FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour change the display of records in an xbrowse
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
change the display of records in an xbrowse
Posted: Sat Sep 01, 2018 09: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

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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
Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM
Re: change the display of records in an xbrowse
Posted: Sun Sep 02, 2018 03:44 PM
Maybe this can help you:
Code (fw): Select all Collapse
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
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: change the display of records in an xbrowse
Posted: Sun Sep 02, 2018 04: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 March-April 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
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: change the display of records in an xbrowse
Posted: Sun Sep 02, 2018 04:57 PM
Francisco I tried with array
I made
Code (fw): Select all Collapse
 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 ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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
Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM
Re: change the display of records in an xbrowse
Posted: Sun Sep 02, 2018 05:13 PM
Francisco J. Alegría P.

Chinandega, Nicaragua.



Fwxh-MySql-TMySql
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: change the display of records in an xbrowse
Posted: Sun Sep 02, 2018 06: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 March-April 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
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: change the display of records in an xbrowse
Posted: Wed Sep 05, 2018 04: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
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: change the display of records in an xbrowse
Posted: Mon Sep 10, 2018 08:18 AM

Now run ok

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 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

Continue the discussion