Jump to content

GUICtrlSetData not updating properly


Recommended Posts

I define the objects in the control like this:

#include <GUIConstants.au3>
Global $programnames
Func _getnames ()
    Local $configini = IniReadSectionNames ( 'config.ini' )
    $programnames = $configini[1]
    For $n=2 To $configini[0]
        $programnames = $programnames & '|' & $configini[$n]
    Next
EndFunc
_getnames ()

This is the how i'm using my combobox:

Opt ( 'GUICoordMode' , 1 )
$refresh2 = GUICtrlCreateButton ( 'Refresh' ,350 , 52 )
GUICtrlCreateLabel ( 'Program Name' , 7 , 60 , 80 , 17 )
Opt ( 'GUICoordMode' , 2 )
$combo2 = GUICtrlCreateCombo ( '' , -1 , 1 , 390 )
GUICtrlSetData ( -1 , $programnames )
GUICtrlCreateButton ( 'Delete This Program' , -1 , 8 , 390 , 20)

And this is how i call for it to reset:

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $refresh Or $msg = $refresh2
            _getnames ()
            GUICtrlSetData ( $combo1 , $programnames )
            GUICtrlSetData ( $combo2 , $programnames )
    EndSelect
Wend

The problem is that every time i reset it just adds whatever it reads to the end of the combobox instead of completely refreshing it.

Any help is appreciated.

Thanks

Link to comment
Share on other sites

  • Moderators

I define the objects in the control like this:

#include <GUIConstants.au3>
Global $programnames
Func _getnames ()
    Local $configini = IniReadSectionNames ( 'config.ini' )
    $programnames = $configini[1]
    For $n=2 To $configini[0]
        $programnames = $programnames & '|' & $configini[$n]
    Next
EndFunc
_getnames ()

This is the how i'm using my combobox:

Opt ( 'GUICoordMode' , 1 )
$refresh2 = GUICtrlCreateButton ( 'Refresh' ,350 , 52 )
GUICtrlCreateLabel ( 'Program Name' , 7 , 60 , 80 , 17 )
Opt ( 'GUICoordMode' , 2 )
$combo2 = GUICtrlCreateCombo ( '' , -1 , 1 , 390 )
GUICtrlSetData ( -1 , $programnames )
GUICtrlCreateButton ( 'Delete This Program' , -1 , 8 , 390 , 20)

And this is how i call for it to reset:

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $refresh Or $msg = $refresh2
            _getnames ()
            GUICtrlSetData ( $combo1 , $programnames )
            GUICtrlSetData ( $combo2 , $programnames )
    EndSelect
Wend

The problem is that every time i reset it just adds whatever it reads to the end of the combobox instead of completely refreshing it.

Any help is appreciated.

Thanks

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $refresh Or $msg = $refresh2
            GUICtrlSetData ( $combo1 , '' )
            GUICtrlSetData ( $combo2 , '' )
            _getnames ()
            GUICtrlSetData ( $combo1 , $programnames )
            GUICtrlSetData ( $combo2 , $programnames )
    EndSelect
Wend

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.

Link to comment
Share on other sites

  • Developers

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $refresh Or $msg = $refresh2
             _getnames ()
            GUICtrlSetData ( $combo1 , "|" & $programnames )
            GUICtrlSetData ( $combo2 , "|" & $programnames )
    EndSelect
Wend

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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
 Share

  • Recently Browsing   0 members

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