Sign in to follow this  
Followers 0
Aceguy

Alphabetical Sort from inifile section names....

11 posts in this topic

heres my code, but would like the contents of the combobox to be sorted.......$CBS_SORT doesnt work.

#include <GUIConstants.au3>

$my_gui=GUICreate("my gui")
$My_list=GUICtrlCreateCombo("",10,10,$CBS_SORT)




$var = IniReadSectionNames(@DesktopDir & "\recipes.ini")
If @error Then 
    MsgBox(4096, "", "Error occured, probably no INI file.")
Else
    For $i = 1 To $var[0]
    GUICtrlSetData($my_list,$var[$i])
    Next
EndIf

GUISetState()

While 1
    $msg=GUIGetMsg()
Select
case $msg=-3
    ExitLoop
    EndSelect
WEnd

is it possible,

Many thanks.

Andy

Share this post


Link to post
Share on other sites



#include<array.au3>
#include <GUIConstants.au3>

$my_gui=GUICreate("my gui")
$My_list=GUICtrlCreateCombo("",10,10,$CBS_SORT)




$var = IniReadSectionNames(@DesktopDir & "\recipes.ini")
If @error Then
    MsgBox(4096, "", "Error occured, probably no INI file.")
Else
    _ArraySort($var)
    For $i = 1 To $var[0]
    GUICtrlSetData($my_list,$var[$i])
    Next
EndIf

GUISetState()

While 1
    $msg=GUIGetMsg()
Select
case $msg=-3
    ExitLoop
    EndSelect
WEnd

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

#include <GUIConstants.au3>
#include <Array.au3>

$my_gui=GUICreate("my gui")
$My_list=GUICtrlCreateCombo("",10,10,$CBS_SORT)

$var = IniReadSectionNames(@DesktopDir & "\recipes.ini")
If @error Then
    MsgBox(4096, "", "Error occured, probably no INI file.")
Else
    _ArraySort($var, 0, 1)
    For $i = 1 To $var[0]
        GUICtrlSetData($my_list,$var[$i])
    Next
EndIf

GUISetState()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = -3
            ExitLoop
    EndSelect
WEnd

Edit:

Oops, Val was a tad faster.... :D

Edit2:

But he forgot to start the sort on 1 :wacko:

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

can't believe you both missed this one

$My_list=GUICtrlCreateCombo("",10,10,-1,-1,$CBS_SORT)

No need for the array sort.

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

can't believe you both missed this one

$My_list=GUICtrlCreateCombo("",10,10,-1,-1,$CBS_SORT)

No need for the array sort.

LOL, well I didn't run the combo personally :D, nice catch.

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

can't believe you both missed this one

$My_list=GUICtrlCreateCombo("",10,10,-1,-1,$CBS_SORT)

No need for the array sort.

oooppss

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Thanks Guys..... But like i said.... $CBS_SORT doesnt work....

Arraysort Works a Treat.

thanks a 1,000,000 tho.

If you create the combo correctly it should.

$My_list=GUICtrlCreateCombo("",10,10,-1,-1,$CBS_SORT)

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

not odd, changed the style, need to bitor the default styles back in

#include <GUIConstants.au3>

$my_gui=GUICreate("my gui")
$My_list=GUICtrlCreateCombo("",10,10,200,120,BitOR($CBS_SORT,$CBS_DROPDOWN, $CBS_AUTOHSCROLL, $WS_VSCROLL))




$var = IniReadSectionNames(@DesktopDir & "\recipes.ini")
If @error Then 
    MsgBox(4096, "", "Error occured, probably no INI file.")
Else
    For $i = 1 To $var[0]
    GUICtrlSetData($my_list,$var[$i])
    Next
EndIf

GUISetState()

While 1
    $msg=GUIGetMsg()
Select
case $msg=-3
    ExitLoop
    EndSelect
WEnd

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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