| |
|
|
Georg Teles | good tommorrow,
found to not really what except many good Drag & Drop Examples with lists here [...] - have temporary to a "Einträge-schiebe-Workarea" for GridBoxen m.H. of LvSelect gebastelt
Hello
EDIT: How always not integrally perfect, if one between UP & DOWN changes, jumping The Entries circa 2 positions, pfeile time moreover on it ...
EDIT: here working Version, integrally without LvSelect
$H Commctrl.ph
Declare grid&
Declare up&, down&
CLS
'unsortierte Grid because otherwise this Workarea none sense yields ;D
grid& = Create("GridBox", %HWnd, "Links;0;180;Mitte;2;100;Rechts;1;80", 0, 5, 5, 400, 200)
AddStrings(grid&,"1|1|1")'Testeiträge
AddStrings(grid&,"2|2|2")
AddStrings(grid&,"3|3|3")
AddStrings(grid&,"4|4|4")
AddStrings(grid&,"5|5|5")
AddStrings(grid&,"6|6|6")
AddStrings(grid&,"7|7|7")
up& = Create("Button",%HWnd,"UP",5,220,100,20)
down& = Create("Button",%HWnd,"DOWN",115,220,100,20)
While 1
CheckStat()'Buttons de-/ enable
waitinput
If Clicked(up&)
moveUP()
ElseIf Clicked(down&)
moveDOWN()
EndIf
EndWhile
Proc CheckStat
If GetCount(grid&) > 0
EnableWindow up&,1
EnableWindow down&,1
Else'if list empty, deaktiviere Buttons !
EnableWindow up&,0
EnableWindow down&,0
EndIf
If GetSelCount(grid&) = 1
EnableWindow up&,1
EnableWindow down&,1
Else'if several Entries markiert are, deakiviere Buttons !
EnableWindow up&,0
EnableWindow down&,0
EndIf
ENDPROC
Proc moveUP
Declare tx$, pos&
If GetCurSel(grid&) > 0'unless first position or. not Pos. = 0 klicked watts, then ...
pos& = GetCurSel(grid&)'... position read
tx$ = GetString$(grid&,pos&)'entry the position Save - WICHTIG: GetString$ use there
'GetText$ only The first slot ausließt - GetString$ ließt complete Line
DeleteString(grid&,pos&)'middle-aged entry delete ...
InsertString(grid&,(pos&-1),tx$)'... on position MINUS 1 hiinzufügen
tx$ = SubStr$(tx$,1,"|")'with Grid with 1 slot & Listbox not necessary
Select String(grid&,-1,tx$)'with Grid with 1 slot & Listbox not necessary
SetFocus(grid&)'Fokus on Grid so Button not deaktiviert becomes s. Proc CheckStat
EndIf
ENDPROC
Proc moveDOWN
Declare tx$, pos&
If (GetCurSel(grid&) < (GetCount(grid&)-1)) & (GetCurSel(grid&) >= 0)'if Pos. between 1. (pos=0) and last entry is, then ...
pos& = GetCurSel(grid&)'... position read
tx$ = GetString$(grid&,pos&)'entry the position Save - WICHTIG: GetString$ use there
DeleteString(grid&,pos&)'middle-aged entry delete ...
InsertString(grid&,(pos&+1),tx$)'... on position PLUS 1 hiinzufügen
tx$ = SubStr$(tx$,1,"|")'with Grid with 1 slot & Listbox not necessary
Select String(grid&,-1,tx$)'with Grid with 1 slot & Listbox not necessary
setfocus(grid&)'Fokus on Grid so Button not deaktiviert becomes s. Proc CheckStat
EndIf
ENDPROC
|
|
|
| |
|
|
|
Georg Teles | a little while ago one small Error been, therefore jumping it circa 1-2 Lines ... with Grids with More as 2 Split must mind go, that at Selektieren the row only to first slot sought becomes ! therefore
the was my fallacy a little while ago and it given with with GetCurSel -1 back but now is the code tidy ! |
|
|
| |
|
|