Tiboi Posted June 3, 2010 Share Posted June 3, 2010 hi all how are you'll doing? my question is: If i use this to populate a combobox: IniReadSectionNames ( "filename" ) is there a way to prevent or hide a certain "SectionName" from being seen in the combobox? Link to comment Share on other sites More sharing options...
Shakala Posted June 3, 2010 Share Posted June 3, 2010 (edited) Im not to familiar with combo Boxes, But if you could post an example of one you are working with, ill see what i can do. Edit: If you dont want to, i suppose someone else will be along to figure it out for you. ~Shakala Edited June 3, 2010 by Shakala Link to comment Share on other sites More sharing options...
Tiboi Posted June 3, 2010 Author Share Posted June 3, 2010 Im not to familiar with combo Boxes, But if you could post an example of one you are working with, ill see what i can do. Edit: If you dont want to, i suppose someone else will be along to figure it out for you. ~Rycon ok sorry about taking so long to answer. was busy. here is the code: #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 395, 228, 192, 124) $combobox = GUICtrlCreateCombo("", 16, 64, 361, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) $Populate = GUICtrlCreateButton("Populate", 24, 96, 347, 97) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Populate Populate() EndSwitch WEnd Func Populate() $var = IniReadSectionNames(@ScriptDir & "\save.ini") For $i = 1 To $var[0] GUICtrlSetData($combobox, $var[$i]) Next EndFunc and here is ini to test it: [Pop1] key=bla [Pop2] key=bla [Pop3] key=bla [Pop4] key=bla [Pop5] key=bla [This is the Name i don't want to be seen in the combobox] key=bla Link to comment Share on other sites More sharing options...
Shakala Posted June 3, 2010 Share Posted June 3, 2010 (edited) Honestly, Im not sure if this is what you were looking for, but it seems to be something that you could work with. What it does is it saves the info under the section name like it was doing in the combo box, but it saves it under $Hiddenand keeps it from being shown in the combo box.Like i said, im not sure if this is what you wanted, and if its not, just say so lol#include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 395, 228, 192, 124) $combobox = GUICtrlCreateCombo("", 16, 64, 361, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) $Populate = GUICtrlCreateButton("Populate", 24, 96, 347, 97) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Populate Populate() EndSwitch WEnd Func Populate() $var = IniReadSectionNames(@ScriptDir & "\save.ini") For $i = 1 To $var[0] If $var[$i] = "asdf" Then $Hidden = IniReadSection(@ScriptDir & "Save.ini", "asdf") Else GUICtrlSetData($combobox, $var[$i]) EndIf Next EndFunc ;==>Populatethe ini[Pop1] key=bla [Pop2] key=bla [Pop3] key=bla [Pop4] key=bla [Pop5] key=bla [asdf] key=bla~Shakala Edited June 3, 2010 by Shakala Link to comment Share on other sites More sharing options...
somdcomputerguy Posted June 3, 2010 Share Posted June 3, 2010 Maybe this? I haven't tested this so I don't know. Func Populate() $var = IniReadSectionNames(@ScriptDir & "\save.ini") For $i = 1 To $var[0] If StringinStr($var[$i], "Pop") Then GUICtrlSetData($combobox, $var[$i]) ; ==< Next EndFunc - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
Tiboi Posted June 3, 2010 Author Share Posted June 3, 2010 (edited) Maybe this? I haven't tested this so I don't know. Func Populate() $var = IniReadSectionNames(@ScriptDir & "\save.ini") For $i = 1 To $var[0] If StringinStr($var[$i], "Pop") Then GUICtrlSetData($combobox, $var[$i]) ; ==< Next EndFunc thanks but the ini file will have totally different names i just used "pop" in the as an example Edit: hey man i now understand what you were doing here, though i had to change it around i got it to work with my code. thanks for the help. Edited June 3, 2010 by Tiboi Link to comment Share on other sites More sharing options...
Tiboi Posted June 3, 2010 Author Share Posted June 3, 2010 (edited) Shakala's idea seems to do what i want thanks for the help. edit: it works perfectly in my main code. thanks again Edited June 3, 2010 by Tiboi Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now