| Reinhard Petermann 2005-10-28, 8:23 pm |
| Hallo Frank,
du verwendest noch Browse, die Verwendung wird aber nicht mehr
empfohlen. Besser ist Grid. Hir gibt es auch die Methode selected().
Nachfolgend ein kurzes Beispiel der Methode selected(). Vieleicht hilft
es dir. Es ist auch sinvoll im Formular ein Notebook zu verwenden. Im
ersten Tab wird ein Grid zur Auswahl angezeigt und im zweiten Tab
erfolgt die Darstellung des ausgewählten Satzes zum Bearbeiten. Da beide
Tabs über das gleiche rowset angesteuert werden ist immer der
ausgewählte Satz im zweiten Tab Zugriff.
MfG
Reinhard
* alles in eine Form kopieren
set data to; close tables
if file('table1_M.dbf'); drop table table1_M
endif
create table table1_M (field1 char(10) )
use table1_M
gene 12
if file('table2_M.dbf'); drop table table2_M
endif
create table table2_M (field1 char(10) )
use
** END HEADER -- do not remove this line
//
// Generated on 06.07.2004
//
parameter bModal
local f
f = new glenn_draganddropFor
m()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif
class glenn_draganddropFor
m of FORM
with (this)
text = "Glenn - Drag and drop - move option"
endwith
this.TABLE11 = new QUERY()
this.TABLE11.parent = this
with (this.TABLE11)
sql = 'select * from "table1_M.DBF"'
active = true
endwith
this.TABLE21 = new QUERY()
this.TABLE21.parent = this
with (this.TABLE21)
sql = 'select * from "table2_M.DBF"'
active = true
endwith
this.GRID1 = new GRID(this)
with (this.GRID1)
onLeftMouseDown = class::GRID1_ONLEFTM
OUSEDOWN
dataLink = form.table11.rowset
multiSelect = true
height = 15.0
left = 2.0
top = 0.5
width = 17.0
dragEffect = 1 // Copy
endwith
this.GRID2 = new GRID(this)
with (this.GRID2)
onDrop = class::GRID2_ONDROP
dataLink = form.table21.rowset
height = 15.0
left = 21.0
top = 0.5
width = 17.0
allowDrop = true
endwith
this.rowset = this.table11.rowset
function GRID1_onLeftMouseDow
n(flags, col, row)
form.grid1. drag('walk','table1'
,"")
return
function GRID2_onDrop(nLeft, nTop, cType, cName)
rDat1 = form.grid1.datalink
rDat2 = form.grid2.datalink
aSel = form.grid1.selected()
for i = 1 to aSel.size
rDat1.goto(aSel[i])
rDat2.beginappend()
rDat2.fields['field1'].value = rDat1.fields['field1'].value
rDat2.save()
rDat1.delete()
next
return
endclass
|