MapInfo Pro Developers User Group

Welcome to the MapInfo Pro Developers community!  We are a group dedicated to the discussion and understanding of MapBasic and .Net MapInfoPro AddIn development. Bring your questions and ideas here. This group includes several members of the Pro development team from around the world.

Please feel free to start a discussion in the discussion tab or join in a conversation.

Product Information  Ideas Portal  MapInfo Community Downloads

Discussions

Members

Resources

Events

 View Only
  • 1.  Can you detect if a user has 'right clicked' the mouse in an active map window within the layout designer?

    Posted 01-10-2018 15:48

    We've added some buttons/menus to the mini toolbar for use within a normal map window but we do not want these appearing if a user has activated a map window within the Layout designer.

    I can use the winfocusedhandler to detect if it is the map window in the layout designer that has focus but I'm not sure how to prevent the mini toolbar from showing.

    Is there a .Net or mapbasic command available that could be accessed that detects the right click and then something to hide or prevent the mini toolbar from showing for this window only?

    Using MB16 and MIv16

    Thanks

    David



  • 2.  RE: Can you detect if a user has 'right clicked' the mouse in an active map window within the layout designer?

    Posted 01-16-2018 07:28

    With .NET extensibility you can turn-off visibility of Mini toolbar.

    For Map Mini toolbar you can do by executing the following statement

    IMapInfoPro.ContextMenus.MapMiniToolBar.Visible = false;

     

    And for Layout Mini toolbar you can do by executing the following statement

    IMapInfoPro.ContextMenus.LayoutMiniToolBar.Visible = false;

    Please note, once you set the Visible property to False, Mini toolbar will no longer be visible, until you set the Visible property back to True.

    Thanks,

    Rajesh Gupta



  • 3.  RE: Can you detect if a user has 'right clicked' the mouse in an active map window within the layout designer?

    Posted 01-16-2018 08:06

    Rajesh, Many thanks for the answer.

    Is the mini toolbar independent of the window then? As currently if a map window is floating it has its own ribbon. So we have prevented the windows from floating so we only have one ribbon. But I'll give it a go and experiment.

    Cheers

    David



  • 4.  RE: Can you detect if a user has 'right clicked' the mouse in an active map window within the layout designer?

    Employee
    Posted 01-16-2018 17:27

    ?We do have MapMouseDown and MapMouseUp events where you can check which button has been clicked. I tried this but the context menu still showed for me.

     

    MapInfoEvents.MapWindowMouseDown += (o,e) =>

                        {

                              if(e?.MouseButton == MouseButton.Right)

                              {

                                     // Check if object is selected

                                     e.Handled = true;

                              }

                        };



  • 5.  RE: Can you detect if a user has 'right clicked' the mouse in an active map window within the layout designer?

    Posted 01-17-2018 03:30

    Thanks,

    Following Rajesh message, I saw the 'SetIMapMiniToolBarVisible' in the IMapInfoPro.def So I've actually added a procedure into Peter's Ribbonlib code, that I call from the winfocuschangedhandler. Also that way it is still all in MapBasic- which at the moment is easier for me to do.

    sub ShowHideMiniToolBar(byval lVisible as logical)

     call SetIMapMiniToolBarVisible(theMapMTB,lVisible)

    End Sub

    I was going to add it into the RBNControlSetVisibilityThs, but I don't think there isn't a 'ControlType Enumeration' code for the miniToolbar yet and I thought it best not to change too much of that in case Peter releases new versions.



  • 6.  RE: Can you detect if a user has 'right clicked' the mouse in an active map window within the layout designer?

    Employee
    Posted 01-22-2018 02:41

    Thanks David,

    I have now updated the RIBBONLib on Github with these new procedures all based on your suggestions:

    - RBNNotificationShowAtCursor(...) for showing Notification at cursor location

    - RBNMapMTBSetVisibility(...): for setting visibility of Map Mini Toolbar

    - RBNMapMTBGetVisibility() As Logical: for getting visibility of Map Mini Toolbar

     

    I have also improved the unloading of controls in RBNClearCustomRibbonElements. Where it earlier took around 30-60 secs to unload 400 controls, it now only takes1 sec

     

    Thank you for your support in improving the RIBBONLib



  • 7.  RE: Can you detect if a user has 'right clicked' the mouse in an active map window within the layout designer?

    Posted 01-22-2018 03:26

    Hi Peter,

    Many thanks I’ll download them and replace what I’d modified.

    Regards

    David