MapInfo Pro Developers User Group

 View Only
  • 1.  overlap activate/deactivate

    Posted 01-22-2025 13:42
    Edited by Peter Møller 01-23-2025 05:49

    Hi

    I have a button that draws a polygon, by default it does not overlap with the rest of the objects, how can I make a button that activates or deactivates the overlap?

    Thank you

    Dim btnRegionM as This
    
      btnRegionM = MICtrlCollAddStrStrInt(EielControlColManzana, "Poligono", "Polígono", ControlType_ToolButton) 'ControlTypes are defined in Enums.def
      Call SetRbnToolBtnCtrlDrawMode(btnRegionM, DM_CUSTOM_POLYGON) 'DrawModes are define din Icons.def
      Call SetRbnToolBtnCtrlCallingHandler(btnRegionM, "Manzanas")
      Call SetRbnToolBtnCtrlCursor(btnRegionM, "3")
      Call SetRbnToolBtnCtrlIsLarge (btnRegionM, TRUE)
      Call SetRbnToolBtnCtrlLargeIcon(btnRegionM
                 , New_Uri("pack://application:,,,/MapInfo.StyleResources;component/Images/Layout/insertPolygonRegion_32x32.png", 0))



    ------------------------------
    Mayca González Pérez
    COMUNIDAD. AUT. REG MURCIA
    ------------------------------



  • 2.  RE: overlap activate/deactivate

    Employee
    Posted 01-29-2025 02:07

    Hey Mayca

    I'm not quite sure I understand what you are trying to achieve.

    Are you trying to control if the drawn polygon can overlap an existing polygon or if it should get erased by potential overlapping polygons?

    In DrawTools, I have tools that add area to an existing polygon or remove area from an existing polygon. Maybe this can be helpful to see the code of these?

    Look for the Sub DTRegionAdd and Sub DTRegionRemove in the DrawTools.mb.

    Or is the question more about adding a toggle button to the ribbon that controls how your tool behaves?

    In the WindowHelper tool, I add a button to the ribbon and make it a togglebutton: Call RBNControlToggleIdx(nCtrlIdx, TRUE)

    nCtrlIdx = RBNGroupAddButton("btnSelInfoHandler", "Show Info", "", sTabName, sGroupName)
    If nCtrlIdx > 0 Then
       Call SELINFOSetControlIndex(nCtrlIdx)
       Call RBNControlToggleIdx(nCtrlIdx, TRUE) 'This what makes the button a togglebutton
       Call RBNControlSetToolTipIdx(nCtrlIdx, PRGIGetApplicationName(), "Enable/disable Show Info", "")
       Call RBNControlSetIconsIdx(nCtrlIdx, CONTROL_SIZE_SMALL, "", PATH_IMAGES & "InfoSelHandler_32x32.png")
       Call RBNControlSetCustomMBXHandlerIdx(nCtrlIdx, "SELINFOSwitchDisplay")
    End If



    ------------------------------
    Peter Horsbøll Møller
    Principal Presales Consultant | Distinguished Engineer
    Precisely | Trust in Data
    ------------------------------



  • 3.  RE: overlap activate/deactivate

    Posted 01-31-2025 05:42

    Ok.

    Gracias.



    ------------------------------
    Mayca González Pérez
    COMUNIDAD. AUT. REG MURCIA
    ------------------------------