move a record from xbrowse

move a record from xbrowse

Postby Silvio.Falconi » Sun Nov 08, 2015 9:02 pm

it is possible move a record from position x to position y into a xbrowse
because my customer want the possibility to move a record into a table of order ( made with xbrowse) to another position
the customer let me see an old prg made in vb6 he moved the record taking with the mouse and press on recordselector and move it into another position
my customer sad me need it to group products and comments
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: 7090
Joined: Thu Oct 18, 2012 7:17 pm

Re: move a record from xbrowse

Postby Antonio Linares » Mon Nov 09, 2015 11:32 am

Silvio,

Surely Rao will provide us here the best advise to do it
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: move a record from xbrowse

Postby Silvio.Falconi » Tue Nov 10, 2015 12:03 pm

I think it can be hard to create ...
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: 7090
Joined: Thu Oct 18, 2012 7:17 pm

Re: move a record from xbrowse

Postby ukoenig » Tue Nov 10, 2015 1:51 pm

Silvio,

I have the same problem changing the position.

My solution for the moment :
selecting the 2 records I want to change the position.
Doing the change on button-click
Now the COMPLETE records are changing the position

Image

best regards
Uwe :roll:
Last edited by ukoenig on Tue Nov 10, 2015 6:47 pm, edited 1 time in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: move a record from xbrowse

Postby FranciscoA » Tue Nov 10, 2015 2:57 pm

I'm traying it, also. With arrays.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2159
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: move a record from xbrowse

Postby joseluisysturiz » Tue Nov 10, 2015 3:58 pm

Disculpen mi ignorancia, si es con un array no seria mas facil si solo le cambian el valor a oBrw:nArrayAt en ambos lados con el juego de 3 casillas.? digo, si es que se le puede reasignar el valor a nArrayAt y luego hacer un refresh.
La otra idea es crear un registro en blanco, copiar alli uno de los registros, reemplazar los valores a uno de los registros por el que se quiere cambiar, luego copiar el del registro nuevo al cambiado y por ultimo borrar el registro nuevo dublicado...nose si es una loquera lo que digo, solo lo veo en forma de SEUDOCOIDE, habria que ver si es factible en codigo, saludos... :shock:
Dios no está muerto...

Gracias a mi Dios ante todo!
User avatar
joseluisysturiz
 
Posts: 2064
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela

Re: move a record from xbrowse

Postby FranciscoA » Tue Nov 10, 2015 6:35 pm

Silvio wrote: ...the customer let me see an old prg made in vb6 he moved the record taking with the mouse and press on recordselector and move it into another position


José Luis.
La pregunta es: ¿Cómo hacerlo con Drag and Drop?
The question is: How to do it using Drag and Drop?
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2159
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: move a record from xbrowse

Postby joseluisysturiz » Tue Nov 10, 2015 8:16 pm

FranciscoA wrote:
Silvio wrote: ...the customer let me see an old prg made in vb6 he moved the record taking with the mouse and press on recordselector and move it into another position


José Luis.
La pregunta es: ¿Cómo hacerlo con Drag and Drop?
The question is: How to do it using Drag and Drop?


Ha bueno, ya eso es otra cosa, yo lo vi solo como un intercambio de posiciones, no por DRAG/DROP.? ya aca debera ver nuestro Mr.Noa o Daniel o AL, que son mas expertos, digo yo ..nose..solo fue una loca idea que se me vino, saludos... :shock:
Dios no está muerto...

Gracias a mi Dios ante todo!
User avatar
joseluisysturiz
 
Posts: 2064
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela

Re: move a record from xbrowse

Postby Antonio Linares » Tue Nov 10, 2015 10:38 pm

Silvio,

If I click on a row and keep the mouse pressed and move it downwards, then two selected
records appear. Could you try this on your browses and let me know if you get it too ?

Image
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: move a record from xbrowse

Postby Otto » Wed Nov 11, 2015 12:23 am

Dear Antonio,
what you see is from kinetic behavior.


Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6364
Joined: Fri Oct 07, 2005 7:07 pm

Re: move a record from xbrowse

Postby nageswaragunupudi » Wed Nov 11, 2015 1:00 am

This is an example of moving a row from one position to another position by drag and drop. This is demonstrated with an array
Code: Select all  Expand view  RUN

#include "fivewin.ch"

function main()

   local oDlg, oBrw, oFont, oCur, aData[ 12 ]

   AEval( aData, { |u,i| aData[ i ] := NtoCMonth( i ) } )

   DEFINE CURSOR oCur DRAG
   DEFINE FONT oFont NAME "VERDANA" SIZE 0,-16
   DEFINE DIALOG oDlg SIZE 250,500 PIXEL FONT oFont
   @ 10,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
      DATASOURCE aData COLUMNS 1 CELL LINES NOBORDER

   WITH OBJECT oBrw
      :nStretchCol      := 1
      :oDragCursor      := oCur
      :bDragBegin       := { |r,c,f,o| SetDropInfo( { oBrw:nArrayAt, oBrw:aRow } ) }
      :bDropOver        := { |u,r,c,f| oBrw:LButtonDown( r,c ), ;
                                       oBrw:LButtonUp(), ;
                                       aDel( aData, u[ 1 ] ), ;
                                       AIns( aData, oBrw:nArrayAt, u[ 2 ] ), ;
                                       oBrw:Refresh() }

      //
      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont
   RELEASE CURSOR oCur

return nil
 
Regards

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

Re: move a record from xbrowse

Postby FranciscoA » Wed Nov 11, 2015 3:01 am

Thanks, Rao.

I tried it and it works well for me.
Tomorrow I will do more tests on medium and large arrays.

Best regards.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2159
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: move a record from xbrowse

Postby elvira » Wed Nov 11, 2015 9:35 am

Mr. Nages,

Can we please have this sample with a DBF?.

Thank you.
elvira
 
Posts: 516
Joined: Fri Jun 29, 2012 12:49 pm

Re: move a record from xbrowse

Postby nageswaragunupudi » Wed Nov 11, 2015 12:22 pm

FranciscoA wrote:Thanks, Rao.

I tried it and it works well for me.
Tomorrow I will do more tests on medium and large arrays.

Best regards.

This is a very simple case, works only when the start and destination are both visible on the same screen. This example also does not have any error handling. In real life we may need to handle scrolling also if the destination is several rows away.
This should serve as a simple example to form the basis of a complex final product.

Cut and Paste instead of Drag and Drop:
Instead of using Drag/Drop, we can also use Cut and Paste. Cut the source record, navigate to the new position and then move the record there .
Regards

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

Re: move a record from xbrowse

Postby nageswaragunupudi » Wed Nov 11, 2015 12:26 pm

elvira wrote:Mr. Nages,

Can we please have this sample with a DBF?.

Thank you.

This xbrowse example, after the end of the drag, informs the programmer, start record number and destination record number. The programmer has to decide if he wants to swap data of some fields between these two records or wants a visual re-ordering of the rows where the moved record appears in the new position.

First thing to decide is how the programmer wants to record the change in the dbf. Once that is clear, it can be plugged into the bDropOver.
Regards

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

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 82 guests

cron