Sign in to follow this  
Followers 0
Inververs

Notification of clicking on edit

8 posts in this topic

How to register the event when the Input control is pressed in my GUI?

In EditConstants.aus no such Notifications const

I want to use the input as a hyperlink

label control is not suitable as should be possible to edit the text.

Share this post


Link to post
Share on other sites



Odin,

I have never found a way of registering a click on an input control. The best I have come up with is to use "Enter" to indicate that the data entry is complete - as you are probably using the keyboard to enter the data in the first place, it is not too much of a restriction: :mellow:

#include <GUIConstantsEx.au3>

Main()

Func _Main()

    $hGUI = GUICreate("Test", 500, 500)

    Local $hInput = GUICtrlCreateInput('', 10, 10, 200, 20)

    GUISetState()

    ; Set an accelerator key to mark the end of the data input
    Local $hDum = GUICtrlCreateDummy()
    Local $accels[1][2] = [["{ENTER}", $hDum]]
    GUISetAccelerators($accels)

    While 1
        Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hDum
            MsgBox(0,"Input Ready", GUICtrlRead($hInput))
        EndSwitch
    WEnd

EndFunc   ;==>_Main

I hope this helps.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

Thank you, Melba23

But this is not what I need, just pressing the mouse button should trigger the event.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Odin,

I say again:

I have never found a way of registering a click on an input control.

M23

Edit: But someone else might. :mellow:

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

This is actually pretty easy. There's two methods I can think of:

1) Monitor the EN_SETFOCUS notification, which is sent to the parent window via WM_COMMAND. So, GuiRegisterMsg($WM_COMMAND... However this will not work if the input control already has focus (or is the only control in the GUI). If you have more controls and focus is being moved to the input and you really only need this notification one time, then this is certainly viable and would be my first choice.

2) Check for the $GUI_EVENT_PRIMARYDOWN or $GUI_EVENT_PRIMARYUP event using GUIGetMessage in advanced mode or GUIOnEventMode with GUIGetCursorInfo to find out what control the mouse has clicked.

Edited by wraithdu

Share this post


Link to post
Share on other sites

wraithdu,

I like the second way - but it is a bit roundabout.

Although you seem to be specialising in that sort of code lately! :mellow:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

All thanks.

I did so:

#include <GUIConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 633, 447, 192, 124)
$Input1 = GUICtrlCreateInput("Input1", 232, 184, 121, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
GUICtrlSetCursor (-1, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $GUI_EVENT_PRIMARYUP
            $aMouse_Info=GUIGetCursorInfo ( $Form1 )
            Switch $aMouse_Info[4]
                Case $Input1
                    MsgBox(0,0,"Click")
                Case Else
            EndSwitch
    EndSwitch
WEnd
Edited by Odin

Share this post


Link to post
Share on other sites

Yeppers, that'll do it.

@Melba23

Thanks :mellow:

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