x_files_x Posted July 8, 2013 Share Posted July 8, 2013 Mrb arkadaslar bir gui yapıyorum da sadece öğrenmek adına, şimdi giyi olusturdum müşteri ekle kaldır butonları da var ve calısıyor ancak, diyelimki 100 tane müşteri ekledim, ondan birin silmek icin mecburen isim arama yaparak ordan bulup sil demem gerekiyor bu nedenle, inputa yazdıgım bilgiyi aşağıdaki listboxta bulup secili yapabilirmiyim, bu benim yaptıgım gui #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1_1 = GUICreate(" .:|:. Müşteri Kayıt .:|:.", 406, 335, 238, 159) GUISetBkColor(0x9DB9EB) $Group1 = GUICtrlCreateGroup("Kayıt", 8, 8, 294, 65) $Input1 = GUICtrlCreateInput("", 92, 30, 195, 21) $Label1 = GUICtrlCreateLabel("Adı ve Soyadı:", 16, 32, 72, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("", 312, 8, 81, 65) $Button1 = GUICtrlCreateButton("Ekle", 325, 25, 55, 17) $Button2 = GUICtrlCreateButton("Sil", 325, 45, 55, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $Items = GUICtrlCreateList("", 8, 88, 297, 240) $Dosya = @AppDataDir & "\kisiler.ini" GuiCtrlSetData(-1, IniRead($Dosya, "kullanıcılar", "adlar", "")) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Func _ReadItems() Local $iCnt = _GUICtrlListBox_GetCount($Items) Local $sMsg = "" For $n = 0 To $iCnt - 1 $sMsg &= _GUICtrlListBox_GetText($Items, $n) & "|" Next Return $sMsg EndFunc While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 ;ekle $Dosya = $Dosya If Not StringInStr(IniRead($Dosya, "kullanıcılar", "adlar", "") & "|", GUICtrlRead($Input1)) Then IniWrite($Dosya, "kullanıcılar", "adlar", _ReadItems() & GUICtrlRead($Input1)) EndIf GuiCtrlSetData($Items, "") GuiCtrlSetData($Items, IniRead($Dosya, "kullanıcılar", "adlar", "")) Case $Button2 ;sil $Dosya = $Dosya Global $MusteriData = StringStripWS(IniRead($Dosya,"Kullanıcılar","Adlar",""), 3) $Gread = StringStripWS(GUICtrlRead($Items), 3) If $Gread <> "" And StringInStr("|" & $MusteriData & "|", "|" & $Gread & "|") <> 0 Then $MusteriData = StringReplace($MusteriData, $Gread, "") $MusteriData = StringReplace($MusteriData, "||", "|") If $MusteriData = StringRight($MusteriData,1) = "|" Then $MusteriData = StringTrimRight($MusteriData,1) GUICtrlSetData($Items, "") GUICtrlSetData($Items, $MusteriData) IniWrite($Dosya,"Kullanıcılar","Adlar",$MusteriData) EndIf EndSwitch WEnd Bu da ismi bulabilen gui örnegi, ama bir türlü benimkine ekleme yapamadım, birde siz bakar mısınız? #include <GuiComboBox.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Constants.au3> #include <GuiListBox.au3> #include <GuiListView.au3> $Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work Global $Input1 _Main() Func _Main() Local $Form1_1 ; Create GUI $Form1_1 = GUICreate("(UDF) ComboBox Create", 400, 296) $Input1 = _GUICtrlComboBox_Create($Form1_1, "", 2, 2, 396, 296) $Button1 = GUICtrlCreateButton("Ekle", 325, 100, 55, 17) $Button2 = GUICtrlCreateButton("Sil", 325, 124, 55, 17) Global $list = GUICtrlCreateList("", 2, 25, 296, 240) GuiCtrlSetData(-1, IniRead(@AppDataDir & "\kisiler.ini", "kullanıcılar", "adlar", "")) Global $Items = "murat ak", $Items_S = StringSplit($Items, "|") GUICtrlSetData(-1, $Items) Global $check = GUICtrlCreateCheckbox("gelişmiş arama", 2, 270, 200, 21) GUISetState() GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_Main Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg Local $hWndFrom, $iIDFrom, $iCode $hWndFrom = $ilParam $iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word $iCode = BitShift($iwParam, 16) ; Hi Word Switch $hWndFrom Case $Input1 Switch $iCode Case $CBN_EDITCHANGE ; Sent when the edit control portion of a combo box is about to display altered text Local $text = _GUICtrlComboBox_GetEditText($Input1) If BitAND(GUICtrlRead($check), $GUI_CHECKED) = 0 Then Return _GUICtrlListBox_SelectString($list, $text) _GUICtrlListBox_FindInText($list, $text) Local $count = _GUICtrlListBox_GetCount($list) If $text = "" Then For $i = 1 To $Items_S[0] _GUICtrlListBox_AddString($list, $Items_S[$i]) Next Else For $i = 1 To $Items_S[0] If StringInStr($Items_S[$i], $text) Then _GUICtrlListBox_ResetContent($list) _GUICtrlListBox_AddString($list, $Items_S[$i]) Return EndIf Next EndIf EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND Quote Link to comment Share on other sites More sharing options...
mesale0077 Posted July 10, 2013 Share Posted July 10, 2013 (edited) #include <GuiComboBox.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Constants.au3> #include <GuiListBox.au3> #include <GuiListView.au3> $Dosya = @AppDataDir & "\kisiler.ini" $Debug_CB = False Global $Input1 _Main() Func _Main() Local $Form1_1 $Form1_1 = GUICreate("(UDF) ComboBox Create", 400, 296) $Input1 = _GUICtrlComboBox_Create($Form1_1, "", 2, 2, 396, 296) $Button1 = GUICtrlCreateButton("Ekle", 325, 100, 55, 17) $Button2 = GUICtrlCreateButton("Sil", 325, 124, 55, 17) Global $list = GUICtrlCreateList("", 2, 25, 296, 240) $Dos = IniRead($Dosya, "kullanıcılar", "adlar", "") GuiCtrlSetData(-1, $Dos ) GUISetState() GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $Dosya = $Dosya If Not StringInStr(IniRead($Dosya, "kullanıcılar", "adlar", "") & "|", _GUICtrlComboBox_GetEditText($Input1)) Then IniWrite($Dosya, "kullanıcılar", "adlar", _ReadItems() & _GUICtrlComboBox_GetEditText($Input1)) EndIf GuiCtrlSetData($list, "") GuiCtrlSetData($list, IniRead($Dosya, "kullanıcılar", "adlar", "")) Case $Button2 $Dosya = $Dosya Global $MusteriData = StringStripWS(IniRead($Dosya,"Kullanıcılar","Adlar",""), 3) $Gread = StringStripWS(GUICtrlRead($list), 3) If $Gread <> "" And StringInStr("|" & $MusteriData & "|", "|" & $Gread & "|") <> 0 Then $MusteriData = StringReplace($MusteriData, $Gread, "") $MusteriData = StringReplace($MusteriData, "||", "|") If $MusteriData = StringRight($MusteriData,1) = "|" Then $MusteriData = StringTrimRight($MusteriData,1) GUICtrlSetData($list, "") GUICtrlSetData($list, $MusteriData) IniWrite($Dosya,"Kullanıcılar","Adlar",$MusteriData) EndIf EndSwitch WEnd EndFunc Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg Local $hWndFrom, $iIDFrom, $iCode $hWndFrom = $ilParam $iIDFrom = BitAND($iwParam, 0xFFFF) $iCode = BitShift($iwParam, 16) Switch $hWndFrom Case $Input1 Switch $iCode Case $CBN_EDITCHANGE Local $text = _GUICtrlComboBox_GetEditText($Input1) Return _GUICtrlListBox_SelectString($list, $text) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc Func _ReadItems() Local $iCnt = _GUICtrlListBox_GetCount($list) Local $sMsg = "" For $n = 0 To $iCnt - 1 $sMsg &= _GUICtrlListBox_GetText($list, $n) & "|" Next Return $sMsg EndFunc umarım işini görür :) Edited July 10, 2013 by mesale0077 Quote Link to comment Share on other sites More sharing options...
x_files_x Posted July 10, 2013 Author Share Posted July 10, 2013 Böyle bişi yaptım, yardım ettigin için tşk ederim :) #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1_1 = GUICreate(" .:|:. Müşteri Kayıt .:|:.", 406, 335, 238, 159) GUISetBkColor(0x9DB9EB) $Group1 = GUICtrlCreateGroup("Kayıt", 8, 8, 294, 65) $cInput = GUICtrlCreateInput("", 92, 30, 195, 21) $Label1 = GUICtrlCreateLabel("Adı ve Soyadı:", 16, 32, 72, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("", 312, 8, 81, 65) $Button1 = GUICtrlCreateButton("Ekle", 325, 25, 55, 17) $Button2 = GUICtrlCreateButton("Sil", 325, 45, 55, 17) $Button3 = GUICtrlCreateButton("Resetle", 325, 88, 55, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $cList = GUICtrlCreateList("", 8, 88, 297, 240) ;liste kutusu olusturuyoruz------ $Dosya = @AppDataDir & "\kisiler.ini" GuiCtrlSetData(-1, IniRead($Dosya, "kullanıcılar", "adlar", ""));---------------- GUISetState(@SW_SHOW) $cCheck_Dummy = GUICtrlCreateDummy() ; eklenecek----------- ;~ _Fill_List() GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") ;eklenecek ------------- Func _ReadcList() ;bu eklenecek------------------------------------------- Local $iCnt = _GUICtrlListBox_GetCount($cList) Local $sMsg = "" For $n = 0 To $iCnt - 1 $sMsg &= _GUICtrlListBox_GetText($cList, $n) & "|" Next Return $sMsg EndFunc While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cList;-------------------------------- eklenecek----------- $sChosen = GUICtrlRead($cList) If $sChosen <> "" Then GUICtrlSetData($cInput, $sChosen) EndIf Case $cCheck_Dummy $sText = GUICtrlRead($cInput) $iIndex = _GUICtrlListBox_FindString($cList, $sText) If $iIndex <> -1 Then _GUICtrlListBox_SetCurSel($cList, $iIndex) Else _GUICtrlListBox_SetCurSel($cList, -1) EndIf; eklenecek ------------------------------------------- Case $Button1 ;ekle butonu icin görevvvvvv-------------- $Dosya = $Dosya If Not StringInStr(IniRead($Dosya, "kullanıcılar", "adlar", "") & "|", GUICtrlRead($cInput)) Then IniWrite($Dosya, "kullanıcılar", "adlar", _ReadcList() & GUICtrlRead($cInput)) EndIf GuiCtrlSetData($cList, "") GuiCtrlSetData($cList, IniRead($Dosya, "kullanıcılar", "adlar", "")) Case $Button2 ;sil butonu icin görev --------------------- $Dosya = $Dosya Global $MusteriData = StringStripWS(IniRead($Dosya,"Kullanıcılar","Adlar",""), 3) $Gread = StringStripWS(GUICtrlRead($cList), 3) If $Gread <> "" And StringInStr("|" & $MusteriData & "|", "|" & $Gread & "|") <> 0 Then $MusteriData = StringReplace($MusteriData, $Gread, "") $MusteriData = StringReplace($MusteriData, "||", "|") If $MusteriData = StringRight($MusteriData,1) = "|" Then $MusteriData = StringTrimRight($MusteriData,1) GUICtrlSetData($cList, "") GUICtrlSetData($cList, $MusteriData) IniWrite($Dosya,"Kullanıcılar","Adlar",$MusteriData) EndIf Case $Button3 FileDelete($Dosya) ;dosyayı sil ve If @Compiled = 1 Then ;yeniden başlat------------- Run( FileGetShortName(@ScriptFullPath)) Else Run( FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath)) EndIf Exit EndSwitch WEnd Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) ;bu da eklenecekk ----------------------- If $lParam = GUICtrlGetHandle($cInput) Then If BitShift($wParam, 16) = $EN_CHANGE Then GUICtrlSendToDummy($cCheck_Dummy) EndIf EndIf EndFunc ;~ Func _Fill_List() ;~ Local $sData ;~ For $i = 0 To 99 ;~ $sData &= Chr(Random(65, 90, 1)) & Chr(Random(65, 90, 1)) & Chr(Random(65, 90, 1)) & Chr(Random(65, 90, 1)) & "|" ;~ Next ;~ GUICtrlSetData($cList, $sData) ;~ EndFunc Quote Link to comment Share on other sites More sharing options...
mesale0077 Posted July 10, 2013 Share Posted July 10, 2013 (edited) bunu Case $Button3 FileDelete($Dosya) ;dosyayı sil ve If @Compiled = 1 Then ;yeniden başlat------------- Run( FileGetShortName(@ScriptFullPath)) Else Run( FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath)) EndIf Exit Case $Button3 FileDelete($Dosya) ;dosyayı sil ve GUICtrlSetData($cList, "") GUICtrlSetData($cInput, "") şeklinde yaparsan daha iyi olur :) teşekkür yazma beğen yap yeter teşekkür yazmak yasak :) Edited July 10, 2013 by mesale0077 Quote Link to comment Share on other sites More sharing options...
x_files_x Posted July 11, 2013 Author Share Posted July 11, 2013 Evet guictrlsetdata daha mantıklı onu düşünmemiştim :) artık yardımlarını beklerim, başka zamanda başka programlarda saygılar.. Quote Link to comment Share on other sites More sharing options...
mesale0077 Posted July 11, 2013 Share Posted July 11, 2013 yardımcı olmak isterdim ama pc işini çözemedi :( Quote Link to comment Share on other sites More sharing options...
x_files_x Posted July 20, 2013 Author Share Posted July 20, 2013 Sağlık olsun çözülür umarım, sıkma canını Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.