Solved

urgent!!!how can i move a row up and down in the same datawindow?

Posted on 2001-07-22
7
1,348 Views
Last Modified: 2013-12-26
pls help me !
i am so anxious to kown how i can move the row freely
in the same dw!
0
Comment
Question by:feckless
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 4

Expert Comment

by:Bhatti
ID: 6307347
Hi Feckless,

Use the RowsMove() function to move the row.

dw_1.RowsMove(startrow, endrow, buffer!, targetdw, beforerow, targetbuffer)

dw_1.RowsMove(2, 2, Primary!, dw_1, 23, Primary!)

Use both time the same dw_name. start and end rows the row rows you want to move.
Target dw the datawindow where you wamt to move. and of course before which row you want to insert.
and buffer.

Try it, will help you.
0
 

Author Comment

by:feckless
ID: 6310400
how can i drag the row up and dowm with a mouse
i don't know how to make the mouse in the status
of draging and droping
0
 

Expert Comment

by:Miguel_Angel
ID: 6316726
Hi feckless:

I'm sure there is a more "professional" way to do this, but this is the "fast-nasty" way i do what you want to do (think so).

You need to declare a long instance variable to store the origin row, lets name it or_row.

In the datawindow events:

clicked
   or_row = row
   drag(begin!)

dragwithin
   selectrow(0, false)
   selectrow(row, true)

dragdrop
   rowsmove(or_row, or_row, primary!, this, row, primary!)

Remember to disable the option dragauto in the dw prorperties.

And that's all, of course, some error detection (like verify you clicked a row > 0 and you drop it in a row > 0) should help too. Note that rowsmove drops the row BEFORE the target.

Hope it helps!
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Accepted Solution

by:
Bhatti earned 200 total points
ID: 6318070
Hi Feckless,

Hier is solution. It is working.

Instance variable il_currentrow, il_row and il_checkrow

replace dw_1.with your own dw name

Dragdrop icon you can choose.

selectrow() function you can adjust with your own choice.

rest ist hier.

Please let me know if you have any question. I checked it is working 100%.

=============================================================
************************
clicked Event
************************

IF row > 0 then
   il_row = row
   selectRow(0, false)
   selectrow(row, true)
   this.Drag(Begin!)
end if

****************************
DragDrop Event
****************************

dw_1.drag(End!)
dw_1.RowsMove(il_row, il_row, Primary!, dw_1, row, Primary!)
selectrow(0, false)
selectrow(row, true)

//or you can adjust with selectrow(row - 1, true) and so on
//row you can adjust yourself where you want to paste.

*******************************
Dragwithin Event
*******************************

il_currentrow = row
il_currentrow++
if row > 10 then scrolltorow(il_currentrow)
selectrow(0, false)
selectrow(row, true)


****************************
Scrollvertical Event
****************************

string ls_lastrow

ls_lastrow = dw_1.Object.Datawindow.LastRowOnPage
il_flag = integer(ls_lastrow)

RETURN 0

**********************************
Dragwithin Event
**********************************

long ll_row

if row = 0 then selectrow(1, true)    
   if row > il_checkrow - 2 then
      il_currentrow++
      scrolltorow(il_currentrow)
      st_2.text = string(ll_row)
   else
      if il_currentrow > 0 then
      il_currentrow = il_currentrow - 1
      scrolltorow(il_currentrow)
   end if
end if

selectrow(0, false)
selectrow(row, true)

=======================================================
0
 
LVL 4

Expert Comment

by:Bhatti
ID: 6431936
Hello,

I forget last time to write the extention in Dragwithin EVENT;

Please the last two lines changed with these lines to avoid the selection of all lines.

if dwo.name = 'datawindow' then
   Selectrow(0, false)
else
   selectrow(0, false)
   selectrow(row, true)
end if

Moreover, I wrote two time dragwithin Event but you need last one, it  is the right one.

0
 
LVL 4

Expert Comment

by:Bhatti
ID: 6436574
Hello Feckless,

I am setting the complete script here, because it is now in two parts and I want to set these two parts in one part.

Instance variable il_currentrow, il_row and il_checkrow

=============================================================
************************
clicked Event
 ************************

IF row > 0 then
    il_row = row
    selectRow(0, false)
    selectrow(row, true)
     this.Drag(Begin!)
end if

****************************
 DragDrop Event
****************************

dw_1.drag(End!)


if il_row > row then dw_1.RowsMove(il_row, il_row, Primary!, dw_1, row , Primary!)
if il_row < row then dw_1.RowsMove(il_row, il_row, Primary!, dw_1, row + 1, Primary!)

selectrow(0, false)
selectrow(row, true)

//or you can adjust with selectrow(row - 1, true) and so on
//row you can adjust yourself where you want to paste.

****************************
Scrollvertical Event
****************************

string ls_lastrow

ls_lastrow = dw_1.Object.Datawindow.LastRowOnPage
il_flag = integer(ls_lastrow)

RETURN 0

**********************************
Dragwithin Event
**********************************

long ll_row

st_1.Text = string(il_flag)
il_currentrow = row
if row = 0 then selectrow(1, true)    
if row > il_flag - 2 then
   il_currentrow++
   scrolltorow(il_currentrow)
   st_2.text = string(ll_row)
else
   if il_currentrow > 0 then
       il_currentrow = il_currentrow - 1
       scrolltorow(il_currentrow)
   end if
end if
if dwo.name = 'datawindow' then
   selectrow(0, false)
else
   selectrow(0, false)
   selectrow(row, true)
end if
=============================================================

I set the complete script here. It is working good.

Please let me know.

THANKS
0
 

Expert Comment

by:SpideyMod
ID: 8297043
Force Accepted

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand columnThat will then direct you to their download page.From that page s…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
Suggested Courses

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question