Tell When a WebToolbarMenu is displayed?

Hey gang,

Is there a way to know if a WebToolbarMenu’s menu item is displayed but a selection has not been made? The WebToolbar.Action event fires after the user makes a selection. I would like to know when the WebToolbar button is pressed to display the menu but before an item as been selected. The ButtonAction event only fires on WebToolbarButtons.

Or is there a way to determine if a WebMenuItem is displayed on the screen? They don’t show up in the Window’s list of controls…

[quote=219522:@Jon Ogden]Hey gang,

Is there a way to know if a WebToolbarMenu’s menu item is displayed but a selection has not been made? The WebToolbar.Action event fires after the user makes a selection. I would like to know when the WebToolbar button is pressed to display the menu but before an item as been selected. The ButtonAction event only fires on WebToolbarButtons.

Or is there a way to determine if a WebMenuItem is displayed on the screen? They don’t show up in the Window’s list of controls…[/quote]

Use the WebPage MouseDown event ; if it happens within the toolbar button, it means the user has clicked it, and you can safely assume the menu is displayed. The catch is to be able to locate the said button, which I am afraid you will have to do by capturing the screen and look at the picture. I looked at the code in the browser, the button has no left property.

Yeah, that’s what I thought. Unfortunately MouseDown doesn’t work because it still doesn’t help for what I need because I don’t know where they clicked. And if they are navigating a menu the button is not pressed at that time either.

And the MouseExit event fires even if they are navigating a menu created by the control.

[quote=219593:@Jon Ogden]Yeah, that’s what I thought. Unfortunately MouseDown doesn’t work because it still doesn’t help for what I need because I don’t know where they clicked. And if they are navigating a menu the button is not pressed at that time either.

And the MouseExit event fires even if they are navigating a menu created by the control.[/quote]

What do you mean you don’t know where they clicked ? MouseDown gives you X and Y.

The alternative is looking in the DOM for the state of XojoMenu, which changes when the menu is displayed. JavaScript again…

Yes. But there’s no width property of the buttons. So you don’t necessarily know where you are at. While I could “guess” based upon how I have things coded, I’m looking for a more universal method.

You can get the information in JavaScript.

I will not code it for you this time to see that discarded later like the where method. Look in the DOM with the Developer Tools within the XojoMenu element. This is the menu itself, which state changes when it is visible.

I really liked your where method and I appreciate your help on that. But if it breaks other functionality as Greg suggested it might then I don’t think it’s a good idea.

Still I’m not entirely happy with things right now so I may go back to your code.

So please don’t be offended.

After Greg objected saying it would prevent Xojo functions, I modified the code and tested to make sure it did not hinder anything, but you seem not to have noticed.

For the menu thing, I told you where to look for.

OK. I have found the code in the DOM where the change is when it is visible…

<div id=?"XojoMenus" onmousedown=?"Xojo.menus.dismissAllMenus(0)?" style=?"visibility:? visible;? display:? none;?">?

Becomes:

<div id=?"XojoMenus" onmousedown=?"Xojo.menus.dismissAllMenus(0)?" style=?"visibility:? visible;? display:? block;?">

So what JavaScript magic can I use to get this value. Keep in mind, the last time I did any programming in JavaScript was over 5 years ago and it was not browser related…So I don’t pretend to know anything about how to do this…

[quote=219661:@Michel Bujardet]After Greg objected saying it would prevent Xojo functions, I modified the code and tested to make sure it did not hinder anything, but you seem not to have noticed.
[/quote]

Wow. You are really bent out of shape over this. I didn’t notice that you said it wouldn’t interfere. I did see where you talked about hacking the DOM which is not something I’m interested in.

Forget it. If you are that sensitive about stuff I don’t want your help.

[quote=219663:@Jon Ogden]For the menu thing, I told you where to look for.
Forget it. If you are that sensitive about stuff I don’t want your help.[/quote]

Now you are offended because I told you where to look ? Now you are offended because I tried to help ?

Have some fresh air, would you ? No good deed goes unpunished, hey ?

[quote=219666:@Michel Bujardet]Now you are offended because I told you where to look ? Now you are offended because I tried to help ?

Have some fresh air, would you ?[/quote]

No. I’m not offended at all. I found where the change happens. Now I just need to figure out how to read that in some fashion. I’m somewhat miffed by the fact you are bent out of shape because I didn’t use your code. You even admitted that you ended up hacking the DOM (I just went back and read the post) and you admitted that if Xojo changes the framework later on at some point, the it could break the code. So forgive me if I don’t want to spend time deploying something that could be broken down the road at some point.

Whatever.

Whatever, indeed.

Moving on. I can’t figure out what needs to be done to access/read the values in the DOM. No time. Too much else to do. Maybe someday if I can find a good, in-depth tutorial on how to do this, then great. But there’s not a single Xojo example of using javascript let alone getting values from the page. So I can spend a Saturday trying to figure this out and get more and more frustrated or I can move on to other things.

I was hoping someone could give me a little more help but since I’m communicating with just one guy who doesn’t want to offer any more, I’m stuck. There’s very scant published resources on doing this sort of thing…Oh well.