Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1574
  • Last Modified:

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

pls help me !
i am so anxious to kown how i can move the row freely
in the same dw!
0
feckless
Asked:
feckless
1 Solution
 
BhattiCommented:
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
 
fecklessAuthor Commented:
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
 
Miguel_AngelCommented:
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
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
BhattiCommented:
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
 
BhattiCommented:
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
 
BhattiCommented:
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
 
SpideyModCommented:
Force Accepted

SpideyMod
Community Support Moderator @Experts Exchange
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now