Test if menu is visible?

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • Hello,

    Is it possible to test if the menu is visible?

    I don't mean the menu bar (File Edit etc), I mean can I test if the user has clicked the menu bar and any of the drop down menus are visible?

    Thank you :)

  • I tried that and there didn't appear to be away.

    It is a real problem for me.

    When the user moves the cursor over buttons (in top left hand corner of my application), a tooltip appears explaining the use of the button. Problem is, when the "File" or "Edit" menu is open, the tooltips because the cursor is over the buttons but the menu is open at the same time and it looks horrible.

  • Using the tooltips object, when the cursor is overlapping the active object which is my button.

    Please login to see this picture. Please login to see this picture.

    The problem is when the button is hidden by the menu, the tooltip still appears when the cursor is over it and it looks wierd/ugly/stupid etc...

    Any whacky work around suggestions are welcome :)

  • Two things:

    1) You normally detect this because Windows sends a message when the mouse enters the button. If something else covers the button (e.g. a menu) then Windows doesn't send that message. So in a C program this kind of thing is easy.

    2) If you are using something that is drawn, as opposed to a real Windows control (i.e. you are using an Active System Box instead of a Button) then you don't get the messages, because you're not a control. So to do the tooltip effect, you have to constantly check the position of the mouse, and if it's in the same area as your button then you show the tooltip... even if there's something in front of the button.

    Your problem is number 2.

    The easiest fix is to insert a Window Control object and use the 'Window has focus?' condition. When the menu is selected, the window in which the playfield is drawn does *not* have focus, so you shouldn't display a tooltip.

  • Thank you ChrisB, that is exactly the kind of answer I was after. Only thing, it doesn't work. When the menu is selected, the window still has focus.

    Based on what you said about windows not detecting a button under a menu, I figured I'd try it with the standard MMF button object but this didn't work either. Only because I was still using the tooltip object to display the tooltip and doing so if the mouse was over the button (which is still true when the menu is covering it).

    However, using the built in tooltip feature of the standard MMF button object, it does work as you described. When the button is hidden by a menu or any other windows object (edit box, list, etc) the built in tooltip does not display. Which is good!

    Problem is, I want pictures as my buttons and if you switch the button object type from "Test Push Button" to "Bitmap Push Button", then you are no longer able to assign a tooltip.

    However, you can still use have a tool tip if you use "Text and Image Push Button", and it is possible to shrink the button size so that only your image is visible. The problem with this is when you put your cursor over the button there is an ugly flicker and the actual button is visible for a short moment.

    So back to square one. Any other suggestions for checking if the menu is visible?

  • Okay, that's weird - I tried it myself and it does exactly what I expected.

    This is not because my suggestion works; I had left the 'Run while resizing' box unticked in the runtime options. This stops the application whenever you resize the window, or have a menu open.

    I have no suggestions for you using the stock objects, but if you don't need the application to do anything while the menu's open or you're resizing it, you might like to investigate that option.

  • Unfortunately, I need my application to run while it is resizing. I have an edit box that resizes to whatever size the window is, and if "Run while resizing" is unchecked, then it doesn't resize until after you stop resizing the window and it looks ugly. Thank you for your help though.

    I guess MMF just isn't the program to create what I am trying to make. :(

  • I must be missing something. I made a simple active and gave it a tooltip when the mouse is over it. I checked "Run while resizing" and "Run when Minimized" and I don't see the tooltip when the menu is open.

    _____________________________________________
    Please login to see this link. -Need extensions? Send me a PM.-

  • It's slightly fudgey, but this should work...

    It will detect menu open if the window is being dragged or resized too, but that shouldn't be an issue as you wouldn't want to display tooltips then anyway.

    I hope it helps :)

    Please login to see this attachment.

  • I looked at your app Chris, and the same exact events I had in my blank app, still show the tooltips in yours. I think it has to do with the cursor object, but I haven't narrowed it down yet.

    Edit: Please login to see this link. :)

    _____________________________________________
    Please login to see this link. -Need extensions? Send me a PM.-

  • Thanks Simon and Stephen.

    Your example is great, but when I copy the events into my app they it doesn't work. The object doesn't even flash. I'll let you know if I find out why.

    EDIT: My mistake. I didn't have -1637700 in global value B.

    But it would still be interesting to know why, Stephen, your events don't work in my app.

    Edited once, last by ChrisBurrows (April 19, 2012 at 3:39 PM).

  • I just realised an even bigger and much more serious problem that this solves!

    Not only were the tooltips coming up when they shouldn't, but if the user clicked a menu option and a button was underneath, the button would be clicked.

    All working now. Thanks everybody.

    Btw Stephen, why -1637700?

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!