I have two windows and each have one data window. I just want to double click on first window's data window to get the second window's data window and want to add the selected row from the second window's data window to the same fields of first. How can I make it possible?
Asked
Active
Viewed 986 times
2 Answers
1
//On duoble click of window 1 datawindow
long ll_row
Window2 lw_win
//get selected row on other window 2
ll_row = lw_win.dw_2.getselectedrow(0)
IF ll_row > 0 THEN
dw_2.RowsCopy(ll_row, ll_row, Primary!, dw_1, dw_1.rowcount()+1, Primary!)
END IF

Syed Muhammad Qasim
- 11
- 1
-
If the two dw'structure is identical as stated by the OP, `RowsCopy` is more concise. – Seki Jan 15 '17 at 19:57
-
By 'identitical structure', I would stress that what is meant is 'identical buffer': same columns in the same order. The dw can have specific computed fields, different presentations,... – Marc Vanhoomissen Jan 18 '17 at 17:03
0
Many assumptions are being made but in a nutshell:
//in the doubleclick event on window1.dw_1
long ll_row, ll_newrow
//get selected row on other window
ll_row = window2.dw_2.getselectedrow(0)
IF ll_row > 0 THEN
ll_newrow = dw_1.insertrow(0)
dw_1.setitem(ll_newrow, 'colname1', window2.dw_2.getitemnumber(ll_row, 'colname1')
dw_1.setitem(ll_newrow, 'colname2', window2.dw_2.getitemstring(ll_row, 'colname2')
// and so on
END IF
There are many other ways to achieve the same thing based on what you are trying to do after you have copied the row from one place to another.

Matt Balent
- 2,337
- 2
- 20
- 23