Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

How to program drag and drop

3 posts in DataWindow .NET Last posting was on 2004-09-27 00:29:39.0Z
taka Posted on 2004-09-25 02:29:29.0Z
From: "taka" <takashi_shimizu007@cox.net>
Newsgroups: sybase.public.datawindow.net
Subject: How to program drag and drop
Lines: 10
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-Original-NNTP-Posting-Host: ip68-5-17-216.oc.oc.cox.net
Message-ID: <4154d806@forums-2-dub>
X-Original-Trace: 24 Sep 2004 19:29:26 -0700, ip68-5-17-216.oc.oc.cox.net
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 24 Sep 2004 19:29:27 -0700, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 24 Sep 2004 19:29:29 -0700
X-Trace: forums-1-dub 1096079369 10.22.108.75 (24 Sep 2004 19:29:29 -0700)
X-Original-Trace: 24 Sep 2004 19:29:29 -0700, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.datawindow.net:442
Article PK: 124878

I would like to move a row from one location to another within a same
datawindow using drag and drop.
I assume I should use the MouseDown and DragDrop events with the doDragDrop
method, but haven't succeeded yet.
Can anyone instruct me how to program for it?
Thanks.


Jim O'Neil [Sybase] Posted on 2004-09-26 00:18:32.0Z
From: "Jim O'Neil [Sybase]" <joneil_at_sybase_dot_com>
Newsgroups: sybase.public.datawindow.net
Subject: Re: How to program drag and drop
Message-ID: <f52cl0hutqtefdpog9rptgb1ofcgl722dp@4ax.com>
References: <4154d806@forums-2-dub>
X-Newsreader: Forte Agent 2.0/32.652
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: vpn-concord-063.sybase.com
X-Original-NNTP-Posting-Host: vpn-concord-063.sybase.com
Date: 25 Sep 2004 17:18:32 -0700
X-Trace: forums-1-dub 1096157912 158.159.8.63 (25 Sep 2004 17:18:32 -0700)
X-Original-Trace: 25 Sep 2004 17:18:32 -0700, vpn-concord-063.sybase.com
Lines: 64
X-Authenticated-User: teamsybase
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.datawindow.net:443
Article PK: 124874

I'm not sure this is the 'textbook' way of doing drag-drop in .NET,
but this is working for me. It moves the row to the row above the row
on which you release the mouse. It probably could use some error
checking though.

private void dw_basic_MouseDown(object sender,
System.Windows.Forms.MouseEventArgs e)
{
Int32 clickedRow = dw_basic.ObjectUnderMouse.RowNumber;

if (clickedRow > 0)
dw_basic.DoDragDrop(new DataObject(DataFormats.Text,
clickedRow.ToString()), DragDropEffects.Move);
}

private void dw_basic_DragDrop(object sender,
System.Windows.Forms.DragEventArgs e)
{
DataWindowControl dw;
Int32 currentRow;
Int32 draggedRow;

try
{
dw = sender as DataWindowControl;
if (dw.Name.Equals("dw_basic"))
{
currentRow = dw.ObjectUnderMouse.RowNumber;
if (currentRow > 0)
{
draggedRow =
Convert.ToInt32(e.Data.GetData("System.String"));
dw.RowsMove(draggedRow, draggedRow,
DataBuffer.Primary, dw, currentRow, DataBuffer.Primary);
}
}
}
catch (Exception)
{
// dropped something other than dw control
}
}

private void dw_basic_DragOver(object sender,
System.Windows.Forms.DragEventArgs e)
{
// need additional code if other draggable objects
e.Effect = dw_basic.ObjectUnderMouse.RowNumber == 0 ?
DragDropEffects.None : DragDropEffects.Move;
}

On 24 Sep 2004 19:29:29 -0700, "taka" <takashi_shimizu007@cox.net>

wrote:

>I would like to move a row from one location to another within a same
>datawindow using drag and drop.
>I assume I should use the MouseDown and DragDrop events with the doDragDrop
>method, but haven't succeeded yet.
>Can anyone instruct me how to program for it?
>Thanks.
>
>
>


taka Posted on 2004-09-27 00:29:39.0Z
From: "taka" <takashi_shimizu007@cox.net>
Newsgroups: sybase.public.datawindow.net
References: <4154d806@forums-2-dub> <f52cl0hutqtefdpog9rptgb1ofcgl722dp@4ax.com>
Subject: Re: How to program drag and drop
Lines: 73
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-Original-NNTP-Posting-Host: ip68-5-17-216.oc.oc.cox.net
Message-ID: <41575ee9$1@forums-2-dub>
X-Original-Trace: 26 Sep 2004 17:29:29 -0700, ip68-5-17-216.oc.oc.cox.net
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 26 Sep 2004 17:29:36 -0700, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 26 Sep 2004 17:29:39 -0700
X-Trace: forums-1-dub 1096244979 10.22.108.75 (26 Sep 2004 17:29:39 -0700)
X-Original-Trace: 26 Sep 2004 17:29:39 -0700, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.datawindow.net:444
Article PK: 124877

It worked with Visual Basic as well.
Thank you very much.

"Jim O'Neil [Sybase]" <joneil_at_sybase_dot_com> wrote in message
news:f52cl0hutqtefdpog9rptgb1ofcgl722dp@4ax.com...
> I'm not sure this is the 'textbook' way of doing drag-drop in .NET,
> but this is working for me. It moves the row to the row above the row
> on which you release the mouse. It probably could use some error
> checking though.
>
> private void dw_basic_MouseDown(object sender,
> System.Windows.Forms.MouseEventArgs e)
> {
> Int32 clickedRow = dw_basic.ObjectUnderMouse.RowNumber;
>
> if (clickedRow > 0)
> dw_basic.DoDragDrop(new DataObject(DataFormats.Text,
> clickedRow.ToString()), DragDropEffects.Move);
> }
>
> private void dw_basic_DragDrop(object sender,
> System.Windows.Forms.DragEventArgs e)
> {
> DataWindowControl dw;
> Int32 currentRow;
> Int32 draggedRow;
>
> try
> {
> dw = sender as DataWindowControl;
> if (dw.Name.Equals("dw_basic"))
> {
> currentRow = dw.ObjectUnderMouse.RowNumber;
> if (currentRow > 0)
> {
> draggedRow =
> Convert.ToInt32(e.Data.GetData("System.String"));
> dw.RowsMove(draggedRow, draggedRow,
> DataBuffer.Primary, dw, currentRow, DataBuffer.Primary);
> }
> }
> }
> catch (Exception)
> {
> // dropped something other than dw control
> }
> }
>
> private void dw_basic_DragOver(object sender,
> System.Windows.Forms.DragEventArgs e)
> {
> // need additional code if other draggable objects
> e.Effect = dw_basic.ObjectUnderMouse.RowNumber == 0 ?
> DragDropEffects.None : DragDropEffects.Move;
> }
>
> On 24 Sep 2004 19:29:29 -0700, "taka" <takashi_shimizu007@cox.net>
> wrote:
>
>>I would like to move a row from one location to another within a same
>>datawindow using drag and drop.
>>I assume I should use the MouseDown and DragDrop events with the
>>doDragDrop
>>method, but haven't succeeded yet.
>>Can anyone instruct me how to program for it?
>>Thanks.
>>
>>
>>
>