Jump to content

Combo Box turns blank


Omertron
 Share

Recommended Posts

Hi,

I have a combo box on a form to select a list of languages that are populated from an INI file. All good so far.

However, during the main loop of the program, where I check for GUIGetMsg() events, if the user clicks on another control (such as a InputBox or a Label) the ComboBox selection is cleared (to blank) but the data is still there.

It's an annoying UI bug that I'd like to get fixed, any idea of what may cause it?

Link to comment
Share on other sites

  • Moderators

Omertron,

The problem is on line #2926. :idiot:

Or if you prefer: My crystal ball is being repaired at the moment. :idiot:

Seriously, how can we answer without seeing the code you use? :) Please post it here so we can take a look and offer you some proper help. When you post please use Code tags. Put [autoit] before and [/autoit] after your posted code.

See you soon. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Nice number of Posts Melba23!

Posts:

6,666

Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Yeah, I figured that would be the case, but I was hoping that it wasn't line #2926.

The problem is figuring out what code is relevant, it's not a large program, but it's 1,000 lines long.

Here's where I create the combo box and the text box.

$LANG_COMBO = GUICtrlCreateCombo("", 10, 100, -1, -1, $CBS_DROPDOWNLIST)
GUICtrlSetData(-1, $mLanguageList, $mLanguage)

GUICtrlCreateLabel("Dir:", 10, 130, 130)

$mLanguageList contains a "|" separated list of languages. Some lazy programming has meant that there's a "|" at the end of the list, but this shouldn't affect the display.

$mLanguage is a default language, that is contained in the list.

The cut down GetMsg loop (I've removed some button selections that all work and don't affect the combo box) looks like this:

While True
        $MSG = GUIGetMsg()
        Select
            Case $MSG = $RUN_BTN
                runCommand()

            Case $MSG = $VIDEO_BTN
                setVideo(True)

            Case $MSG = $LANG_COMBO
                $mLanguage = GUICtrlRead($LANG_COMBO)
                setLanguage($mLanguage)
                readLanguage()
                drawMainWindow(True)

            Case $MSG = $GUI_EVENT_CLOSE Or $MSG = $EXIT_BTN
                Exit

        EndSelect
    WEnd

setLanguage checks the language selected in the combo box and updates a couple of other variables (not used here)

readLanguage reads a static text file with the lanugage translations in it.

drawMainWindow(True) redraws the main window to use the loaded translations.

None of the other controls are referenced in the While loop, but as soon as they are clicked on, then combo box clears itself.

Link to comment
Share on other sites

  • Moderators

Omertron,

None of the other controls are referenced in the While loop, but as soon as they are clicked on, then combo box clears itself.

So something must be happening when those controls are clicked - but as you do not show us any of the code dealing with those controls how do you expect us to offer any proper advice? :)

The best I can do at the moment is to suggest that you look through the code and see if $mLanguageList is ever amended (and actually emptied) or whether $LANG_COMBO ever gets reset (probably without any data). Unless you do post all 1000 lines - or better a reduced script that just demonstrates the combo emptying - you cannot expect any more than that. :idiot:

guinness,

The number of the Beast in 4 ;) - good job I am not superstitious! :idiot:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

As I said, none of those controls have any code in that GUI loop at all, they are display controls only.

I was trying to keep the code relevant, but obviously cut too much out. Here's the GUI Window code:

Func drawMainWindow()
    Dim $lGuiStartTop = 200

    ; Create the main GUI
    $mWindow = GUICreate($mTitle, $mWidth, $mHeight, $mLeft, $mTop, $WS_CAPTION)

    GUISetBkColor($COL_BLACK, $mWindow)
    GUICtrlSetDefColor($COL_WHITE)

    ; Create the language list
    GUICtrlCreateLabel($LANG[45] & ":", 10, $lGuiStartTop, 150)
    $lGuiStartTop = $lGuiStartTop + 20
    $LANG_COMBO = GUICtrlCreateCombo("", 10, $lGuiStartTop, -1, -1, $CBS_DROPDOWNLIST)
    GUICtrlSetData(-1, $mLanguageList, $mLanguage)

    ;GUICtrlCreateGroup("Languages", 10, $lGuiStartTop, $mWidth - 20, 150)
    $lGuiStartTop = $lGuiStartTop + 30

    ; Create the PC location control including the directory search button
    GUICtrlCreateLabel($LANG[8] & ":", 10, $lGuiStartTop, $mWidth - 130)
    GUICtrlSetColor(-1, $COL_WHITE)

    $VIDEO_BTN = GUICtrlCreateButton($LANG[9], $mWidth - 110, $lGuiStartTop + 3, 100, 38)
    GUICtrlSetColor(-1, $COL_BLACK)

    $lGuiStartTop = $lGuiStartTop + 20;

    $VIDEO_DIR = GUICtrlCreateInput("C:\", 10, $lGuiStartTop, $mWidth - 130, 20)
    $lGuiStartTop = $lGuiStartTop + 25;
    GUICtrlSetColor(-1, $COL_BLACK)
    GUICtrlSetTip(-1, $LANG[10])

    ; Jukebox Output Directory
    GUICtrlCreateLabel($LANG[11] & ":", 10, $lGuiStartTop, $mWidth - 130)
    GUICtrlSetColor(-1, $COL_WHITE)

    $lGuiStartTop = $lGuiStartTop + 20
    $JUKEBOX_DIR = GUICtrlCreateInput($LANG[12], 10, $lGuiStartTop, $mWidth - 130, 20, $ES_READONLY)
    GUICtrlSetColor(-1, $COL_BLACK)

    $lGuiStartTop = $lGuiStartTop + 30

    ; Shortcut check boxes
    XPStyleToggle(1)
    GUICtrlCreateGroup($LANG[13], 10, $lGuiStartTop, $mWidth - 130, 60)
    GUICtrlSetColor(-1, $COL_WHITE)
    $lGuiStartTop = $lGuiStartTop + 15

    $CHK_SHORTCUT = GUICtrlCreateCheckbox($LANG[13], 20, $lGuiStartTop, $mWidth - 160, 20)
    GUICtrlSetColor($CHK_SHORTCUT, $COL_WHITE)
    GUICtrlSetState($CHK_SHORTCUT, $GUI_CHECKED)

    $lGuiStartTop = $lGuiStartTop + 20
    $CHK_DESKTOP = GUICtrlCreateCheckbox($LANG[16], 20, $lGuiStartTop, $mWidth - 160, 20)
    GUICtrlSetColor($CHK_DESKTOP, $COL_WHITE)
    GUICtrlSetState($CHK_DESKTOP, $GUI_CHECKED)
    XPStyleToggle(0)

    $lGuiStartTop = $lGuiStartTop + 35

    ; Create the SAVE button
    $SAVE_BTN = GUICtrlCreateButton($LANG[16], 10, $lGuiStartTop, 100)
    GUICtrlSetColor($SAVE_BTN, $COL_BLACK)
    setButtonSave(False)
    GUICtrlSetTip($SAVE_BTN, $LANG[17])

    ; Create the RUN button
    $RUN_BTN = GUICtrlCreateButton($LANG[18], ($mWidth / 2) - 50, $lGuiStartTop, 100)
    If StringLen($gACRJukeboxLocation) > 0 Then
        setButtonRun(True)
    Else
        setButtonRun(False)
    EndIf
    GUICtrlSetTip($RUN_BTN, $LANG[20])
    GUICtrlSetColor(-1, $COL_BLACK)

    ; Create the EXIT button
    $EXIT_BTN = GUICtrlCreateButton($LANG[20], $mWidth - 110, $lGuiStartTop, 100)
    GUICtrlSetTip(-1, $LANG[21])
    GUICtrlSetColor(-1, $COL_BLACK)

    $lGuiStartTop = $lGuiStartTop + 35

EndFunc   ;==>drawMainWindow

This is the code for the GUIMsg loop

; Run the GUI until the dialog is closed
    While True
        $MSG = GUIGetMsg()
        Select
            Case $MSG = $SAVE_BTN
                librarySave(GUICtrlRead($VIDEO_DIR), GUICtrlRead($JUKEBOX_DIR))
                setButtonRun(True)

            Case $MSG = $RUN_BTN
                runMovieJukebox()

            Case $MSG = $VIDEO_BTN
                setScanDir(True)
                GUICtrlSetData($JUKEBOX_DIR, calculatePath(GUICtrlRead($VIDEO_DIR)))

            Case $MSG = $LANG_COMBO
                $mLanguage = GUICtrlRead($LANG_COMBO)
                setLanguage($mLanguage)
                readLanguage()
                drawMainWindow()

            Case $MSG = $GUI_EVENT_CLOSE Or $MSG = $EXIT_BTN
                Exit

        EndSelect
    WEnd

When, for example the $VIDEO_DIR is clicked on, nothing else, just clicked on, then the ComboBox is blanked.

There is no code associated with that control (when you click it) it's triggered from the $VIDEO_BTN.

This only seems to happen on Windows XP 32Bit, I've tried the same code on Windows 7 64Bit and it seems to work fine.

Link to comment
Share on other sites

  • Moderators

Omerton,

This only seems to happen on Windows XP 32Bit, I've tried the same code on Windows 7 64Bit and it seems to work fine

Do you use any DllCall or GUIRegisterMsg commands in the script? There are often differences in the structures between x86 and x64 and you might not be getting what you think you are when you extract IDs, etc. :)

And I am still prepared to work through all 1000 lines if you are prepared to post them. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Yes, there is a DLLCall to "uxtheme.dll" for the styling of the check boxes, but again, that's only called with a button press and not clicking on the GUI.

Thanks for the help and pointers so far, I think I'm going to approach this from a different direction and re-code the language selection

Link to comment
Share on other sites

  • Moderators

Omertron,

OK. But my offer is still open - put the code in a PM if you do not want to post it on open forum. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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