Sign in to follow this  
Followers 0
xtrim

is this object active?

8 posts in this topic

Hi,

I'm trying to write a program that displays text and there is a find box above it.

So far so good.

What i am trying to do is only while I'm inside the find box the isPressed() functions

is being called to perform its find procedure in the text.

What I am not able to do so far is to figure if i'm in the input box or not....

any command that I'm missing here like "isthisControlActive"?

tnx :huh2:

Share this post


Link to post
Share on other sites



Look in help file for ControlGetFocus()

Share this post


Link to post
Share on other sites

xtrim,

I would recommend a look at _WinAPI_GetFocus (Retrieves the handle of the window that has the keyboard focus). ;)

Or you might like to look for the $EN_CHANGE message that is sent when you modify the content of an input - like this:

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

GUICreate("Input Monitor", 300, 50, -1, -1)
Global $hInput = GUICtrlCreateInput("", 5, 15, 290)
GUISetState(@SW_SHOW)

GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND")

While GUIGetMsg() <> $GUI_EVENT_CLOSE
WEnd

Func MY_WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)

    Local $iIDFrom = BitAND($wParam, 0xFFFF) ; LoWord
    Local $iCode = BitShift($wParam, 16)     ; HiWord

    If $iIDFrom = $hInput And $iCode = $EN_CHANGE Then

        ConsoleWrite("The Input was modified and now reads: " & GUICtrlRead($hInput) & @CRLF)

    EndIf

EndFunc;==>_WM_COMMAND

Please ask if anything is unclear. :huh2:

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

#4 ·  Posted (edited)

tnx guys :huh2:

Melba23, Your solution seems to work ;)

I don't really understand it...but it is working...

Can you comment on what you did?

Edited by xtrim

Share this post


Link to post
Share on other sites

xtrim,

Read the GUIRegisterMsg tutorial in the Wiki. Come back if you still have questions. :huh2:

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

Look in the help file for GUIRegisterMsg to get a detailed description for GUIRegisterMsg() function.

$wParam is the first message parameter as hex value which will be splitted to high and low word.

The low word of $wParam contains, among other things, the GUI ids which will be saved to $iIDFrom.

The hi word saves the changes made to the controls - here to $iCode.

If the control is the inputbox and when the user has taken an action that may have altered text in the inputbox control then print to console.

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

very niceeeee....

tnx :huh2:

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

One more question (or 2),

How do I set the focus back on the input box once the Selection in the text was made?

And is there and easy way to replace text in RichEditBox?

Edited by xtrim

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