FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour xBRowser drag & drop question
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
xBRowser drag & drop question
Posted: 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
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
xBRowser drag & drop question
Posted: 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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
xBRowser drag & drop question
Posted: 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

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
xBRowser drag & drop question
Posted: Sun Jan 13, 2008 01:06 AM
Thats how I made it earlier. Here is what you want now:
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
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
xBRowser drag &amp; drop question
Posted: 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

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
xBRowser drag &amp; drop question
Posted: 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
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
xBRowser drag &amp; drop question
Posted: Sun Jan 13, 2008 04:55 PM

NageswaraRao, thank you very much.
Best regards,
Otto

Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
xBRowser drag &amp; drop question
Posted: 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
Posts: 230
Joined: Sat Apr 19, 2008 10:28 PM
xBRowser drag &amp; drop question
Posted: Sat May 31, 2008 03: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

Posts: 230
Joined: Sat Apr 19, 2008 10:28 PM
xBRowser drag &amp; drop question
Posted: Sat May 31, 2008 03:46 AM

I found it.

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

Alvaro

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
xBRowser drag &amp; drop question
Posted: Sat May 31, 2008 05:07 AM
With the recent xbrowse ( FWH 8.05 ) the following lines

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


can be replaced with

       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
Posts: 230
Joined: Sat Apr 19, 2008 10:28 PM
xBRowser drag &amp; drop question
Posted: Sun Jun 01, 2008 01: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

Continue the discussion