move data between xbrowse files

move data between xbrowse files

Postby alfredlam » Fri Jul 06, 2018 2:52 am

Hi,

I wish to move the data from a cell of a list to another list based on mouse release position.
can someone please help.

Thanks and regards,
Alfred
alfredlam
 
Posts: 14
Joined: Tue Aug 21, 2012 2:13 am

Re: move data between xbrowse files

Postby nageswaragunupudi » Sat Jul 07, 2018 10:41 am

Set oBrw:lAllowPaste in the second browse.

Press Ctrl-C in the cell of the first browse and then press Ctrl-V in the cell of the second browse.
Regards

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

Re: move data between xbrowse files

Postby nageswaragunupudi » Sat Jul 07, 2018 2:55 pm

This is an example of drag and drop
Code: Select all  Expand view
#include "fivewin.ch"

function Main()

   local oDlg, oBrw1, oBrw2, oCur
   local aData := Array( 50, 2 )

   USE STATES NEW

   DEFINE CURSOR oCur DRAG
   DEFINE DIALOG oDlg SIZE 640,500 PIXEL TRUEPIXEL ;
      TITLE "DRAG AND DROP"

   @ 20, 20 XBROWSE oBrw1 SIZE 300,-20 PIXEL OF oDlg ;
      DATASOURCE "STATES" AUTOCOLS ;
      COLSIZES 60,180 ;
      CELL LINES NOBORDER

   WITH OBJECT oBrw1
      :oDragCursor   := oCur
      :bDragBegin    := { |r,c,f| SetDropInfo( oBrw1:SelectedCol():Value ) }
      :CreateFromCode()
   END

   @ 20,320 XBROWSE oBrw2 SIZE 300,-20 PIXEL OF oDlg ;
      DATASOURCE aData AUTOCOLS ;
      HEADERS "CODE", "NAME" ;
      COLSIZES 60,180 ;
      CELL LINES NOBORDER

   WITH OBJECT oBrw2
      :bDropOver  := { |u,r,c,f| DropOver( u,r,c, oBrw1, oBrw2 ) }
      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED

return nil

function DropOver( uInfo, nRow, nCol, oBrw1, oBrw2 )

   local aPoint

   aPoint      := ClientToScreen( oBrw1:hWnd, { nRow, nCol } )
   aPoint      := ScreenToClient( oBrw2:hWnd, aPoint )

   oBrw2:SetPos( aPoint[ 1 ], aPoint[ 2 ], .t. )
   oBrw2:SelectedCol():VarPut( uInfo )

return nil
 


You can drag cell contents from left browse over to the right browse and drop on the destination cell.
Regards

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

Re: move data between xbrowse files

Postby nageswaragunupudi » Sat Jul 07, 2018 5:52 pm

From version FWH 1805, bDropOver can be simplified like this:
Code: Select all  Expand view
     :bDropOver  := { |uInfo,r,c,f,aPt| oBrw2:SetPos( aPt[ 1 ], aPt[ 2 ], .t. ), ;
                                         oBrw2:SelectedCol():VarPut( uInfo ) }
 

There is no need for separate function DropOver(...) as in the above sample.
Regards

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

Re: move data between xbrowse files

Postby Marc Venken » Sat Jul 07, 2018 7:00 pm

this is very very nice !!

Can we do this also with visual colors ?

I have 2 ways that I use :

1. with jpg's that are color motives
2. Hex values that are used as colors references

Image

I my setup, It would be great to drop from the xbrowse (fotos or attribute) most right the color or jpg into colpic from the first xbrowse.


Can this also work ?
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1425
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: move data between xbrowse files

Postby nageswaragunupudi » Sun Jul 08, 2018 12:29 am

1) You can. When the drag begins, set the information to be sent using SetDropInfo(). When the drop finishes, use the uInfo (1st parameter of bDropInfo) the way you want to.
2) Can you show me the part of your code dislaying the image on the top and title in the bottom?
Regards

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

Re: move data between xbrowse files

Postby Marc Venken » Sun Jul 08, 2018 12:21 pm

You mean this part ..

Code: Select all  Expand view

WITH OBJECT:colpic
   :bStrImage     := { || "r:\pictures\"+alltrim(ATT->colpic) }
   :oDataFont     := oFontS
   :nDataStrAlign := AL_CENTER + AL_BOTTOM
   :nDataBmpAlign := AL_CENTER
   :aImgRect      := { nil, nil, -10, nil }
END
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1425
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: move data between xbrowse files

Postby nageswaragunupudi » Sun Jul 08, 2018 12:25 pm

Marc Venken wrote:You mean this part ?

WITH OBJECT:colpic
:bStrImage := { || "r:\pictures\"+alltrim(ATT->colpic) }
:oDataFont := oFontS
:nDataStrAlign := AL_CENTER + AL_BOTTOM
:nDataBmpAlign := AL_CENTER
:aImgRect := { nil, nil, -10, nil }
END

Yes.
Very good.
Regards

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

Re: move data between xbrowse files

Postby alfredlam » Thu Jul 26, 2018 12:57 am

Thanks Mr. G. N. Rao., tested your sample and work very well.
regards alfred
alfredlam
 
Posts: 14
Joined: Tue Aug 21, 2012 2:13 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 51 guests

cron