Jump to content

Possible _GUICtrlComboBox_GetEditText UDF Bug?


 Share

Recommended Posts

Melba, I'm sorry for your suicidal tendencies....

I added your mod to my code:

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

Global $iMemo

for $I = 1 to 1
    Example()
Next

Func Example()
    Local $hCombo

    ; Create GUI
    GUICreate("ComboBox Get Edit Text", 400, 296)
    $hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
    $iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
    GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
    GUISetState()


    ; Set Edit Text

        for $j = 1 to 10
            $cData=""
            for $k = 1 to $j
                $cData=$cData&"x"
            next
            _GUICtrlComboBox_SetEditText($hCombo, $cData)
            MemoWrite("Edit Text: " & _GUICtrlComboBox_GetEditText_Mod($hCombo))
            ConsoleWrite("======================================="&@LF)
            ConsoleWrite("Edit Text UDF: " & _GUICtrlComboBox_GetEditText_Mod($hCombo)&@LF)
            ConsoleWrite("Edit Text def: " & GUICtrlRead($hCombo)&@LF)
            ConsoleWrite("Length UDF: " &stringlen(_GUICtrlComboBox_GetEditText_Mod($hCombo))&@LF)
            ConsoleWrite("Length def: " &stringlen(GUICtrlRead($hCombo))&@LF)
            ConsoleWrite("Last Char is: " &StringRight(_GUICtrlComboBox_GetEditText_Mod($hCombo),1)&@LF)
            ConsoleWrite("Last Char is: " &AscW (StringRight(_GUICtrlComboBox_GetEditText_Mod($hCombo),1))&@LF)
;~          AscW ( "char" )
        Next



    ; Get Edit Text




    ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>Example

; Write a line to the memo control
Func MemoWrite($sMessage)
    GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite



Func _GUICtrlComboBox_GetEditText_Mod($hWnd)
    If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd)

    Local $tInfo
    If _GUICtrlComboBox_GetComboBoxInfo($hWnd, $tInfo) Then
        Local $hEdit = DllStructGetData($tInfo, "hEdit")
        Local $iLine = 0
        Local $iIndex = _SendMessage($hEdit, $__COMBOBOXCONSTANT_EM_LINEINDEX, $iLine)
        Local $iLength = _SendMessage($hEdit, $__COMBOBOXCONSTANT_EM_LINELENGTH, $iIndex)
        If $iLength = 0 Then Return ""
        Local $tBuffer = DllStructCreate("short Len;wchar Text[" & $iLength & "]") ; <<<<<<<<<<<<<<<<<<<<<<<<<<<< removed + 2
        DllStructSetData($tBuffer, "Len", $iLength) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<< removed + 2

        Local $iRet = _SendMessage($hEdit, $__COMBOBOXCONSTANT_EM_GETLINE, $iLine, $tBuffer, 0, "wparam", "struct*")
        If $iRet = 0 Then Return SetError(-1, -1, "")

        Local $tText = DllStructCreate("wchar Text[" & $iLength & "]", DllStructGetPtr($tBuffer)) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<< removed + 1
        Return DllStructGetData($tText, "Text")
    Else
        Return SetError(-1, -1, "")
    EndIf
EndFunc   ;==>_GUICtrlComboBox_GetEditText_Mod

I hope that was the intention.

The result is:

>"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "E:\1work\dummy2.au3" /UserParams    
+>00:13:56 Starting AutoIt3Wrapper v.2.1.2.9    Environment(Language:0407  Keyboard:00000407  OS:WIN_7/Service Pack 1  CPU:X64 OS:X64)
-> Skipping AU3check: Current version doesn't support the AutoIt3 v 3.3.9.5+ syntax.
>Running:(3.3.9.21):C:\Program Files (x86)\AutoIt3\autoit3.exe "E:\1work\dummy2.au3"    
--> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop
=======================================
Edit Text UDF: x
Edit Text def: x
Length UDF: 1
Length def: 1
Last Char is: x
Last Char is: 120
=======================================
Edit Text UDF: xx
Edit Text def: xx
Length UDF: 2
Length def: 2
Last Char is: x
Last Char is: 120
=======================================
Edit Text UDF: xxx
Edit Text def: xxx
Length UDF: 3
Length def: 3
Last Char is: x
Last Char is: 120
=======================================
Edit Text UDF: xxxx
Edit Text def: xxxx
Length UDF: 4
Length def: 4
Last Char is: x
Last Char is: 120
=======================================
Edit Text UDF: xxxxx
Edit Text def: xxxxx
Length UDF: 5
Length def: 5
Last Char is: x
Last Char is: 120
=======================================
Edit Text UDF: xxxxxx
Edit Text def: xxxxxx
Length UDF: 6
Length def: 6
Last Char is: x
Last Char is: 120
=======================================
Edit Text UDF: xxxxxxx
Edit Text def: xxxxxxx
Length UDF: 7
Length def: 7
Last Char is: x
Last Char is: 120
=======================================
Edit Text UDF: xxxxxxxx
Edit Text def: xxxxxxxx
Length UDF: 8
Length def: 8
Last Char is: x
Last Char is: 120
=======================================
Edit Text UDF: xxxxxxxxx
Edit Text def: xxxxxxxxx
Length UDF: 9
Length def: 9
Last Char is: x
Last Char is: 120
=======================================
Edit Text UDF: xxxxxxxxxx
Edit Text def: xxxxxxxxxx
Length UDF: 10
Length def: 10
Last Char is: x
Last Char is: 120

The screenshot of the mod function.

post-35896-0-14421000-1385939328_thumb.p

So it works and now a bug should be created, right? (was not sure about your last sentence)

Edited by Tankbuster
Link to comment
Share on other sites

  • Moderators

Tankbuster,

I will raise the ticket today - and bring it to the attention of the Dev team. :)

M23

Edit: #2550

Edited by Melba23

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

  • Moderators

Tankbuster,

The UDF function is exactly the same in the release and Beta versions, so it makes no difference which one you use. The discussion as to whether the code will be changed is ongoing - look in the next Beta to see the result. ;)

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