Jump to content

Comdobox Ta Yazdığım Kadarınılistele


mustafakara

Recommended Posts

sevgili arkadaşlar aşağıdaki combobox örneğindeki

listelemeyi benim yazdığım kadarını içerenlerin listesini yapmasını istiyorum

bu nasıl mümkün olur

yazdığımla alakası olmayanların listeden çıkartılmasını istiyorum


#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$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

_Main()

Func _Main()
	Local $hCombo

	; Create GUI
	GUICreate("ComboBox Set Horizontal Extent", 400, 296)
	$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296, BitOR($CBS_SIMPLE, $CBS_DISABLENOSCROLL, $WS_HSCROLL))
	GUISetState()

	; Add files
	_GUICtrlComboBox_BeginUpdate($hCombo)
	_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
	_GUICtrlComboBox_EndUpdate($hCombo)

	; Loop until user exits
	Do
	Until GUIGetMsg() = $GUI_EVENT_CLOSE
	GUIDelete()
EndFunc   ;==>_Main


Link to comment
Share on other sites

Heralde @mustafakara yazdığı yazıya göre ilgili gui elemanının güncellenmesini istiyor.

Ben udfleri fazla kullanmıyorum. Bu yüzden sana basit bir örnek verim kurcala...

Global $FILE_LIST = _FILE_LIST(@WindowsDir & "\*.exe")
_Main()
Func _Main()
	Local $hEdit1,$hEdit2,$BL_Value,$BL_Value1 = "?"
	GUICreate("ComboBox Set Horizontal Extent", 400, 296)

	$hEdit1 = GUICtrlCreateInput("", 0, 3, 396, 24)
	$hEdit2 = GUICtrlCreateEdit("", 0, 30, 396, 250)

	GUISetState()
	While 1
		$nMsg = GUIGetMsg()
		Switch $nMsg
			Case -3
				Exit

		EndSwitch
		$BL_Value = GUICtrlRead($hEdit1)
		If $BL_Value <> $BL_Value1 Then
			GUICtrlSetData($hEdit2,"")
			If $BL_Value = "" Then
				For $I = 1 To $FILE_LIST[0]
					GUICtrlSetData($hEdit2,$FILE_LIST[$I] & @crlf,1)
				Next
			Else
				For $I = 1 To $FILE_LIST[0]
					If StringInStr($FILE_LIST[$I],$BL_Value) Then GUICtrlSetData($hEdit2,$FILE_LIST[$I] & @crlf,1)
				Next
			EndIf
			$BL_Value1 = $BL_Value
		EndIf
	WEnd
	GUIDelete()
EndFunc   ;==>_Main

Func _FILE_LIST($BL_FILE_LOCATION)
	Local $RETURN_LIST[1] = [0]
	Local $search = FileFindFirstFile($BL_FILE_LOCATION) ,$file
	If $search <> -1 Then
		While 1
			$file = FileFindNextFile($search)
			If @error Then ExitLoop
			$RETURN_LIST[0] += 1
			Redim $RETURN_LIST[$RETURN_LIST[0] +1]
			$RETURN_LIST[$RETURN_LIST[0]] = $file
		WEnd
	Endif
	FileClose($search)
	Return $RETURN_LIST
EndFunc

Link to comment
Share on other sites

@mustafakara

Söylediğin yapılabilir, ama comboyu güncelleme ve kontrol esnasında yazdığın yazı silinecek veyahut listeye eklenecek.

Tabi farklı bir yöntemde olabilir.

Ama bence sen bir iş için extra bir gui elamanı oluşturmandır.

Mesela XPdeki Başlat - Çalıştır penceresi!

Sade bir menüsü var. Bu menüde comboboxsumuz var. Biz bir şey yazarken altta bir pencere açılıyor ve comboboxun içinde yazdığımız yazı var ise orda görüntüleniyor. Lakin burdaki açılan pencere comboboxa ait deyil. Bu bir listview!

Umarım anlatabilmişim.

Sen tam olarak nasıl bir şey istiyorsun?

Link to comment
Share on other sites

sevgili blue_life

senin söylediğin şekildede olabilir

hatta listview daha iyi olur

yanlız listviev tam liste gelsin

ama ben a harfine bastığımda sadece a harfi ile başlayanlar kalsın ben yazmaya devam ettikce yazdığıma en yakın olanlar kalsın

bir nevi google gibi teşekkürler herşey için

Link to comment
Share on other sites

@mustafakara

Onlarda bir nevi animasyon var. Yani içeriğe göre ilgili liste büyüyük küçülüyor vs. vs.

Biraz uğraşmak lazım ama :(

Fazla vaktim yok!

Ben sana basit bir örnek verim sen incelersin...

Global $FILE_LIST = _FILE_LIST(@WindowsDir & "\*.exe")
_Main()
Func _Main()
	Local $hCombo,$mylist,$SET_DATA,$BL_Value,$BL_Value1 = "?"

	Local $hEdit1,$hEdit2
	GUICreate("ComboBox Set Horizontal Extent", 400, 296)

	$hCombo = GUICtrlCreateCombo("", 0, 3, 400, 24)
	For $I = 1 To $FILE_LIST[0]
		$SET_DATA &= $FILE_LIST[$I] & "|"
	Next
	GUICtrlSetData($hCombo,$SET_DATA)

	$mylist = GUICtrlCreateList("", 0, 24, 400, 97)

	GUISetState()
	While 1
		$nMsg = GUIGetMsg()
		Switch $nMsg
			Case -3
				Exit

		EndSwitch
		$BL_Value = GUICtrlRead($hCombo)
		If $BL_Value <> $BL_Value1 Then
			GUICtrlSetData($mylist,"")
			For $I = 1 To $FILE_LIST[0]
				If StringLeft($FILE_LIST[$I],StringLen($BL_Value)) = $BL_Value Then GUICtrlSetData($mylist,$FILE_LIST[$I])
			Next
			$BL_Value1 = $BL_Value
		EndIf
	WEnd
	GUIDelete()
EndFunc   ;==>_Main

Func _FILE_LIST($BL_FILE_LOCATION)
	Local $RETURN_LIST[1] = [0]
	Local $search = FileFindFirstFile($BL_FILE_LOCATION) ,$file
	If $search <> -1 Then
		While 1
			$file = FileFindNextFile($search)
			If @error Then ExitLoop
			$RETURN_LIST[0] += 1
			Redim $RETURN_LIST[$RETURN_LIST[0] +1]
			$RETURN_LIST[$RETURN_LIST[0]] = $file
		WEnd
	Endif
	FileClose($search)
	Return $RETURN_LIST
EndFunc

Link to comment
Share on other sites

teşekkürler

aşağıdaki örnekte inputa deyer girdiğimde listbox ta listeliyor ancak

listbox üzerinde seçim yapamıyorum neden acaba

#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>
Global $file = @ScriptDir & "\Config.ini"
_Main()
Func _Main()
	Local $input,$mylist

	GUICreate("ComboBox Set Horizontal Extent", 400, 296)
	$input = GUICtrlCreateInput("", 0, 3, 400, 24)
	$mylist = GUICtrlCreateList("", 0, 24, 400, 97)
	GUISetState()
	While 1
		$nMsg = GUIGetMsg()
		Switch $nMsg
			Case -3
				Exit
		EndSwitch
		_Main1($mylist,$input,$file)
	WEnd
	GUIDelete()
EndFunc   ;==>_Main1

Func _Main1($list1,$input1,$filename)
Local $BL_Value,$BL_Value1 = ""

			$BL_Value1 = $BL_Value

$BL_Value = GUICtrlRead($input1)
		If $BL_Value <> $BL_Value1 Then
			GUICtrlSetData($list1,"")
			$var2 = IniReadSectionNames($filename)
			If Not @error Then
			For $I = 1 To $var2[0]
				If StringLeft($var2[$I],StringLen($BL_Value)) = $BL_Value Then GUICtrlSetData($list1,$var2[$I])

			Next
EndIf
$BL_Value1 = $BL_Value
		EndIf
EndFunc   ;==>_Main


Link to comment
Share on other sites

#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Global $INI_NAME = @WindowsDir & "\win.ini"
Local $INI_READ_NAMES = _INI_READ_NAMES($INI_NAME)


_Main()
Func _Main()
	Local $input, $mylist,$BL_Value,$BL_Value1 = "?"
	GUICreate("ComboBox Set Horizontal Extent", 400, 296)

	$input = GUICtrlCreateInput("", 0, 3, 400, 24)

	$mylist = GUICtrlCreateList("", 0, 30, 400, 97)



	GUISetState()

	While 1
		$nMsg = GUIGetMsg()
		Switch $nMsg
			Case -3
				Exit
		EndSwitch

		$BL_Value = GUICtrlRead($input)
		If $BL_Value <> $BL_Value1 Then
			GUICtrlSetData($mylist,"")
			For $I = 1 To $INI_READ_NAMES[0]
				If StringLeft($INI_READ_NAMES[$I],StringLen($BL_Value)) = $BL_Value Then GUICtrlSetData($mylist,$INI_READ_NAMES[$I])
			Next
			$BL_Value1 = $BL_Value
		EndIf
	WEnd
	GUIDelete()
EndFunc   ;==>_Main

Func _INI_READ_NAMES($INI_NAME)
	Local $LISTEM[1] = [0]
	Local $RS_NAMES = IniReadSectionNames($INI_NAME)
	If Not @error Then Return $RS_NAMES
	Return $LISTEM
EndFunc

Link to comment
Share on other sites

arkadaşlar yukarıdaki örneğin listview olan halini yaptım ancak

liste öğeleri elendikce telefon mumaraları karışıyor neden acaba


#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $Rehber1 = "iller"
Global $Rehber2 = ".lst"


Local $BL_Value,$BL_Value1 = "?"

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 800, 600, 192, 124)
$tab = GUICtrlCreateTab(10, 10, 790, 590)
$tab3 = GUICtrlCreateTabItem("KAYIT DÜZENLE")
$tab3input = GUICtrlCreateInput("", 20, 60, 460, 24)
$tab3LAB = GUICtrlCreateLabel("BUL :", 25, 40, 250, 20)
GUICtrlSetFont($tab3LAB, 16)
$tab3LAB1 = GUICtrlCreateLabel("İL :", 505, 40, 250, 20)
GUICtrlSetFont($tab3LAB1, 16)
$tab3list = GUICtrlCreateList("ankara", 500, 60, 250, 40)
$tab3ListView = GUICtrlCreateListView("", 20, 84, 750, 440)
_GUICtrlListView_AddColumn($tab3ListView, "adı soyadı", 150)
_GUICtrlListView_AddColumn($tab3ListView, "türü:", 100)
_GUICtrlListView_AddColumn($tab3ListView, "bilgi", 100)
_GUICtrlListView_AddColumn($tab3ListView, "türü 1:", 100)
_GUICtrlListView_AddColumn($tab3ListView, "bilgi 1:", 100)
_GUICtrlListView_AddColumn($tab3ListView, "türü 2:", 100)
_GUICtrlListView_AddColumn($tab3ListView, "bilgi 2:", 100)
$tab3button = GUICtrlCreateButton("DÜZENLE!", 50, 550, 200, 30)

GUISetState(@SW_SHOW)
While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
	EndSwitch

$BL_Value = GUICtrlRead($tab3input)
		If $BL_Value <> $BL_Value1 Then
			GUICtrlSetData($tab3ListView,"")
Local $var2 = IniReadSectionNames($Rehber1 & "\" & GUICtrlRead($tab3list) & $Rehber2)
			_GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($tab3ListView))
			For $I = 1 To $var2[0]
				If StringLeft($var2[$I],StringLen($BL_Value)) = $BL_Value Then _GUICtrlListView_InsertItem($tab3ListView, $var2[$I], 0)



_GUICtrlListView_AddSubItem($tab3ListView, 0, IniRead($Rehber1 & "\" & GUICtrlRead($tab3list) & $Rehber2,$var2[$i] ,"tur1",""), 1)
_GUICtrlListView_AddSubItem($tab3ListView, 0, IniRead($Rehber1 & "\" & GUICtrlRead($tab3list) & $Rehber2, $var2[$I],"tel1",""), 2)
_GUICtrlListView_AddSubItem($tab3ListView, 0, IniRead($Rehber1 & "\" & GUICtrlRead($tab3list) & $Rehber2, $var2[$I],"tur2",""), 3)
_GUICtrlListView_AddSubItem($tab3ListView, 0, IniRead($Rehber1 & "\" & GUICtrlRead($tab3list) & $Rehber2, $var2[$I],"tel2",""), 4)
_GUICtrlListView_AddSubItem($tab3ListView, 0, IniRead($Rehber1 & "\" & GUICtrlRead($tab3list) & $Rehber2, $var2[$I],"tur3",""), 5)
_GUICtrlListView_AddSubItem($tab3ListView, 0, IniRead($Rehber1 & "\" & GUICtrlRead($tab3list) & $Rehber2, $var2[$I],"tel3",""), 6)
Next
			$BL_Value1 = $BL_Value
		_GUICtrlListView_SortItems($tab3ListView, 0)
		_GUICtrlListView_SetItemSelected($tab3ListView, 0)
		EndIf





WEnd

Link to comment
Share on other sites

@mustafakara

Kısaca gerekli düzenlemeyi yaptım.. Incelersin...

#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>

Global $Rehber1 = "iller"
Global $Rehber2 = ".lst"

Local $BL_Value, $BL_Value1 = "?"
$Form1 = GUICreate("Form1", 800, 600, 192, 124)
$tab = GUICtrlCreateTab(10, 10, 790, 590)
$tab3 = GUICtrlCreateTabItem("KAYIT DÜZENLE")
$tab3input = GUICtrlCreateInput("", 20, 60, 460, 24)
$tab3LAB = GUICtrlCreateLabel("BUL :", 25, 40, 250, 20)
GUICtrlSetFont($tab3LAB, 16)
$tab3LAB1 = GUICtrlCreateLabel("İL :", 505, 40, 250, 20)
GUICtrlSetFont($tab3LAB1, 16)
$tab3list = GUICtrlCreateList("", 500, 60, 250, 40)
_FIND_LST_FILE($Rehber1)

$tab3ListView = GUICtrlCreateListView("", 20, 84, 750, 440)
_GUICtrlListView_AddColumn($tab3ListView, "adı soyadı", 150)
_GUICtrlListView_AddColumn($tab3ListView, "türü:", 100)
_GUICtrlListView_AddColumn($tab3ListView, "bilgi", 100)
_GUICtrlListView_AddColumn($tab3ListView, "türü 1:", 100)
_GUICtrlListView_AddColumn($tab3ListView, "bilgi 1:", 100)
_GUICtrlListView_AddColumn($tab3ListView, "türü 2:", 100)
_GUICtrlListView_AddColumn($tab3ListView, "bilgi 2:", 100)
$tab3button = GUICtrlCreateButton("DÜZENLE!", 50, 550, 200, 30)

GUISetState(@SW_SHOW)

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
		Case $tab3list
			$BL_Value1 = "?"

	EndSwitch
	$BL_Value = GUICtrlRead($tab3input)
	If $BL_Value <> $BL_Value1 Then
		GUICtrlSetData($tab3ListView, "")
		_GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($tab3ListView))
		$var2 = _INI_READ_NAMES($Rehber1 & "\" & GUICtrlRead($tab3list) & $Rehber2)
		For $I = 1 To $var2[0]
			If StringLeft($var2[$I], StringLen($BL_Value)) <> $BL_Value Then ContinueLoop
			_GUICtrlListView_InsertItem($tab3ListView, $var2[$I], 0)
			_GUICtrlListView_AddSubItem($tab3ListView, 0, IniRead($Rehber1 & "\" & GUICtrlRead($tab3list) & $Rehber2, $var2[$I], "tur1", ""), 1)
			_GUICtrlListView_AddSubItem($tab3ListView, 0, IniRead($Rehber1 & "\" & GUICtrlRead($tab3list) & $Rehber2, $var2[$I], "tel1", ""), 2)
			_GUICtrlListView_AddSubItem($tab3ListView, 0, IniRead($Rehber1 & "\" & GUICtrlRead($tab3list) & $Rehber2, $var2[$I], "tur2", ""), 3)
			_GUICtrlListView_AddSubItem($tab3ListView, 0, IniRead($Rehber1 & "\" & GUICtrlRead($tab3list) & $Rehber2, $var2[$I], "tel2", ""), 4)
			_GUICtrlListView_AddSubItem($tab3ListView, 0, IniRead($Rehber1 & "\" & GUICtrlRead($tab3list) & $Rehber2, $var2[$I], "tur3", ""), 5)
			_GUICtrlListView_AddSubItem($tab3ListView, 0, IniRead($Rehber1 & "\" & GUICtrlRead($tab3list) & $Rehber2, $var2[$I], "tel3", ""), 6)
		Next

		$BL_Value1 = $BL_Value
		_GUICtrlListView_SortItems($tab3ListView, 0)
		_GUICtrlListView_SetItemSelected($tab3ListView, 0)
	EndIf
WEnd

Func _INI_READ_NAMES($INI_NAME)
	Local $LISTEM[1] = [0]
	Local $RS_NAMES = IniReadSectionNames($INI_NAME)
	If @error Then Return $LISTEM
	Return $RS_NAMES
EndFunc   ;==>_INI_READ_NAMES

Func _FIND_LST_FILE($BL_PATH)
	If StringRight($BL_PATH, 1) <> "\" Then $BL_PATH &= "\"
	Local $Return_Lst = "", $DefReturn_Lst = ""
	Local $search = FileFindFirstFile($BL_PATH & "*.lst"), $BL_FND_FILE
	If $search <> -1 Then
		While 1
			$BL_FND_FILE = FileFindNextFile($search)
			If @error Then ExitLoop
			If StringInStr(FileGetAttrib($BL_PATH & $BL_FND_FILE), "D") <> 0 Then ContinueLoop
			$Return_Lst &= StringTrimRight($BL_FND_FILE, 4) & "|"
			If $DefReturn_Lst = "" Then $DefReturn_Lst = StringTrimRight($BL_FND_FILE, 4)
		WEnd
	EndIf
	FileClose($search)
	If StringRight($Return_Lst, 1) = "|" Then $Return_Lst = StringTrimRight($Return_Lst, 1)
	GUICtrlSetData(-1, "")
	GUICtrlSetData(-1, $Return_Lst, $DefReturn_Lst)
	Return $Return_Lst
EndFunc   ;==>_FIND_LST_FILE

Link to comment
Share on other sites

  • 1 ay sonra...

arkadaşlar aşağıdaki örnek üzerindeki input ların üzerinde entır tuşunabastığımızda buttona gitmeden
buttona basmış gibi
işlem yapmasını istiyorum
bu nasıl mümkün olur
hatta sadece 1. input üzerinde bu işlemi yapsın 2. input üzerinde herhangibir tepki vermesin

[code]

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
Local $file, $btn, $nMsg

GUICreate(" My GUI input acceptfile", 320, 120)
$file = GUICtrlCreateInput("", 10, 5, 300, 20)
GUICtrlCreateInput("", 10, 35, 300, 20)
$btn = GUICtrlCreateButton("Ok", 40, 75, 60, 20)

GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3
Exit
Case $btn
MsgBox(0,"",GUICtrlRead($file))
EndSwitch
WEnd
EndFunc ;==>Example

[/code]

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...