Omertron Posted February 14, 2011 Posted February 14, 2011 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?
Moderators Melba23 Posted February 14, 2011 Moderators Posted February 14, 2011 Omertron,The problem is on line #2926. Or if you prefer: My crystal ball is being repaired at the moment. 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 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
guinness Posted February 14, 2011 Posted February 14, 2011 (edited) Nice number of Posts Melba23!Posts:6,666 Edited February 14, 2011 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 parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018
Omertron Posted February 14, 2011 Author Posted February 14, 2011 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.
Moderators Melba23 Posted February 14, 2011 Moderators Posted February 14, 2011 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. guinness,The number of the Beast in 4 - good job I am not superstitious! M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Omertron Posted February 14, 2011 Author Posted February 14, 2011 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: expandcollapse popupFunc 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.
Moderators Melba23 Posted February 14, 2011 Moderators Posted February 14, 2011 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 fineDo 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 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Omertron Posted February 15, 2011 Author Posted February 15, 2011 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
Moderators Melba23 Posted February 15, 2011 Moderators Posted February 15, 2011 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 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now