Mouse state with menu items overlapping control

Hi,
I have an issue with retrieving the mouse location using GetGraphCoordsFromPoint...
I am using the return status of GetGraphCoordsFromPoint to determine if the mouse cursor is above the plot area of my graph control (1) or not (0) in order to switch between the mouse styles (VAL_DEFAULT_CURSOR versus VAL_CROSS_HAIR_CURSOR).
It works in most cases...
On top of the panel there is a menu bar, located below is the xy graph. Now, if the mouse opens a menu and is over the menu (and also over the graph) the mouse style depends on mouse history:
If the mouse has always been located over the menu, it is not recognized by GetGraphCoordsFromPoint to be loacted over the graph - which is what I would like to see, in this case the cursor style still is the default style.
Now, if the mouse leaves the menu for a short distance, the menu does not disappear (only if the mouse is at a larger distance) and acccordingly GetGraphCoordsFromPoint realizes that the mouse is over the graph. This is correct and as expected, too.(the mouse style is changed to a cross hair then)
Now, if I move the mouse back over the menu, this is not recognized by GetGraphCoordsFromPoint, unfortunately, and the mouse style is not switched back to default.
Am I missing something, or is there a way to correct this behavior? Having different mouse styles over a menu is confusing for the user and I'd like to avoid that, of course
Thanks....
Solved!
Go to Solution.

Hi Wolfgang,
There isn't a very good way to get around this problem. As you've found, panel move events are sent to the panel's callback even while a menu is being tracked, and when you change the mouse cursor this this also impacts any menu that might be active at the time.
If you don't mind the cursor not changing at all while the menu is active, even if the user moves over the graph, then there is a possible strategy you can pursue to remedy the situation. It consists of trying to detect when a menu is active so that you don't try to change the cursor while the menu is active. Unfortunately, this is easier said than done. Although it's straightforward to be notified whenever a new menu becomes active (via a menu dimmer callback) there is no good way to be notified when the menu goes away. And there are multiple ways in which it can go away. So it it not possible for you to set an internal flag that tracks when the menu is active.
However, it is possible to find out whether the menu is active at the time that you receive the panel move event (or in the timer tick event, although I'm not completely sure why you are also using a timer). You can't do it with the CVI UI library, but you can, using the Windows SDK, in a somewhat round-about way.
The idea is to find out which window is the topmost window. And if it is not the panel window, then you should be able to assume that a menu is active and thus refrain from changing the cursor. Note that you also have to make sure that the active window belongs to your process, since there could be any number of other windows that could be the "topmost" window at any one time. But if it belongs to your process and it is not your panel, then we can assume that it's the menu.
I did a quick test with the following code and it seems to work, although you might want to test it more thoroughly than I did:
topHwnd = GetTopWindow (NULL);
GetWindowModuleFileName (topHwnd, topHwndModule, MAX_PATHNAME_LEN);
GetPanelAttribute (panel, ATTR_SYSTEM_WINDOW_HANDLE, (intptr_t *)&panelHwnd);
GetWindowModuleFileName (panelHwnd, panelHwndModule, MAX_PATHNAME_LEN);
if (!strcmp (topHwndModule, panelHwndModule) && panelHwnd != topHwnd)
    return 0; // don't change the cursor unless the panel really is on top
Good luck,
Luis

Similar Messages

  • HierarchicalDataTemplate with Menu Item

    Hello 
    I have a ObservableCollection with properties: Name, Age, State, City.
    I would like to display the States in Item menu Control, which will have City as child  and Citiy will have Name as Chlid too.
    something like this.
    Menu
    State1 -> City1
    State2      City2 ->   Name1
                     City3        Name2
    I tried to follow this tutorial but I blocks.
    https://zamjad.wordpress.com/2009/12/18/using-hierarchical-data-template-with-menu-item/
    His example works but rather to define the value in the Window1 (), I would like to link value directly to my collection .
    And also I have difficulty in using the HierarchicalDataTemplate on 3 level.
    Can you help me?
    Thanks in advance

    >>I would like to display the States in Item menu Control, which will have City as child  and Citiy will have Name as Chlid too.
    Then you should create three different classes:
    namespace WpfApplication1
    public class State
    public string Name { get; set; }
    public List<City> Cities { get; set; }
    public class City
    public string Name { get; set; }
    public List<Name> Names { get; set; }
    public class Name
    public string FName { get; set; }
    public string LName { get; set; }
    ..and set the ItemsSource of the Menu to a colletion of State objects that are populated with the corresponding cities and names as per the above structure, i.e. you will have to create a new collection of State objects from your existing (type = Name, Age,
    State, City) collection to begin with.
    You can then define the appearance of each type above using DataTemplates. Something like this:
    <Menu xmlns:local="clr-namespace:WpfApplication1">
    <Menu.Resources>
    <HierarchicalDataTemplate DataType="{x:Type local:State}"
    ItemsSource = "{Binding Path=Cities}">
    <TextBlock Text="{Binding Path=Name}"/>
    </HierarchicalDataTemplate>
    <HierarchicalDataTemplate DataType="{x:Type local:City}"
    ItemsSource = "{Binding Path=Names}">
    <TextBlock Text="{Binding Path=Name}"/>
    </HierarchicalDataTemplate>
    <DataTemplate DataType="{x:Type local:Name}">
    <TextBlock Text="{Binding Path=Name}"/>
    </DataTemplate>
    </Menu.Resources>
    </Menu>
    Hope that helps.
    Please remember to close your threads by marking helpful posts as answer and please start a new thread if you have a new question.

  • Updating state of menu items

    In Visual C++ I could write the handler for updating state
    of menu items, which was automatically called
    before menu was open.
    Is there such a mechanism present in Swing,
    or the programmer have to implement such a functionality
    himself?

    JPopupMenu.addPopupMenuListener(...) might be what you are looking for.

  • Set Session State with Shuttle items

    Is it possible to have session state set with each item selected in a shuttle? You have a shuttle with 4 possible options, you select item 2 from the left portion of shuttle and it is moved to the right.. Can you set the session state at that point?
    What I am trying to do is take the session state after change in the control and use it to populate a text field below. The returned values are used in a sql select to populate the text box with a looked up value...
    Thank you,
    Tony Miller
    Ruckersville, VA

    TexasApexDeveloper wrote:
    Won't this just push the last items value in, as apposed to appending the value?
    Tony,
    No. Because for shuttle items the return value is stored as colon delimited string.
    Means after each change you will have a colon delimited string in the session state with selected values(moved to right).
    See this http://apex.oracle.com/pls/apex/f?p=46417:47

  • DVD Menu Items Overlapping?

    Trying to build some DVD Menus, using one of the stock templates in Elements 8. I make minor changes to the text font and size on the Main Menu page and go to preview and get a warning saying some of the menu items are overlapping and to resize or move elements, but even if I made no changes there are text boxes in the template that overlap a background element (a number graphic that looks like a countdown #3) and you can't delete the background element so I'm at a loss. I tried burning a disc anyway, and the program pushed my main title way off to the right.
    Any ideas?

    WebBubba
    I am not clear where you are coming from on this one.
    I will generalize for now since I am not sure what version of Premiere Elements you are looking out...
    Using Premiere Elements 10 Windows to demonstrate the point about overlapping disc menu objects...
    I see amble warning of object overlap that I can correct with the disc menu customization area. And, if I decide to proceed in spite of that and go to Preview, another warning message re-enforces the existing object overlap situation.
    Just how many scene menu pages do you typically deal with? Menu markers are limited to 25 for the Timeline content. The restriction applies to number of markers and not number of disc menu pages.
    I am not seeing the hangup in identifing the object overlap and correcting it before exiting Disc Menu section of the program. Select All Buttons seems a non issue from my point of view since you can clearing see which ones are overlapping.
    ATR

  • Muse crashes with menu item box has no associated page

    My file is crashing when I click on the menu in Master page with a menu error "menu itembox 07012 has no associated page.  Also crashes when I try to add or delete a page anywhere. I believe this started after I deleted a page. The page deleted, but the menu retained the pulldown link. Any thoughts on how I can resolve this?

    I had the same problem today after deleting a page. I posted a question here and saw your problem.
    A little later I decided to delete my main menu and then install a new identical menu. That solved the problem.
    Good luck.
    Paul

  • Possible to change mouse sensitivity with automator?

    For regular computing, I use my magic mouse. For gaming, I use a different mouse with more controls.
    Each time I switch between mice, I have to change the mouse sensitivity under system preferences. I'd like to autmoate this with a hot key. Possible to do with automator?

    OK, found a nifty applescript for this. Just change the 5 in the first line to 0-9, depending on what you want to set the mouse sensitivity to be. I created another script which increases mouse sensitivity. Then I created a hotkey combination to change my mouse sensitivity settings very quickly based on which mouse I'm using.
    If you don't know how to set this script up, follow the instructions in this helpful comment here: https://discussions.apple.com/thread/2488007?start=0&tstart=0. But instead of having the application run in just iTunes, as the comment suggests, have it run in "all applications."
    Here's the script:
    set trackingValue to 5
    --Open and activate System Preferences
    tell application "System Preferences" to activate
    --Attempt to change settings using System Events
    tell application "System Events"
        tell process "System Preferences"
             try
                  --Open the "Keyboard & Mouse" pane
                  click menu item "Mouse" of menu "View" of menu bar 1
                  delay 2
                  set value of slider "Tracking Speed" of window "Mouse" to trackingValue
                  --end tell
             on error theError
                  --An error occured
                  display dialog ("Sorry, an error occured while altering Keyboard and Mouse settings:" & return & theError) buttons "OK" default button "OK"
             end try
        end tell
    end tell

  • Duplications in "Open With" menu

    Sometimes after I upgrade an application, the "Open with" menu item in the Finder lists this application twice. Curiously, it doesn't list the duplication in all accounts. Is there any way I can remove the duplicates?

    Esaheiskanen, looking at the screenshot, I understand that it was removed properly.
    You can simply go to >>>> Go> Utilites> Adobe Installer's and remove the CS6 App installed, Make sure you put a check on "Remove Prefrences" too.
    Alternatively, you run the Creative Cloud Cleaner Tool, to remove the CS6 Version.
    Cheers
    LP

  • Forms 9i Menu Item Open_form

    I have been using Forms 6 by creating a menu with menu item that can call the logical name of form without giving the full path and filename.
    e.g. open_form('maintain_dept');
    as well as
    open_form('c:\dev_r6\maintain_dept.fmx');
    I found that Forms 9i dos not support calling form by logical form name, i.e. open_form('maintain_dept');
    will not work, but
    open_form('c:\dev_r6\maintain_dept.fmx');
    works well. Can anyone tell me how to call form without specifying the full path and filename?

    You simply need the form's FMX to be in your FORMS90_PATH variable. This is set up in the default.env file on your Forms server machine.

  • Adjusting margins between horizontal menu items

    I noticed you can adjust the padding with menu items, but not the margins?  Is there a way to adjust the margins between each menu item ?

    In that case you will need to use images.
    <!DOCTYPE HTML>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>Untitled</title>
    <script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
    <link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css">
    <style>
    ul.MenuBarHorizontal a.line {    background: #EEE url(SpryMenuBarLine.gif) no-repeat 95% 50%; }
    ul.MenuBarHorizontal a.MenuBarItemSubmenu.line{    background: #EEE url(SpryMenuBarDownLine.gif) no-repeat 95% 50%; }
    </style>
    </head>
    <body>
    <ul id="MenuBar1" class="MenuBarHorizontal">
      <li><a class="MenuBarItemSubmenu line" href="#">Item 1</a>
        <ul>
          <li><a href="#">Item 1.1</a></li>
          <li><a href="#">Item 1.2</a></li>
          <li><a href="#">Item 1.3</a></li>
        </ul>
      </li>
      <li><a href="#" class="line">Item 2</a></li>
      <li><a class="MenuBarItemSubmenu line" href="#">Item 3</a>
        <ul>
          <li><a class="MenuBarItemSubmenu" href="#">Item 3.1</a>
            <ul>
              <li><a href="#">Item 3.1.1</a></li>
              <li><a href="#">Item 3.1.2</a></li>
            </ul>
          </li>
          <li><a href="#">Item 3.2</a></li>
          <li><a href="#">Item 3.3</a></li>
        </ul>
      </li>
      <li><a href="#">Item 4</a></li>
    </ul>
    <script type="text/javascript">
    var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
    </script>
    </body>
    </html>
    The images look similar to the following
    and
    I hope this helps.
    Ben

  • Changing background gradient of menu items in TOC

    Hi,
    I know how to edit the playback swf files, but I can't find the TOC files (if there are any).
    I want to delete the gradient present in the default/rollover state for menu items in the table of contents. thanks!

    Hello,
    Which version of Captivate are you using? In CP5 you can change the rollover Text color and the Rollover background color to improve readability. In CP4 you can only change the background color. For both, have a look in the TOC settings.
    Lilybiri

  • Odd cursor over menu items

    This is a really weird problem, but for some reason when I mouse over a menu item for this website, the cursor is either stays as an arrow or a text select, instead of a little pointing hand.  I've never seen this on any of my other BC sites.  Can anyone help me understand why that's happening?  The URL is http://kaoud.businesscatalyst.com.
    Thanks!

    Hi bluefishy3,
    your "links" are technically no links. You have no a-tag defined. It works as a link because you have inline javascript in there:
    <td height="1" width="39" valign="top" style="background: url(&quot;/images/nav_home_over.jpg&quot;) no-repeat scroll 0% 0% transparent;" selcss="nav_selected" selimg="/images/nav_home_over.jpg" onclick="document.location='/index.htm';" id="nav" class="nav_selected" title=""><img height="1" border="0" width="39" alt="" src="http://njcdn.worldsecuresystems.com/CatalystImages/1x1.gif"></td>
    should be roughly something like this to get the pointer cursor working.
    <td height="1" width="39" valign="top"><a style="background: url(&quot;/images/nav_home_over.jpg&quot;) no-repeat scroll 0% 0% transparent;" selcss="nav_selected" selimg="/images/nav_home_over.jpg" href="index.htm" id="nav" class="nav_selected" title=""><img height="1" border="0" width="39" alt="" src="http://njcdn.worldsecuresystems.com/CatalystImages/1x1.gif"></a></td>
    Nicole - BCGurus.com

  • Can Dropdown menu item stay on the "roll over" state while the user's mouse is hoving over the sub

    Can Dropdown menu item stay on the "roll over" state while the user's mouse is hoving over the parent's sub-menus?
    Thanks

    Thanks for the response. My main goal here is to get the drop
    down menu word "Overview" to remain red once it reaches the frame
    "WhoWeAre" or "OurMission" on the main timeline. If I turn the
    button inside the movie clip into an MC to do this, the drop down
    menu no longer works. Any thoughts on how to get this drop down
    menu to do this?

  • How can I change the state of a runtime menu item programati​cally?

    Using LabView 6.1, I would like to change the state of the runtime menu item "Operate/Print at completion".
    The goal here is to print the VI front panel according to the operator choice (OK ->print, Cancel ->don't print)
    In a first release, I put a Stop function at the dialog output (activated by the cancel button) but this function stop the complete application and my idea where to stop only the VI in which the dialog is running.
    In a second release, I've tried to use the "Application
    control/Menu" but I receive every time an error:
    Error 88 occured at Cannot modify application menu item in the printtest.vi.
    Possible reasons: LabView, Runtime menu error...
    Any suggestion is appreciated.
    Re
    gards,
    phidu

    Instead of using the print at completion option, print the VI programatically if the user selects to print...open a reference to the VI you want to print and use an invoke node to print vi to printer.
    Alternatively create another VI with a layout optimized for printout, set it to print at completion and run and load the data into that VI if and only if the user OKs the print...
    Mads
    MTO

  • Menu item moves in active state

    I'm using the "Right Icon" to implement a long vertical seperator between menu items:
    laurensilverceramics.businesscatalyst.com
    I've deleted the Rollover, Mouse-Down and Active states of the menu items.  But when a menu item becomes active - it move put by 20 pixels or so.  Any idea on how I can fix this?

    Hi Ryan,
    From looking at the navigation on the site and the corresponding code, it seems you are using a Composition Widget rather than a Menu Widget. The code generated for the Industries link is different than the others as if in its case, the link was applied to chunks of text/content inside the trigger rather than the trigger itself. Recreating that particular item in the composition and applying link just like others should apparently fix this. I would appreciate if you could send your current .muse file to [email protected] along with a reference to this forum thread and mark it to my attention in the Subject? If the file is larger than 20MB, please use an online file sharing service such as WeTransfer or YouSendIt.
    Cheers,
    Vikas

Maybe you are looking for

  • Facebook city/town no longer showing on status update?

    Phone ios is up to date, app is up to date, location services are on. I have to manually add the city I am in, does anyone know how to make it so this loads automatically again?

  • How do i convert a pdf to word doc so i can make changes?

    how do i convert pdf to word doc using the trial download?

  • Is there a way to know what report is being processed ?

    In XI R2 / Webi Report Server, or XI 3.x / Webi Processing Server, is there a way to know what object is being processed ? For example currently, I can see thru system tool like "Process Explorer" that "wireportserver.exe" has been using a lot of CPU

  • Informatica parent child mapping

      down votefavorite I have a scenario where suppose saycountry      province      city      zip ind           ts           hyd       xyz ind          maha          mum       abc Desired output:id   name         parent-id 1    india         1 2    tel

  • Pentax DSmobile 600 with Image Capture only sayd "No paper loaded..."

    I was using Paperless to scan documents, but Paperless is not fully working on Snow Leopard yet. I re-installed the Pentax DSmobile 600 TWAIN driver tonight, but I still cannot scan documents into my Mac. If I select "Flatbed" as the Scan Mode, I can