Hallo
habe da ein Problem mit der Abfrage in der Liste auf dem Dialog Fenster.
Wie muss ich die Abfrage für die Liste in den Dialogen realisieren.
Benötigt wird die Die Listview.dll von Frank Abbing
Code 1 OHNE Dialog und Code 2 mit Dialog und dieser sollte genau wie Code 1 reagieren.
Code 1:
Code
[FONT=Arial]$H Windows.ph$H Structs.ph$I Listview_Funktionen.inc[/FONT] [FONT=Arial]var lvdll&=usedll("Listview.dll")Declare LV_Handle&,LV_Column&,LV_Row&,LV_Text$,LV_Xoffset&,LV_Yoffset&,LV_Width&,LV_Height&,LV_Font&,LV_Orient&[/FONT] [FONT=Arial]Declare nurso%, ilist%, smallicon%, largeicon%, vstatic1%, text1%, choicebox1%, text2%, edit1%, Liste_Kunden_Auswahl&, edit2%, iconbutton1%Declare Kunde_BMP&,ABBRUCH_BMP&DEF Load_OEM(2) !"USER32","LoadBitmapA"[/FONT] [FONT=Arial]Def @Show(1) @ShowWindow(@&(1), 1)[/FONT] [FONT=Arial]Def @Hide(1) @ShowWindow(@&(1), 0)Def GetDlgCtrlID(1) !"USER32","GetDlgCtrlID"[/FONT] [FONT=Arial]Def &COLOR_BTNFACE $F[/FONT] [FONT=Arial]Def &DEFAULT_GUI_FONT $11Def &WM_COMMAND $111Def &WinXSize 800[/FONT] [FONT=Arial]Def &WinYSize 800Declare XMax&, YMax&, WinXStartPos&, WinYStartPos&[/FONT] [FONT=Arial]Declare Rect#[/FONT] [FONT=Arial]Struct TRect = ~RECTDim Rect#, TRect~SystemParametersInfo(~SPI_GETWORKAREA, 0, Rect#, 0)[/FONT] [FONT=Arial]XMax& = Rect#.Right& - Rect#.Left&[/FONT] [FONT=Arial]YMax& = Rect#.Bottom& - Rect#.Top&WinXStartPos& = (XMax& - &WinXSize) / 2 + Rect#.Left& - (%MaxX - Rect#.Right&)WinYStartPos& = (YMax& - &WinYSize) / 2 + Rect#.Top& - (%MaxY - Rect#.Bottom&)'Daten aus lesen für die Liste[/FONT] [FONT=Arial]Proc Get_LvData LV_Handle&=Long(LV_Bereich#,0) 'Listview Handle LV_Column&=Long(LV_Bereich#,4) 'Index Spalte LV_Row&=Long(LV_Bereich#,8) 'Index Zeile LV_Xoffset&=Long(LV_Bereich#,12) 'X Offset LV_Yoffset&=Long(LV_Bereich#,16) 'Y Offset LV_Width&=Long(LV_Bereich#,20) 'Breite LV_Height&=Long(LV_Bereich#,24) 'Höhe LV_Font&=Long(LV_Bereich#,28) 'Font Handle LV_Orient&=Long(LV_Bereich#,32) 'Textausrichtung LV_Text$=String$(LV_Bereich#,64) 'Itemtext LV_Height& = (LV_Height& - 2) 'Kleine Größenkorrektur if LV_Orient& = 1 LV_Orient& = 2 Elseif LV_Orient& = 2 LV_Orient& = 1 endif if ((LV_Xoffset& + LV_Width&) > @Width(LV_Handle&)) 'Damit das Element nicht Außerhalb LV_Width& = (@Width(LV_Handle&) - LV_Xoffset&) 'des Sichtbaren Bereiches der Spalte endif 'erstellt wirdEndprocProc Auswahl_Ausblenden[/FONT] [FONT=Arial] @Hide(Kunde_BMP&) @Hide(choicebox1%) @Hide(edit2%) @Hide(ABBRUCH_BMP&) @Hide(Liste_Kunden_Auswahl&)EndprocProc Auswahl_Einblenden[/FONT] [FONT=Arial] @Show(Kunde_BMP&) @Show(choicebox1%) @Show(edit2%) @Show(ABBRUCH_BMP&) @Show(Liste_Kunden_Auswahl&)EndprocProc CreateElements[/FONT] [FONT=Arial][/FONT] [FONT=Arial] WindowStyle 26 | 512 | 2048 WindowTitle "Arbeitsfenster" Window WinXStartPos&, WinYStartPos& - &WinXSize, &WinYSize[/FONT] [FONT=Arial] Cls $FFFFFF SetDialogFont 0 AddHotKey 7005, 13 ,0 'Enter setzen MenuItem(7005) TextColor @RGB(0,0,0),-1 DrawText 20, 20,"Kunde",0 edit1% = Create("Edit", %hwnd, "Ihre Kunden zur Auswahl ->", 20, 40, 200, 24) var bmp& = load_oem(0,32738) iconbutton1% = Create("PICBUTTON", %hwnd, bmp&, 220, 40, 24, 24) var XT% = 20 var YT% = 65 MCls 608,520 StartPaint -1 CLS $FFFFFF UsePen 0,1,@RGB(0,0,0) Rectangle 0,0 - 608,520 UseFont "System",0,0,0,0,0 TextColor @RGB(0,0,0),-1 DrawText 10,10,"Im Feld",0 DrawText 240,10,"Volltextsuche nach",0 EndPaint var Test& = @Create("hPic",0,"&MEMBMP") Kunde_BMP&=@Create("Bitmap", %Hwnd, Test&, XT%,YT%) MCls 20,20 StartPaint -1 CLS $FF UseFont "System",0,0,0,0,0 TextColor $FFFFFF,-1 DrawText 1,2,20,20,"X",1 EndPaint Test& = @Create("hPic",0,"&MEMBMP") ABBRUCH_BMP& = Create("PICBUTTON", %Hwnd, Test&,XT% + 575, YT% + 5, 24, 24) choicebox1% = Create("ChoiceBox", %Hwnd, 0, XT% + 72, YT% + 5, 140, 150) AddString(choicebox1%, "Nummer ") AddString(choicebox1%, "Kunde ") AddString(choicebox1%, "Ansprechpartner ") SendMessage(choicebox1%,$14E,1,0) edit2% = Create("Edit", %Hwnd, "edit", XT% + 370,YT% + 5, 185, 24)[/FONT] [FONT=Arial] Liste_Kunden_Auswahl&=CreateListView(%Hwnd,%hinstance,0,$FFFFFF,-1,$31) InsertColumn Liste_Kunden_Auswahl&,"Nummer",80,0 InsertColumn Liste_Kunden_Auswahl&,"Kunde",220,0 InsertColumn Liste_Kunden_Auswahl&,"Ansprechpartner",300,0 AutoSortListview Liste_Kunden_Auswahl&,2,1,1 SetItem Liste_Kunden_Auswahl&,""," < Neu >","" SetItem Liste_Kunden_Auswahl&,"1","Gerd","Gerd Telzerow" SetItem Liste_Kunden_Auswahl&,"2","Stephan","Gerd Telzerow" ShowListView(Liste_Kunden_Auswahl&, XT%, YT% + 32, 608, 488)EndProcSubClassProc[/FONT] [FONT=Arial][/FONT] [FONT=Arial] Select %smessage[/FONT] [FONT=Arial] CaseOf $114, $115 SendMessage(%hwnd, %smessage, &swparam, &slparam)[/FONT] [FONT=Arial] CaseOf $101, $202, $205, $208 SendMessage(%hwnd, &WM_COMMAND, MakeLong(GetDlgCtrlID(&swnd), 0), &swnd)[/FONT] [FONT=Arial] EndSelectEndproc[/FONT] [FONT=Arial]Proc Volltext_Suche[/FONT] [FONT=Arial] Parameters Text$,Liste%,Wo_Su$ Declare y&,x&,s&,tz$,mess$ If Wo_Su$ = "Nummer" s& = 0 Elseif Wo_Su$ = "Kunde" s& = 1 Else s& = 2 Endif y&=SearchText(Liste%,0,GetLines(Liste%),s&,addr(Text$),11,addr(x&)) If (y&<>-1) SelectLine(Liste%,0,6) SelectLine(Liste%,y&,1) Else tz$=" Kein Suchergebniss für - " + Text$ + " - gefunden!" mess$="Ändern Sie die Suchanforderung im Textfeld und Starten Sie die \nSuche erneut mit der Taste Enter." @messagebox(mess$,tz$,64) EndifEndProcProc MainLoop[/FONT] [FONT=Arial][/FONT] [FONT=Arial] UserMessages 16 ShowWindow(%hwnd, 1)[/FONT] [FONT=Arial] Subclass choicebox1%, 1 :Subclass edit1%, 1 [/FONT] [FONT=Arial] InitMessages(%hwnd) Declare LV_Bereich#,Text$,y& Dim LV_Bereich#,320 While 1[/FONT] [FONT=Arial] WaitInput[/FONT] [FONT=Arial] Case %umessage = 16 : BREAK[/FONT] [FONT=Arial] Clear LV_Bereich# y& = GetControlParas(LV_Bereich#)'Feldparameter auslesen Get_LvData 'Parameter auslese'Ergebnis: Long - 0=kein Itemklick / 1=Doppelklick links / 2=Rechtsklick / 3=Linksklick.[/FONT] [FONT=Arial][/FONT] [FONT=Arial] If (y&<>0) AND (Liste_Kunden_Auswahl& = LV_Handle&) 'Listview Handle If y&=1 Auswahl_Ausblenden Clear LV_Bereich# GetItemText(Liste_Kunden_Auswahl&,LV_Bereich#,0,LV_Row&) Text$ = String$(LV_Bereich#,0) GetItemText(Liste_Kunden_Auswahl&,LV_Bereich#,1,LV_Row&) Text$ = Text$ + " - " + String$(LV_Bereich#,0) SetText edit1%,Text$ EndIf Endif If Clicked(ABBRUCH_BMP&) Auswahl_Ausblenden ElseIf (@GetFocus(edit2%)) AND (@MenuItem(7005)) '#window Volltext_Suche(GetText$(edit2%),Liste_Kunden_Auswahl&,Trim$(GetText$(choicebox1%))) ElseIf Clicked(iconbutton1%) '#window Auswahl_Einblenden EndIf EndWhile[/FONT] [FONT=Arial] Subclass choicebox1%, 0 : Subclass edit1%, 0 [/FONT] [FONT=Arial] Dispose LV_Bereich#EndProcProc Main[/FONT] [FONT=Arial] CreateElements Auswahl_Ausblenden MainLoopEndProc[/FONT] [FONT=Arial]Main[/FONT] [FONT=Arial]CloseMessages(%hwnd)[/FONT] [FONT=Arial]freedll lvdll&[/FONT] [FONT=Arial]$I Listview_Dispose.incEnd[/FONT] [FONT=Arial][/FONT]
Code 2:
Code
[FONT=Arial]$H Windows.ph$H Structs.ph$I Listview_Funktionen.inc[/FONT] [FONT=Arial]var lvdll&=usedll("Listview.dll")Declare LV_Handle&,LV_Column&,LV_Row&,LV_Text$,LV_Xoffset&,LV_Yoffset&,LV_Width&,LV_Height&,LV_Font&,LV_Orient&[/FONT] [FONT=Arial]Declare nurso%, ilist%, smallicon%, largeicon%, vstatic1%, text1%, choicebox1%, text2%, edit1%, Liste_Kunden_Auswahl&, edit2%, iconbutton1%Declare Kunde_BMP&,ABBRUCH_BMP&,Eingabe_Dlg&DEF Load_OEM(2) !"USER32","LoadBitmapA"[/FONT] [FONT=Arial]Def @Show(1) @ShowWindow(@&(1), 1)[/FONT] [FONT=Arial]Def @Hide(1) @ShowWindow(@&(1), 0)Def GetDlgCtrlID(1) !"USER32","GetDlgCtrlID"[/FONT] [FONT=Arial]Def &COLOR_BTNFACE $F[/FONT] [FONT=Arial]Def &DEFAULT_GUI_FONT $11Def &WM_COMMAND $111Def &WinXSize 800[/FONT] [FONT=Arial]Def &WinYSize 800Declare XMax&, YMax&, WinXStartPos&, WinYStartPos&[/FONT] [FONT=Arial]Declare Rect#[/FONT] [FONT=Arial]Struct TRect = ~RECTDim Rect#, TRect~SystemParametersInfo(~SPI_GETWORKAREA, 0, Rect#, 0)[/FONT] [FONT=Arial]XMax& = Rect#.Right& - Rect#.Left&[/FONT] [FONT=Arial]YMax& = Rect#.Bottom& - Rect#.Top&WinXStartPos& = (XMax& - &WinXSize) / 2 + Rect#.Left& - (%MaxX - Rect#.Right&)WinYStartPos& = (YMax& - &WinYSize) / 2 + Rect#.Top& - (%MaxY - Rect#.Bottom&)'Daten aus lesen für die Liste[/FONT] [FONT=Arial]Proc Get_LvData LV_Handle&=Long(LV_Bereich#,0) 'Listview Handle LV_Column&=Long(LV_Bereich#,4) 'Index Spalte LV_Row&=Long(LV_Bereich#,8) 'Index Zeile LV_Xoffset&=Long(LV_Bereich#,12) 'X Offset LV_Yoffset&=Long(LV_Bereich#,16) 'Y Offset LV_Width&=Long(LV_Bereich#,20) 'Breite LV_Height&=Long(LV_Bereich#,24) 'Höhe LV_Font&=Long(LV_Bereich#,28) 'Font Handle LV_Orient&=Long(LV_Bereich#,32) 'Textausrichtung LV_Text$=String$(LV_Bereich#,64) 'Itemtext LV_Height& = (LV_Height& - 2) 'Kleine Größenkorrektur if LV_Orient& = 1 LV_Orient& = 2 Elseif LV_Orient& = 2 LV_Orient& = 1 endif if ((LV_Xoffset& + LV_Width&) > @Width(LV_Handle&)) 'Damit das Element nicht Außerhalb LV_Width& = (@Width(LV_Handle&) - LV_Xoffset&) 'des Sichtbaren Bereiches der Spalte endif 'erstellt wirdEndprocProc Auswahl_Ausblenden[/FONT] [FONT=Arial] @Hide(Kunde_BMP&) @Hide(choicebox1%) @Hide(edit2%) @Hide(ABBRUCH_BMP&) @Hide(Eingabe_Dlg&) @Hide(Liste_Kunden_Auswahl&)EndprocProc Auswahl_Einblenden[/FONT] [FONT=Arial] @Show(Kunde_BMP&) @Show(choicebox1%) @Show(edit2%) @Show(ABBRUCH_BMP&) @Show(Eingabe_Dlg&) @Show(Liste_Kunden_Auswahl&)EndprocProc CreateElements[/FONT] [FONT=Arial][/FONT] [FONT=Arial] WindowStyle 26 | 512 | 2048 WindowTitle "Arbeitsfenster" Window WinXStartPos&, WinYStartPos& - &WinXSize, &WinYSize[/FONT] [FONT=Arial] Cls $FFFFFF SetDialogFont 0 AddHotKey 7005, 13 ,0 'Enter setzen MenuItem(7005)[/FONT] [FONT=Arial] TextColor @RGB(0,0,0),-1 DrawText 20, 20,"Kunde",0 edit1% = Create("Edit", %hwnd, "Ihre Kunden zur Auswahl ->", 20, 40, 200, 24) var bmp& = load_oem(0,32738) iconbutton1% = Create("PICBUTTON", %hwnd, bmp&, 220, 40, 24, 24) var XT% = WinXStartPos& + 20 var YT% = WinYStartPos& + 95 WindowStyle 64 + 16 Eingabe_Dlg& = @Create("Window",%Hwnd,"",XT% ,YT% ,608,520) MCls 608,520 StartPaint -1 CLS $FFFFFF UsePen 0,1,@RGB(0,0,0) Rectangle 0,0 - 608,520 UseFont "System",0,0,0,0,0 TextColor @RGB(0,0,0),-1 DrawText 10,10,"Im Feld",0 DrawText 240,10,"Volltextsuche nach",0 EndPaint var Test& = @Create("hPic",0,"&MEMBMP") Kunde_BMP&=@Create("Bitmap", Eingabe_Dlg&, Test&, 0,0) MCls 20,20 StartPaint -1 CLS $FF UseFont "System",0,0,0,0,0 TextColor $FFFFFF,-1 DrawText 1,2,20,20,"X",1 EndPaint Test& = @Create("hPic",0,"&MEMBMP") ABBRUCH_BMP& = Create("PICBUTTON", Eingabe_Dlg&, Test&,575, 4, 24, 24) choicebox1% = Create("ChoiceBox", Eingabe_Dlg&, 0, 72, 5, 140, 150) AddString(choicebox1%, "Nummer ") AddString(choicebox1%, "Kunde ") AddString(choicebox1%, "Ansprechpartner ") SendMessage(choicebox1%,$14E,1,0) edit2% = Create("Edit", Eingabe_Dlg&, "edit", 370, 5, 185, 24)[/FONT] [FONT=Arial] Liste_Kunden_Auswahl&=CreateListView(Eingabe_Dlg&,%hinstance,0,$FFFFFF,-1,$31) InsertColumn Liste_Kunden_Auswahl&,"Nummer",80,0 InsertColumn Liste_Kunden_Auswahl&,"Kunde",220,0 InsertColumn Liste_Kunden_Auswahl&,"Ansprechpartner",300,0 AutoSortListview Liste_Kunden_Auswahl&,2,1,1 SetItem Liste_Kunden_Auswahl&,""," < Neu >","" SetItem Liste_Kunden_Auswahl&,"1","Gerd","Gerd Telzerow" SetItem Liste_Kunden_Auswahl&,"2","Stephan","Gerd Telzerow" ShowListView(Liste_Kunden_Auswahl&, 0, 32, 608, 488)EndProcSubClassProc[/FONT] [FONT=Arial][/FONT] [FONT=Arial] Select %smessage[/FONT] [FONT=Arial] CaseOf $114, $115 SendMessage(%hwnd, %smessage, &swparam, &slparam)[/FONT] [FONT=Arial] CaseOf $101, $202, $205, $208 SendMessage(%hwnd, &WM_COMMAND, MakeLong(GetDlgCtrlID(&swnd), 0), &swnd)[/FONT] [FONT=Arial] EndSelectEndproc[/FONT] [FONT=Arial]Proc Volltext_Suche[/FONT] [FONT=Arial] Parameters Text$,Liste%,Wo_Su$ Declare y&,x&,s&,tz$,mess$ If Wo_Su$ = "Nummer" s& = 0 Elseif Wo_Su$ = "Kunde" s& = 1 Else s& = 2 Endif y&=SearchText(Liste%,0,GetLines(Liste%),s&,addr(Text$),11,addr(x&)) If (y&<>-1) SelectLine(Liste%,0,6) SelectLine(Liste%,y&,1) Else tz$=" Kein Suchergebniss für - " + Text$ + " - gefunden!" mess$="Ändern Sie die Suchanforderung im Textfeld und Starten Sie die \nSuche erneut mit der Taste Enter." @messagebox(mess$,tz$,64) EndifEndProcProc MainLoop[/FONT] [FONT=Arial][/FONT] [FONT=Arial] UserMessages 16 ShowWindow(%hwnd, 1)[/FONT] [FONT=Arial] Subclass choicebox1%, 1 :Subclass edit1%, 1 [/FONT] [FONT=Arial] InitMessages(%hwnd) Declare LV_Bereich#,Text$,y& Dim LV_Bereich#,320 While 1[/FONT] [FONT=Arial] WaitInput[/FONT] [FONT=Arial] Case %umessage = 16 : BREAK[/FONT] [FONT=Arial] Clear LV_Bereich# y& = GetControlParas(LV_Bereich#)'Feldparameter auslesen Get_LvData 'Parameter auslese'Ergebnis: Long - 0=kein Itemklick / 1=Doppelklick links / 2=Rechtsklick / 3=Linksklick.[/FONT] [FONT=Arial][/FONT] [FONT=Arial] If (y&<>0) AND (Liste_Kunden_Auswahl& = LV_Handle&) 'Listview Handle If y&=1 Auswahl_Ausblenden Clear LV_Bereich# GetItemText(Liste_Kunden_Auswahl&,LV_Bereich#,0,LV_Row&) Text$ = String$(LV_Bereich#,0) GetItemText(Liste_Kunden_Auswahl&,LV_Bereich#,1,LV_Row&) Text$ = Text$ + " - " + String$(LV_Bereich#,0) SetText edit1%,Text$ EndIf Endif If Clicked(ABBRUCH_BMP&) Auswahl_Ausblenden ElseIf (@GetFocus(edit2%)) AND (@MenuItem(7005)) '#window Volltext_Suche(GetText$(edit2%),Liste_Kunden_Auswahl&,Trim$(GetText$(choicebox1%))) ElseIf Clicked(iconbutton1%) '#window Auswahl_Einblenden EndIf EndWhile[/FONT] [FONT=Arial] Subclass choicebox1%, 0 : Subclass edit1%, 0 [/FONT] [FONT=Arial] Dispose LV_Bereich#EndProcProc Main[/FONT] [FONT=Arial] CreateElements Auswahl_Ausblenden MainLoopEndProc[/FONT] [FONT=Arial]Main[/FONT] [FONT=Arial]CloseMessages(%hwnd)[/FONT] [FONT=Arial]freedll lvdll&[/FONT] [FONT=Arial]$I Listview_Dispose.incEnd[/FONT] [FONT=Arial][/FONT]