xBRowser drag & drop question

Postby nageswaragunupudi » Sat Jan 12, 2008 12:21 am

James

When the user drags KeyNo 12 over KeyNo 20, the dragged item has to sit between 19 and 20. So I am changing KeyNo 12 as 19.5.
Assume the user drags 10 over 20 again. Then KeyNo 10 is to be changed to a number between 19.5 and 20 ( 19.75 ). Another drag over 20 again? The new key number will be 19.875 and so on.
I chose more decimal places so that we dont hit a dead end soon.
In real time application, if we hit deadend our logic should renumber.

Hope I am clear
Regards

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

Postby James Bott » Sat Jan 12, 2008 12:44 am

NageswaraRao,

>Hope I am clear

Yes, now I get it. I did this once by numbering the items in increments of 10--I never thought of using decimals. It's good that you mention renumbering since that will become an issue at some point. With a very small database perhaps you could renumber it for each drag & drop.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Otto » Sun Jan 13, 2008 12:05 am

Hello NageswaraRao,

there is still one problem. If I drop the record then the row where I drop is highlighted but the dragged row is one before. Maybe you have a solution for that too.
Best regards,
Otto
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Postby nageswaragunupudi » Sun Jan 13, 2008 1:06 am

Thats how I made it earlier. Here is what you want now:
Code: Select all  Expand view
STATIC FUNCTION DropOver( uDropInfo, nRow, nCol, nFlags, oBrw )

   LOCAL nDragRec := uDropInfo
   LOCAL nThisRec
   LOCAL nThisKey
   LOCAL nPrevKey := 0
   LOCAL n

       oBrw:lButtonDown( nRow, nCol, nFlags )
       oBrw:lButtonUp(   nRow, nCol, nFlags )

   nThisRec       := (oBrw:cAlias)->( RECNO() )
   nThisKey       := (oBrw:cAlias)->NUMMER

   ( oBrw:cAlias )->( dbSKIP( -1 ) )
   IF !bof()
      nPrevKey      := ( oBrw:cAlias )->NUMMER
   ENDIF
   ( oBrw:cAlias )->( dbGOTO( nDragRec ) )
   ( oBrw:cAlias )->NUMMER   := ( nThisKey + nPrevKey ) / 2
//   ( oBrw:cAlias )->( dbGOTO( nThisRec ) )
   oBrw:Refresh()

   if ( n := ( oBrw:cAlias )->( OrdKeyNo() ) ) < oBrw:nRowSel
      oBrw:nRowSel   := n
      oBrw:Refresh()
   endif

RETURN NIL
Regards

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

Postby Otto » Sun Jan 13, 2008 10:07 am

Hello NageswaraRao,

If the xBrowser is starting on the first page than it inserts and highlights one line before where you drop.
If you are on the second or higher page it works perfectly.
Maybe you have some more ideas to solve this.
Thank you for your help.

Regards,
Otto
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Postby nageswaragunupudi » Sun Jan 13, 2008 11:30 am

It has to be like that only. Suppose you dreg 5th item and drop on 10th item. Now 5th item will become 9th item. So the cursor has to move up to 9th row.
Regards

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

Postby Otto » Sun Jan 13, 2008 4:55 pm

NageswaraRao, thank you very much.
Best regards,
Otto
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Postby Silvio » Mon Jan 14, 2008 12:40 am

Otto,
can you create a small test of it and insert the sample on fwnips website?
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby alvaro533 » Sat May 31, 2008 3:15 am

Good evening,

How can you know if the user is dropping in the same windows it was dragged from? In my program you can open several mdichild windows. I don't want the user to drag to a different window.

Thank you very much.

Alvaro
alvaro533
 
Posts: 206
Joined: Sat Apr 19, 2008 10:28 pm
Location: Madrid, España

Postby alvaro533 » Sat May 31, 2008 3:46 am

I found it.

Passing the number oWnd:hWnd with uDropInfo information. Thank you,

Alvaro
alvaro533
 
Posts: 206
Joined: Sat Apr 19, 2008 10:28 pm
Location: Madrid, España

Postby nageswaragunupudi » Sat May 31, 2008 5:07 am

With the recent xbrowse ( FWH 8.05 ) the following lines

Code: Select all  Expand view
       oBrw:lButtonDown( nRow, nCol, nFlags )
       oBrw:lButtonUp(   nRow, nCol, nFlags )


can be replaced with

Code: Select all  Expand view
       oBrw:SetPos( nRow, nCol, .t. )  // .t. for pixel


This is better and more reliable than the workaround I was using earlier.
Regards

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

Postby alvaro533 » Sun Jun 01, 2008 1:28 pm

Using
oBrw:SetPos( nRow, nCol, .t. )

does not set the browse in the position where you drop.

However it works with this 2 lines, am I missing something?

oBrw:lButtonDown( nRow, nCol, nFlags )
oBrw:lButtonUp( nRow, nCol, nFlags )

Thank you

Alvaro
alvaro533
 
Posts: 206
Joined: Sat Apr 19, 2008 10:28 pm
Location: Madrid, España

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 103 guests