Jump to content

Recommended Posts

Posted

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

Posted

#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

  • Moderators
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

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.

  • Moderators
Posted

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.

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.

Posted

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.

 

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...