Sign in to follow this  
Followers 0
brokenfox

Losing mouse with showlistbox of combobox

4 posts in this topic

I have a combobox and have it setup (GUIREGISTERMSG) so that every time it has an edit_update event that it forces the listbox open. However every time I the list box opens due to this event occurs (_GUICtrlComboBox_ShowDropDown($hWndUpdated, True)) I lose my mouse cursor. It is still there if I move my mouse around on other windows, but if on my app's window there is no cursor. It will however still highlight things in the listbox, just without a cursor but I can't see where to click other controls in my window. This problem only occurs when the code forces the box open, if I comment out the line I never lose my cursor and if I force the dropbox open with a mouse click I don't lose it.

Any ideas?

Sorry if this has been covered but I searched as much as I could in regards to losing mouse pointer.

Share this post


Link to post
Share on other sites



Try adding a bit of code to dup the issue.

I would setup a Debug hotkey to,

Func CheckMouse()
$IDs = StringSplit("AppStarting|Arrow|Cross|Help|IBeam|Icon|No|" & _
"Size|SizeAll|SizeNESW|SizeNS|SizeNWSE|SizeWE|UpArrow|Wait", "|")
$IDs[0] = "Unknown"
$cursor = MouseGetCursor()
MsgBox(4096, "ID = " & $cursor, "Which means " & $IDs[$cursor])
EndFunc

To see what your mouse is doing then go from there.


[Cheeky]Comment[/Cheeky]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Try adding a bit of code to dup the issue.

Sorry, took a while to strip it all down, but this is very basic and recreates the problem:

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

Opt("GUIOnEventMode", 1)

Global $midClear=False

; Main Form
$frmMain = GUICreate("Main", 475, 418, 192, 124)
$lblInstance = GUICtrlCreateLabel("Instance:", 8, 16, 48, 17)
$cmbInstance = GUICtrlCreateCombo("", 64, 8, 153, 25)

_GUICtrlComboBox_AddString($cmbInstance,"A")
_GUICtrlComboBox_AddString($cmbInstance,"B")
_GUICtrlComboBox_AddString($cmbInstance,"C")
_GUICtrlComboBox_AddString($cmbInstance,"D")

GUISetState(@SW_SHOW, $frmMain)
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

While 1
    Sleep(100)
WEnd

Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg
    Local $hWndFrom, $iIDFrom, $iCode, $hWndCombo
    $hWndFrom = $ilParam
    $iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word
    $iCode = BitShift($iwParam, 16) ; Hi Word
    Switch $hWndFrom
        Case GUICtrlGetHandle($cmbInstance)
            Switch $iCode
                Case $CBN_EDITUPDATE ; Sent when the edit control portion of a combo box is about to display altered text
                    _cmb_EditUpdate($hWndFrom)
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_COMMAND

Func _cmb_EditUpdate($hWndUpdated)
    If Not $midClear Then
        $setTo = _GUICtrlComboBox_GetEditText($hWndUpdated)
        _GUICtrlComboBox_BeginUpdate($hWndUpdated)
        _GUICtrlComboBox_ShowDropDown($hWndUpdated, True)
        _GUICtrlComboBox_SetEditText($hWndUpdated, $setTo)
        _GUICtrlComboBox_EndUpdate($hWndUpdated)
    EndIf
EndFunc   ;==>_cmb_EditUpdate

Basically, as described before: run it, type a letter in the edit box of combo box, and cursor disappears.

Oh, and when the cursor is lost, your debug code says "0 which means unknown".

Edited by brokenfox

Share this post


Link to post
Share on other sites

Any ideas anyone?

Share this post


Link to post
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
Sign in to follow this  
Followers 0