Sign in to follow this  
Followers 0
Swimming_Bird

GUICtrlSetData not updating properly

3 posts in this topic

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

Share this post


Link to post
Share on other sites



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

[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

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


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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