Jump to content

ComboBox list rest


DaleJrFan
 Share

Recommended Posts

I am able to read and write to the INI file. But when I write to the INI file, my Combobox dropdown List is not updating with the new information unless I close the entire Script and restart it. Any help would be greatly appreciated. I am not sure what script to show becasue it is such a big file.

Link to comment
Share on other sites

I am able to read and write to the INI file. But when I write to the INI file, my Combobox dropdown List is not updating with the new information unless I close the entire Script and restart it. Any help would be greatly appreciated. I am not sure what script to show becasue it is such a big file.

Do you mean update the listbox with the new .ini values?
Link to comment
Share on other sites

I am able to read and write to the INI file. But when I write to the INI file, my Combobox dropdown List is not updating with the new information unless I close the entire Script and restart it. Any help would be greatly appreciated. I am not sure what script to show becasue it is such a big file.

Does this help?

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $msg,$btn,$combo
    
    GUICreate("My GUI") ; will create a dialog box that when displayed is centered
    $btn = GUICtrlCreateButton("chabnge combo list",20,10,100,20)
    
    $combo = GUICtrlCreateCombo("", 10, 60)
    GUICtrlSetData(-1, "item1|item2|item3", "item3")

    GUISetState()     ; will display an empty dialog box with a combo control with focus on

; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
        
        
        if $msg = $Btn then GUICtrlSetData($combo,"|horses|cows|pigs|sheep","pigs")
    WEnd
EndFunc  ;==>Example
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Does this help?

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $msg,$btn,$combo
    
    GUICreate("My GUI"); will create a dialog box that when displayed is centered
    $btn = GUICtrlCreateButton("chabnge combo list",20,10,100,20)
    
    $combo = GUICtrlCreateCombo("", 10, 60)
    GUICtrlSetData(-1, "item1|item2|item3", "item3")

    GUISetState()   ; will display an empty dialog box with a combo control with focus on

; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
        
        
        if $msg = $Btn then GUICtrlSetData($combo,"|horses|cows|pigs|sheep","pigs")
    WEnd
EndFunc;==>Example
Does not seem to be working. Here is the code

$Main_Entry = GUICreate("Main Entry - " & $Version_Product, 433, 150, -1, -1)

GUISetIcon($Icon)

GUISetBkColor(0x008000)

TraySetIcon($Icon)

Global $MainName = GUICtrlCreateCombo("", 24, 16, 281, 25, $CBS_DROPDOWNLIST + $CBS_SORT)

$List = IniReadSectionNames($iniFileFolder & "\" & $iniFileName)

If @error Then

MsgBox(4096, "", "Error occurred, probably no INI file.")

Else

For $i = 1 To $List[0]

GUICtrlSetData($MainName, $List[$i], "")

Next

EndIf

GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")

$New = GUICtrlCreateButton("New", 44, 56, 81, 25, 0)

GUICtrlSetOnEvent($New, "NewButton")

$View = GUICtrlCreateButton("View Contact", 204, 56, 81, 25, 0)

GUICtrlSetOnEvent($View, "ViewContact")

$Close = GUICtrlCreateButton("Close", 127, 98, 81, 25, 0)

GUICtrlSetOnEvent($Close, "CloseButton")

$Pic1 = GUICtrlCreatePic($Main_Entry_Photo, 320, 16, 100, 105, 0)

$MenuFile = GUICtrlCreateMenu("File")

$MenuFileSubNew = GUICtrlCreateMenuItem("Add New Contact", $MenuFile)

GUICtrlSetOnEvent($MenuFileSubNew, "NewButton")

$MenuFileSeperator = GUICtrlCreateMenuItem("", $MenuFile)

$MenuFileSubClose = GUICtrlCreateMenuItem("Close", $MenuFile)

GUICtrlSetOnEvent($MenuFileSubClose, "CloseButton")

$MenuHelp = GUICtrlCreateMenu("Help")

$MenuHelpSubAbout = GUICtrlCreateMenuItem(("About -" & $Version_Product), $MenuHelp)

Guictrlsetonevent($MenuHelpSubAbout, "AboutProgram")

GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")

;End of Main Entry Form Design--------------------

Edited by DaleJrFan
Link to comment
Share on other sites

If you mean that the example I gave doesn't work then it does when I run it.

If you mean that the code you posted doesn't work then I have no way of knowing what doesn't work because the code you posted isn't complete. You are using OnEvent mode but there is nothing in what you posted to set that mode, none of the functions to be called by events are included and there is no idle loop.

Can you post some code which runs and shows your problem, and give an example of an ini file you are using?

If you enclose yor code with code tags ([ c o d e ] before and [ / c o d e ] after but without spaces) it will be easier for us to read.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

  • Moderators

#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>
$h_gui = GUICreate("")
$h_combo = GUICtrlCreateCombo("", 10, 10, 200, 450)

GUISetState()
_IniWrite_UpdateCombo($h_combo, "MyIniFile.ini", "combosection", "key1", "this is value 1")
Sleep(3000)
_IniWrite_UpdateCombo($h_combo, "MyIniFile.ini", "combosection", "key2", "this is value 2")

While GUIGetMsg() <> -3
WEnd

Func _IniWrite_UpdateCombo($h_combo, $s_inifile, $s_section, $s_key, $s_value)
    Local $s_list = _GUICtrlComboBox_GetList($h_combo)
    Local $s_selected = _GUICtrlComboBox_GetEditText($h_combo)
    GUICtrlSetData($h_combo, "")
    GUICtrlSetData($h_combo, $s_list & "|" & $s_value, $s_selected)
    Return IniWrite($s_inifile, $s_section, $s_key, $s_value)
EndFunc

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

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...