Sign in to follow this  
Followers 0
Tiboi

IniReadSectionNames ( "filename" ) Question

7 posts in this topic

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?

Share this post


Link to post
Share on other sites

#2 ·  Posted (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 by Shakala

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 $Hidden

and 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   ;==>Populate

the ini

[Pop1]
key=bla
[Pop2]
key=bla
[Pop3]
key=bla
[Pop4]
key=bla
[Pop5]
key=bla
[asdf]
key=bla

~Shakala

Edited by Shakala

Share this post


Link to post
Share on other sites

#6 ·  Posted (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 by Tiboi

Share this post


Link to post
Share on other sites

#7 ·  Posted (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 by Tiboi

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0