Sign in to follow this  
Followers 0
schuc

[SOLVED] Edit control isn't getting focus from Mouse click (only TAB)

3 posts in this topic

#1 ·  Posted (edited)

Hi All

I have been trying to debug why I'm not able to click on my edit controls. I was debugging this for a while because I thought I had some bug in my code where I disabled the control or something, but couldn't find it.

It turns out that I can give the control focus if I TAB to it...I can't click on it though to give it focus. This sounds to me like not having the style attributes right. I've been looking at them and don't see one specifically for allowing focus via mouseclick.

Any ideas or thoughts are welcome!

Thanks.

Edited by schuc

Share this post


Link to post
Share on other sites



I figured it might help everyone to have a simple code example. Nothing magic here... just a gui with two edit controls. Note that you can tab between them and edit their contents. However, you can't click on a control with the mouse to change the contents...

#include <GUIConstantsEx.au3>
#include <EditConstants.au3>

GUICreate("My GUI")  ; will create a dialog box that when displayed is centered

$EMBED_Detail1 = GUICtrlCreateEdit("Edit", 10, 10, 400, 17, BitOR($GUI_SS_DEFAULT_EDIT, $GUI_SS_DEFAULT_INPUT)) ; This bitor is only for testing...trying to make the field mouse clickable
$EMBED_Detail2 = GUICtrlCreateEdit("Edit", 10, 30, 400, 17)

GUICtrlSetData($EMBED_Detail1, "My text here...")

GUISetState()       ; will display an empty dialog box with a combo control with focus on

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()

    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd

Share this post


Link to post
Share on other sites

I'm going to mark this as solved...

My problem was that I was effectively trying to use an Edit Control as a single line edit. I believe when I was clicking on it, focus was going to line two or something that I could not visually see.

The solution in my case here was to use Input controls - GUICtrlCreateInput()

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