|  |  | 
|  | 
|  | 
| - Seite 1 - | 
| 
 
 | 
|  Julian
 Schmidt
 | | Hallo, wie kann man in einer Gridbox Einträge markieren?
 Welche Botschaft muss man nehmen?
 KompilierenMarkierenSeparieren
 cls
var GridBox&=Create("GridBox", %hwnd, "Eins;2;144;Zwei;2;144;Drei;2;144;Vier;2;144", 0, 20, 20, width(%hwnd)-40, height(%hwnd)-70)
clearlist
MoveListToHandle(GridBox&)
AddString(GridBox&,"Eins | Zwei | Drei | Vier")
AddString(GridBox&,"Zwei | Drei | Vier | Fünf")
AddString(GridBox&,"Drei | Vier | Fünf | Sechs")
AddString(GridBox&,"Vier | Fünf | Sechs | Sieben")
var Button&=Create("Button",%hwnd,"Eintrag markieren",20,height(%hwnd)-40,125,25)
while 1
    if getfocus(Button&)
        Sendmessage(GridBox&,$0185,1, -1)' Listbox-Message - lb_SetSel
    Endif
Endwhile
 | 
 | 
|  | 
|  | | ˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗ Webseite [...]  | 21.05.2011  ▲ | 
 | 
|  | 
| 
 
 
 | 
|  | 
| « Dieser Beitrag wurde als Lösung gekennzeichnet. » | 
|  | 
|  Jörg
 Sellmeyer
 | | KompilierenMarkierenSeparieren
 cls
var GridBox&=Create("GridBox", %hwnd, "Eins;2;144;Zwei;2;144;Drei;2;144;Vier;2;144", 0, 20, 20, width(%hwnd)-40, height(%hwnd)-70)
clearlist
MoveListToHandle(GridBox&)
AddString(GridBox&,"Eins | Zwei | Drei | Vier")
AddString(GridBox&,"Zwei | Drei | Vier | Fünf")
AddString(GridBox&,"Drei | Vier | Fünf | Sechs")
AddString(GridBox&,"Vier | Fünf | Sechs | Sieben")
var Button&=Create("Button",%hwnd,"Eintrag markieren",20,height(%hwnd)-40,125,25)
while 1
    if getfocus(Button&)
        'so
        Selectstring(GridBox&,-1,"Zwei")
        WaitInput
        'oder so
        Selectstring(GridBox&,-1,GetText$(GridBox&,3,0))
    Endif
Endwhile
 | 
 | 
|  | 
|  | | Windows XP SP2 XProfan X4... und hier mal was ganz anderes als Profan ...  | 21.05.2011  ▲ | 
 | 
|  | 
|  | 
| 
 
 
 | 
|  | 
|  Julian
 Schmidt
 | | An SelectString habe ich auch schon gedacht. Ich habe aber gehofft das es vlt eine elegantere Lösung gäbe, z.B über Sendmessage
 
 Ich habe das ganze mal in einen kleine Proc gefasst
 KompilierenMarkierenSeparieren
 
Proc SetSelectString
    Parameters Handle&,Reihe%
    Selectstring(Handle&,reihe%-1,GetText$(Handle&,reihe%,0))
EndProc
cls
declare reihe%
var GridBox&=Create("GridBox", %hwnd, "Eins;2;144;Zwei;2;144;Drei;2;144;Vier;2;144", 0, 20, 20, width(%hwnd)-40, height(%hwnd)-70)
clearlist
MoveListToHandle(GridBox&)
AddString(GridBox&,"Eins | Zwei | Drei | Vier")
AddString(GridBox&,"Zwei | Drei | Vier | Fünf")
AddString(GridBox&,"Drei | Vier | Fünf | Sechs")
AddString(GridBox&,"Vier | Fünf | Sechs | Sieben")
var Button&=Create("Button",%hwnd,"Eintrag markieren",20,height(%hwnd)-40,125,25)
while 1
    if getfocus(Button&)
        SetSelectString GridBox&,0
    Endif
Endwhile
 | 
 | 
|  | 
|  | | ˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗˗ Webseite [...]  | 21.05.2011  ▲ | 
 | 
|  | 
| 
 
 
 | 
|  | 
|  Jörg
 Sellmeyer
 | | Per Api geht es natürlich, ist aber aufwendiger. KompilierenMarkierenSeparieren
  $H commctrl.ph
proc LvDeSelect'deselectieren
    Parameters Lv&,Item&
    Declare s#
    Dim s#,1024
    Long s#,12=0
    Long s#,16=~LVIS_SELECTED | ~LVIS_FOCUSED
    SendMessage(Lv&,~LVM_SETITEMSTATE,Item&,s#)
    Dispose s#
endproc
Proc LvSelect'selectieren
    Parameters Lv&,Item&
    Declare s#
    Dim s#,1024
    Long s#,12=$2
    Long s#,16=~LVIS_SELECTED | ~LVIS_FOCUSED
    SendMessage(Lv&,~LVM_SETITEMSTATE,Item&,s#)
    SendMessage(lv&,~LVM_SETHOTITEM ,item&,0)
    SendMessage(lv&,~LVM_ENSUREVISIBLE ,Item&,0)
    Dispose s#
EndProc
cls
var GridBox&=Create("GridBox", %hwnd, "Eins;2;144;Zwei;2;144;Drei;2;144;Vier;2;144", 0, 20, 20, width(%hwnd)-40, height(%hwnd)-70)
clearlist
MoveListToHandle(GridBox&)
AddString(GridBox&,"Eins | Zwei | Drei | Vier")
AddString(GridBox&,"Zwei | Drei | Vier | Fünf")
AddString(GridBox&,"Drei | Vier | Fünf | Sechs")
AddString(GridBox&,"Vier | Fünf | Sechs | Sieben")
var Button&=Create("Button",%hwnd,"Eintrag markieren",20,height(%hwnd)-40,125,25)
while 1
    WaitInput
    if Clicked(Button&)
        LvSelect(GridBox&,2)
        SetFocus(GridBox&)'wenn man den Eintrag auch aktiv haben will
    Endif
Endwhile
 | 
 | 
|  | 
|  | | Windows XP SP2 XProfan X4... und hier mal was ganz anderes als Profan ...  | 21.05.2011  ▲ | 
 | 
|  | 
| 
 
 
 |