Modify

#1247 closed Bug (Fixed)

Reading the edit of a comboboxEx with style $CBS_DROPDOWN and $WS_VSCROLL

Reported by: christophamort Owned by: Gary
Milestone: 3.3.1.5 Component: Standard UDFs
Version: 3.3.0.0 Severity: Blocking
Keywords: comboboxEx GetEditText Cc:

Description

The function _GUICtrlComboBoxEx_GetEditText does not give the inputs content, when called on a comboboxEx with the default style ($CBS_DROPDOWN $WS_VSCROLL). It always returns "".

code from autoit documentation with some changes:

#include <Debug.au3>
#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = True ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work
ClipPut(_DebugBugReportEnv()) ; my Environment = 3.3.0.0 under  WIN_VISTA/Service Pack 2 X64
_Main()

Func _Main()
	Local $hGUI, $hImage, $hCombo
	
	; Create GUI
	$hGUI = GUICreate("ComboBoxEx Get Edit Text", 400, 300)
	$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
	GUISetState()

	$hImage = _GUIImageList_Create (16, 16, 5, 3)
	_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
	_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
	_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
	_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
	_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
	_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
	_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
	_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
	_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
	_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

	For $x = 0 To 8
		_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $x, $x)
	Next
	
	; Set Edit Text
	_GUICtrlComboBoxEx_SetEditText ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)))
	
	; Get Edit Text
	MsgBox(4160, "Information", "Edit Text: " & _GUICtrlComboBoxEx_GetEditText ($hCombo))
	
	Do
	; Get Edit Text ond dirfferent selections
	MsgBox(4160, "Information", "Edit Text: " & _GUICtrlComboBoxEx_GetEditText ($hCombo))
	Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc   ;==>_Main

; Environment = 3.3.0.0 under WIN_VISTA/Service Pack 2 X64


Attachments (0)

Change History (10)

comment:1 by Valik, on Oct 25, 2009 at 3:25:09 PM

That script wins my award for most obnoxious script to reproduce a bug ever invented. I think you could have spent another 30 seconds and added a button and hooked it up to read the text rather than prompting with an obnoxious noise making message box.

comment:2 by christophamort, on Oct 28, 2009 at 7:49:23 PM

time is money!
c.

obnoxious! didn't know that word before, that's worth 100$$.

Il pagamento è stato inviato.
ID transazione: 2LE2951841735....
Il pagamento del tuo acquisto da ... è stato inviato.

Conserva questo ID ricevuta e le informazioni di contatto in caso tu abbia bisogno di contattare il commerciante o PayPal. Una ricevuta di questa transazione è stata inviata al tuo indirizzo email.

comment:3 by Valik, on Oct 28, 2009 at 8:09:57 PM

If you have nothing intelligent to impart then don't bother posting, otherwise you may find yourself unable to post any longer. The same applies for posting in languages other than English.

comment:4 by Valik, on Oct 28, 2009 at 10:52:47 PM

Here is a shorter and less annoying example:

#include <GuiComboBoxEx.au3>
#include <GuiConstantsEx.au3>

_Main()

Func _Main()
	Local $hGUI = GUICreate("ComboBoxEx Get Edit Text", 400, 300)
	Local $hCombo = _GUICtrlComboBox_Create ($hGUI, "", 2, 2, 394, 100)
	Local $hButton = GUICtrlCreateButton("Read", 4, 150, 50, 25)
	GUISetState()

	For $x = 0 To 8
 		_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $x, $x)
	Next

	; Setting the edit text fails.
	_GUICtrlComboBoxEx_SetEditText ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)))

	While True
		Switch GUIGetMsg()
			Case $GUI_EVENT_CLOSE
				ExitLoop
			Case $hButton
				; Reading the edit text fails.
				MsgBox(4160, "Information", "Edit Text: " & _GUICtrlComboBoxEx_GetEditText ($hCombo))
		EndSwitch
	WEnd
EndFunc   ;==>_Main

comment:5 by Valik, on Oct 30, 2009 at 4:11:24 PM

Severity: NoneBlocking

comment:6 by Jpm, on Oct 30, 2009 at 6:13:36 PM

I was prepare to answer that is the Way windows work.
I assume Valik found a solution to fix it as it is now in Blocking state.

comment:7 by Valik, on Oct 30, 2009 at 7:52:20 PM

Blocking means a ticket needs closed before the release, not that anything needs to change. If you are 100% sure this is an intentional Windows limitation that cannot be easily worked around then close the ticket.

comment:8 by Gary, on Nov 1, 2009 at 1:52:51 PM

Milestone: 3.3.1.5
Resolution: Fixed
Status: newclosed

Fixed by revision [5340] in version: 3.3.1.5

comment:9 by Valik, on Nov 1, 2009 at 3:22:10 PM

Just mentioning that this isn't fixed in that it will work. It's only fixed in that it's been documented that it doesn't work. It's a Windows design limitation.

comment:10 by Valik, on Nov 1, 2009 at 3:24:08 PM

This ticket is referenced in revision: [5343]

Modify Ticket

Action
as closed The owner will remain Gary.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.