Re: TZF - Drag and Drop
i-cable <[email protected]>
| Newsgroups | gmane.comp.lang.delphi.topaz |
|---|---|
| Message-ID | <[email protected]> |
Thanks Randy.
It is good to share knowledge.
Abi
> I found the following which allows me to create an inherited component
> from DBGrid. It could probably be used with ttzgrid as well. I was
> able to get drag and drop to work in about 30 minutes with it.
>
>
> http://community.borland.com/article/0%2C1410%2C16562%2C00.html
>
>
> i-cable wrote:
> >
> > Dear Randy:
> > I thought someone would answer you. May be everyone is having some good
> > time. My 7.51 does have the mousedown event so I don't know anything
> > about.
> > If the mousedown event works then it will be much better. My version
> > doesn't
> > have mousedown so I use a special way to activate the drage mode. I
> > think
> > someone may have a better way but since they are busy so I tell you my
> > method.
> > 1. I use the CornerleftClick event to enable the dragmode. Please see
> > the
> > first method below.
> > 2. As an example, I use a Label to accept the Drop. So I put in the
> > Tabel1's
> > DragOver event so it will show the DragCursor. Pleas see the second
> > method.
> > 3. To complete the Drop we need to put codes in the DragDrop of Label1.
> > It
> > is better to make sure the draging component is the expected component
> > before accepting it. Please see Method 3.
> > 4. The DragDrop function is bascially completed. But don't forget we
> > have
> > enabled the Dragmode of TZGrid1 to dmAutomatic. This will create a
> > problem
> > in the future that the cells of TZGrid1 components cannot be selected
> > anymore because drag mode will be started instead of selecting the cell.
> > Therefore we need method 4 to cancel out the Dragmode. That is all we
> > need
> > for the Drag and Drop.
> >
> > The operation will be like that. You select a cell then double click the
> > left corner of the TZGrid and hold the mouse and drag on the second
> > click.
> > The first click will enter the dragmode then the second mouse down will
> > start the dragging. It works like a double click but actually not really
> > a
> > double click.
> >
> > There is also another method to start the dragmode which may be more
> > useful
> > to you because you have the mousedown event. In the
> > TZGrid1CornerLeftClick(method 1), we can use the BeginDrag function
> > instead
> > of changing the Dragmode. I don't like this method because I don't have
> > mouse down. I only have click events. In other words, it starts function
> > after the mouse button is released. This is not the windows convention.
> > But
> > if you can make your mouse down event to work then this is a better way
> > to
> > go.
> >
> > I hope I have made my explaination clean. Good luck.
> > Abi
> >
> > procedure TForm1.TzGrid1CornerLeftClick(Sender: TObject);
> > begin {use the left corner to enable drag}
> > tzgrid1.dragmode:=dmautomatic;
> > {tzgrid1.begindrag(false); another method}
> > end;
> >
> >
> > procedure TForm1.Label1DragOver(Sender, Source: TObject; X, Y: Integer;
> > State: TDragState; var Accept: Boolean);
> > begin {To Show the dragcur}
> > accept:=true;
> > end;
> >
> > procedure TForm1.Label1DragDrop(Sender, Source: TObject; X, Y: Integer);
> > begin {the label will accept anything from the TZGRID}
> > if source is ttzgrid then begin
> > label1.caption:=(source as ttzgrid).fields[(source as
> > ttzgrid).col-1].AsString;
> > end;
> > end;
> >
> > procedure TForm1.TzGrid1EndDrag(Sender, Target: TObject; X, Y: Integer);
> > begin {Must cancel out the drag mode otherwise we can't select a cell
> > any
> > more}
> > tzgrid1.dragmode:=dmmanual;
> > end;
> >
> >
> > > Thanks for the response. I am using v8.04 (I think) The control shows
a
> > > mousedown event, but it never gets called. The dmautomatic drag
> > > property causes problems with the ondblclick event because it happens
> > > immediately. Any thoughts? Benno sent me some code to try as well.
> > > Thanks again.
> > > i-cable wrote:
> > > >
> > > > Dear Randy:
> > > > I don't see a Mousedown event in TTzgrid. My version is 7.51. Not
sure
> > > > about
> > > > higher version.
> > > > May be you have set the Mousedown event of the Form instead. But
when
> > > > you
> > > > click the mouse inside the TTzgrid component, the Form does get the
> > > > click so
> > > > the FORM.MouseDown event it is not triggered. If you want to use
drag,
> > > > you
> > > > need to set DragMode to dmAutomatic then use the OnDragOver event.
> > > >
> > > > Hope this can help.
> > > >
> > > > Abi
> > > >
> > > >
> > > > > I am trying to use drag and drop between dBF files using two
> > > > > TTZDBGRID's. I want to use the Mousedown event to start the drag
> > > > > process, but it never gets called when I click the mouse down.
Can
> > > > > someone help me understand why this wouldn't work.
> > > > >
> > > > > Thanks
> > > > > Randy
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
==^================================================================
This email was sent to: [email protected]
EASY UNSUBSCRIBE click here: http://topica.com/u/?clvXPN.a5kvff.Z2NsZHQt
Or send an email to: [email protected]
TOPICA - Start your own email discussion group. FREE!
http://www.topica.com/partner/tag02/create/index2.html
==^================================================================