Sign in to follow this  
Followers 0

Text of StatusBar depending on the Menu Focus

7 posts in this topic

Hi together

The general target of my posting is to get an answer of the question:

"How can a user get some information depending on the menu item focus?"

You know, you scroll with your mouse (or the keys) over some menu items and depending,

where you are, you get some additional information (tooltip, statusbar or ???).

At first, I tried it with GUICtrlSetTip on GUICtrlCreateMenuitem, but I learned, that this

is not possible in principle.

Then I though about a way to use the StatusBarText for the additional information, but

I cannot find any method how to get the information, which menuitem has actually the focus?

So, has anybody here any idea, how to provide additional information to the user,

depending on the menuitem, which has the focus?

I thank you for any hints


Share this post

Link to post
Share on other sites

Or if mouse is over a control as well. Looking forward to solution to this.

Share this post

Link to post
Share on other sites


maybe the mouseHoover udf helps out.

Search for it in S&S

So long,


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post

Link to post
Share on other sites

not sure if the following will help or not

Got it working with my app and using the mousehover.au3.

What I found is my app has 2 guis (2 seperate exe). What I found is that if the 2 windows are over lapped then the statusbar will populate when the mouse is over a control (regardless if the window is focus or not). Need to put a check to make sure the window is in focus first.

Share this post

Link to post
Share on other sites

Thank you for wising me to _MouseHover.au3.

It seems to be very close to my needs. I will

try it out and report here about the results.


Share this post

Link to post
Share on other sites

Hi together

meanwhile I tried two different methods, how to get the text of the statusbar dependend of the focus

(mouse over) of the menu entry (following the hints in the replies so far, for which I again say thank you).

The first method uses to register $WM_MENUSELECT, which is for my feeling a very simple and clear

method. And it is really easy to bring that to work.

The second method uses an AdlibEnable, which also works, but is a bit more complex in all. So my

solution uses the GUIRegisterMsg-Method.

But there is one point, which is a bit odd, and that's the reason, because I want to give a short report here

about my results: the _main_ menu entry didn't work at once and needed a separate handling.

See for example the code:

;register $WM_MENUSELECT

GUIRegisterMsg($WM_MENUSELECT, "MouseOverMenu")

; built an example menu

$mainmenu_1 = GUICtrlCreateMenu ("file")

$firstmenu_1 = GUICtrlCreateMenuitem ("number 1", $mainmenu_1)

$secondmenu_1 = GUICtrlCreateMenuitem ("number 2", $mainmenu_1)

$mainmenu_2 = GUICtrlCreateMenu ("another thing")

$firstmenu_2 = GUICtrlCreateMenuitem ("number 1", $mainmenu_2)

$secondmenu_2 = GUICtrlCreateMenuitem ("number 2", $mainmenu_2)


; remember all the handles for later use

$remembercontrol[0] = $mainmenu_1; <<<--- see below, must be = 0

$remembercontrol[1] = $firstmenu_1

$remembercontrol[2] = $secondmenu_1

$remembercontrol[3] = $mainmenu_2; <<<--- see below, must be = 1

$remembercontrol[4] = $firstmenu_2

$remembercontrol[5] = $secondmenu_2


;and somewhere later in the Function "MouseOverMenu":

Func MouseOverMenu($hWndGUI, $MsgID, $WParam, $LParam)

for $i = 0 to 5; simple notation

if (BitAnd($WParam, 0xFFFF) == $remembercontrol[$i]) then

... ; now you are ready and you can write an individual text to the status bar




This all will work perfectely only for the _sub_ menu entries, but NOT for the

_main_ menu entries! Why?

If you watch the $WParam values for the _main_ menu entries,

you will see, that you get the numbers 0, 1, 2, 3 and so on. BUT THAT


So, what is to do? A dirty trick helped me: Simply overwrite the

$remembercontrol values for the main menu entries with the successively

numbers 0, 1, 2, 3 ...:

$remembercontrol[0] = 0; for $mainmenu_1

$remembercontrol[3] = 1; for $mainmenu_2

and so on

That's all

Problem solved

Have a good time


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