English
Source / code snippets

GridBOX Entries to supra under move simple Workarea

 

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

 
TC-Programming [...] 
XProfan 8.0 - 10.0 - X2 - X3 - X4

02/06/16  
 




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
tx$ = SubStr$(tx$,1,"|")
Select String(grid&,-1,tx$)

the was my fallacy a little while ago and it given with with GetCurSel -1 back but now is the code tidy !
 
XProfan X3
TC-Programming [...] 
XProfan 8.0 - 10.0 - X2 - X3 - X4

02/06/16  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

5.766 Views

Untitledvor 0 min.
Gast.081510/03/24
Georg Teles08/11/24
Member 862464105/12/24
Walter05/03/24
More...

Themeninformationen

this Topic has 1 subscriber:

Georg Teles (2x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie