Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 7 of 7 total
Thread dragging multiple rows from a TAdvStringGrid
Thu, Jul 12 2007 2:53 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

No answer in the TMS newsgroups so anyone here have a suggestion?

Drag'n'Drop is easy a row at a time. I use a mousedown event to call BeginDrag on a double click. However, when there are multiple rows selected the selection is lost before dragging is started.

Think Outlook Express and dragging emails from one mailbox to another.

Does anyone have a solution or suggestion?

Roy Lambert
Thu, Jul 12 2007 1:24 PMPermanent Link

Chris Erdal
Roy Lambert <roy.lambert@skynet.co.uk> wrote in
news:96880C03-221F-4D57-9E48-F1745417E94E@news.elevatesoft.com:

> No answer in the TMS newsgroups so anyone here have a suggestion?
>
> Drag'n'Drop is easy a row at a time. I use a mousedown event to call
> BeginDrag on a double click. However, when there are multiple rows
> selected the selection is lost before dragging is started.
>
> Think Outlook Express and dragging emails from one mailbox to another.
>
> Does anyone have a solution or suggestion?
>
> Roy Lambert
>

Roy,

I've never had to do this, but I see in the TMS group there was a thread
about something similar in January:

-----------------------------8<--------------------------
Newsgroups: tmssoftware.grids
Subject: Multi-row drag&drop
From: "Tony Chick" <tony@newsmaker.us>
Date: Thu, 11 Jan 2007 13:41:31 -0800

I'm trying to drag one or more rows from one advColumnGrid to another. I
have goRowSelect=true, dragmode=dmManual and beginDrag(false, 10) in the
OnClickCell handler (thanks to earlier posters for that tip). Grid
version
is 3.1.0.2

There are 2 problems.

1. When the row is dropped on the second grid, SelectedRowCount is zero
for the source grid even though a row is visibly selected.

2. If I select multiple rows, clicking the mouse to try and start the
drag clears the selection for all but the row under the mouse.
------------------------
Newsgroups: tmssoftware.grids
Subject: Re: Multi-row drag&drop
From: "Bruno Fierens [tmssoftware.com]" <_nospam_@tmssoftware.com>
Date: Wed, 17 Jan 2007 11:33:53 +0100

> 1. When the row is dropped on the second grid, SelectedRowCount is zero
> for the source grid even though a row is visibly selected.

This is normal, SelectedRowCount only applies for disjunct row selection
mode, otherwise, use grid.Selection.Bottom - grid.Selection.Top

> 2. If I select multiple rows, clicking the mouse to try and start the
> drag clears the selection for all but the row under the mouse.

Demo 28 at http://www.tmssoftware.com/go/?advgrid2 shows how this can be
done.

--
Kind regards,
Bruno Fierens
TMS software
Productivity components for Windows, .NET, IntraWeb development
http://www.tmssoftware.com
There's only one rule and that is to do. There is no maybe or perhaps...
for
success needs no explanation, but failure can never be explained. (J.
Mtume)
-----------------------------8<--------------------------


I see Tony asked about the advColumnGrid, but maybe it'll help.
--
Chris
(XP-Pro + Delphi 7 Architect + DBISAM 4.25 build 4 + EDB 1.04 build 3)

Thu, Jul 12 2007 2:09 PMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Chris


Thanks for that. I searched for messages with both drag and drop and so missed it. Example 28 uses OLE but I'll see if I can massage it to do what I want.

Roy Lambert
Sun, Jul 15 2007 4:43 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Chris


Just so you know, and in the hope someone else has a solution (possibly a google search I haven't tried yet). Demo 28 uses OLE to copy between two grids. Both components need OLE enabling and my TreeView hasn't.

Roy Lambert
Mon, Jul 16 2007 5:13 AMPermanent Link

Chris Erdal
Roy Lambert <roy.lambert@skynet.co.uk> wrote in
news:AC0181E8-14AF-4F46-9C85-A47F5D45EBB4@news.elevatesoft.com:

Roy,

>  Demo 28 uses OLE to
> copy between two grids. Both components need OLE enabling and my
> TreeView hasn't.

Aah..

Well perhaps you can fiddle around with the clipboard -  Ctrl-C with a few
rows selected allows pasting the selected rows into EditPad, so what about
trapping the OnMouseDown before it de-selects the other rows, copying
everything to the clipboard if several rows are selected and setting a flag
in case the user wants to drag, and then in OnDragDrop checking for the
flag and pasting?

--
Chris
(XP-Pro + Delphi 7 Architect + DBISAM 4.25 build 4 + EDB 1.04 build 3)

Mon, Jul 16 2007 6:35 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Chris


>so what about
>trapping the OnMouseDown before it de-selects the other rows, copying
>everything to the clipboard if several rows are selected and setting a flag
>in case the user wants to drag, and then in OnDragDrop checking for the
>flag and pasting?

That's one of the things I'm trying - I thought I'd found the right place to do it but it has consequences elsewhere. It may not be possible without altering quite a lot of TMS's code in which case my fallback is a button - click it and it fires off grid.BeginDrag(True) which works but its not "nice".

Thanks for trying.

Roy Lambert
Mon, Jul 16 2007 8:15 AMPermanent Link

Chris Erdal
Roy Lambert <roy.lambert@skynet.co.uk> wrote in
news:33307C8A-D575-4E67-90D5-440E8B973AEF@news.elevatesoft.com:

Roy,

> Thanks for trying.

you're welcome - not finished yet Wink

Right-button drag ?

--
Chris
(XP-Pro + Delphi 7 Architect + DBISAM 4.25 build 4 + EDB 1.04 build 3)

Image