BGAMT Posted 4 hours ago Posted 4 hours ago I have 5 input boxes labeled $hEdit1 through $hEdit5 that represent slots. I pull a report file whose name contains the slot the file comes from. I'm parsing the filename to get the actual slot and then changing the background color of the appropriate input box to show visually where it came from. I can change the background color directly with GUICtrlSetBkColor($hEdit2, 0x00FF00) for example with no problem and _ArrayDisplay shows me my slot variable is correct. I combined the two like this GUICtrlSetBkColor("$hEdit" & $Slot, 0x00FF00) and I get no error but it wont change the background. When I combine "$hEdit" & $Slot in a message box it shows $hEdit2 as expected. I'm sure I'm missing something simple here but my searches haven't found anything explaining this. Can Anyone explain why this doesn't work for identifying the control?
Solution Nine Posted 3 hours ago Solution Posted 3 hours ago Look at Eval function. Don't forget to not put the $ sign in... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
BGAMT Posted 2 hours ago Author Posted 2 hours ago That was way harder than I expected but it did work. I guess it wasnt able to build it on the fly but building and eval'ing the string first was able to work. I ended up with Something like this; $combined = "hEdit" & $Slot then $evaled = eval($combined) then finally GUICtrlSetBkColor($evaled, 0x00FF00). I could not find a way to do it inside the GUICtrlSetBkColor directly but it does work. donnyh13 1
donnyh13 Posted 46 minutes ago Posted 46 minutes ago Just for an alternative, you also have: Execute("GUICtrlSetBkColor(" & "$hEdit" & $Slot & ", 0x00FF00)") Or: GUICtrlSetBkColor(Eval("hEdit" & $Slot), 0x00FF00) Best regards, Donny LibreOffice UDF Scite4AutoIt Spell-Checker Using LibreOffice WPS Office adapter — Use MS Word UDFs with WPS Office! LibreOffice API Inspector tools Spoiler "Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."
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