# Solved - Combo Clear Only Selection String

## Recommended Posts

Hi I'm struggling to clear the display text of of a GUI control combo selection string.

I would like to clear the selection like it is clear after it is populated, but not remove any items from the list.

Here is a small example.

```#include <GuiComboBox.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>

; Create GUI
\$hgui= guicreate("Clear ComboBox Edit Text", 320, 200)
\$control_combo= guictrlcreatecombo("", 10, 10, 250, 20, \$CBS_DROPDOWNLIST)
\$control_clear_button= guictrlcreatebutton("Reset Blank Combo Selection String", 10, 40, 200, 20)
guisetstate()
guictrlsetdata(\$control_combo, "a|b|c"); Populate Combo

while 1
switch guigetmsg()
case \$control_clear_button
guictrlsetdata(\$control_combo, ""); This clears the entire list frustrating me

case \$gui_event_close
exitloop
endswitch;guigetmsg()
wend;main loop```
Does anyone one know how I can reset the selection to "", clear, empty set?

I've tried SetEditText but doesn't work CBS_DROPDOWNLIST.

SOLVED:

Sorry I thought I had tried this: _GUICtrlComboBox_SetCurSel(\$control_combo, -1) is the solution.

Edited by Xandy

## Create an account

Register a new account

• ### Similar Content

• By Miliardsto
I got that func
Func makeHelpImgGUI(\$title,\$width,\$height,\$img) \$img = GUICtrlCreatePic("",20,40,\$width,\$height) _ResourceSetImageToCtrl(\$img, "HERE") EndFunc and I call this func like that
makeHelpImgGUI("Image",1190, 800,\$SETTINGS_JPG)
so what is the problem in the parameter where is - "HERE" I need value of img but passed as string
so \$img = \$SETTINGS_JPG and how make it "SETTINGS_JPG"

I tried something like that but not work
Func makeHelpImgGUI(\$title,\$width,\$height,\$img) \$name_str = String(\$img) \$name_str = StringTrimLeft (\$name_str, 1 ) \$img = GUICtrlCreatePic("",20,40,\$width,\$height) _ResourceSetImageToCtrl(\$img, \$name_str) EndFunc
• By liagason
Hello everyone,
How can I display in ascending  sequence some numbers stored in a string variable?
\$str = "18,03,48,23" MsgBox(0,"test",\$str) I would like it to display "03,18,23,48"
• By Rskm
Hi, I have the following line in a text file 'input.txt'. I know the line number - say '6'. I wish to replace the text 'WWW' in the below line with a random number (I can generate that with random()).
WERIS  WWWJP   3.83  8.330  1.000                1097.RAXX
The WWW is a 3 digit integer (could be any number between 0 to 999), I can use stringtrimleft and get the numerical value of WWW in this file
so, basically, I know the string to replace (ie; WWW stored in a variable), I know the line number to work on and the file location/name and the replacement variable (through random()). My requirement is to fill that 3 spaces with my random number (which Is a integer between 1 and 999)

• By nacerbaaziz
Hello Members of this best Forum
for example if i have a long string
and i want to extract a text between two tag
what i can do to make that?
note :
i know that there is a
StringRegExp function
it's do that work
but it result is be as an array
i want the result to be a string
is there any function on autoit can do that?
• By mistersquirrle
Hello!

I wrote myself a script to follow Google Maps Polyline encoding steps: https://developers.google.com/maps/documentation/utilities/polylinealgorithm, and that works (although I think that it's a bit janky), but now I'm having issues getting the output.

When I run the script, all the points come out correctly in the console, and even when they're the only things that I log, it displays them fine. However, I'm adding each point into a variable to return all of them at once at the end, fully formatted, and it's only taking the very first point. I can't figure out what I'm doing wrong, as it seems fine.

When run with the default value, it should output this at the end: Custom Polygon: _p~iF~ps|U_ulLnnqC_mqNvxq`@
But instead I'm just getting this: Custom Polygon: _p~iF

I know that it's reaching the string combination lines because it's logging the data before it (and even if a put log AFTER the \$sPolygon &= \$aPoints[0], it's logged fine).

Here's my full code (problem is lines ~209 - 234, search "\$sPolygon &= \$aPoints[1]"):
I've tried:
\$sPolygon &= \$aPoints[0] & \$aPoints[1] ;---- \$sPolygon = \$sPolygon & \$aPoints[0] & \$aPoints[1] ;---- \$sPolygon = \$sPolygon & String(\$aPoints[0] & \$aPoints[1]) ;---- \$sPolygon = String(\$sPolygon) & String(\$aPoints[0]) & String(\$aPoints[1]) ;---- \$sPolygon &= \$aPoints[1] \$sPolygon &= \$aPoints[0] ;----
I'm sure it's something basic that I'm overlooking, but I don't understand why it's not combining the strings.
Also, unrelated, why doesn't \$LogFile = FileOpen(\$File, 9) create the directory/ file if they don't exist? 9 should be \$FO_CREATEPATH (8) + \$FO_APPEND (1)?
Thanks!
×

• Wiki

• Back

• Git