MapInfo Pro Developers User Group

 View Only
  • 1.  MapBasic Help-File Sample-Code for creating Ribbons not up-to-date

    Posted 12-01-2021 06:25
    Edited by Stefan Hausmann 12-01-2021 09:47
    Hi there,

    just started to play around with your new possibilities to create ribbons without diving into .NET-stuff,
    and found, that the sample code, provided with the mapbasic help file seems to be outdated, - or i just dont get this...

    The first Statement:

    Create Ribbon Tab "ControlsTab" Caption "MapTab"
    Active Index 2
    Properties(PROPERTY_ISTRACKED : "True", PROPERTY_TOOLTIP : "This is a Tab ToolTip", PROPERTY_KEYTIP : "Z") ...

    doesn't produce a tool-tip. If you change it to

    Create Ribbon Tab "ControlsTab" Caption "MapTab"
    Active Index 2
    Tooltip "This is a Tab ToolTip"
    Properties(PROPERTY_ISTRACKED : "True", PROPERTY_KEYTIP : "Z") ....

    it works.

    What does this common-property PROPERTY_TOOLTIP do?
    And why is there a PROPERTY_TOOLTIPTEXT ?

    regards
    Stefan


  • 2.  RE: MapBasic Help-File Sample-Code for creating Ribbons not up-to-date

    Employee
    Posted 12-02-2021 11:47
    Edited by Bob Fortin 12-02-2021 16:05
    Hi Stefan,

    The tooltip syntax description is correct.

    TOOLTIP_CLAUSE

    { Remove | { tooltiptext | ( PROPERTIES_CLAUSE ) } } 
    • Remove the tool tip.
    • tooltiptext sets the value of the tool tip.
    • PROPERTIES_CLAUSE sets the properties of the tab as defined in the RibbonControls.def file.

    The simple syntax just creates a simple tooltip with a string, which works fine.
    The more advanced syntax lets you create a tooltip object with the same properties as the built in controls:

    eg: ToolTip(PROPERTY_TOOLTIPTEXT : "text", PROPERTY_TOOLTIPDISABLEDTEXT: "disabled text")

    Unfortunately a bug crept into our parsing that our automation missed for the advanced syntax -- I will try to get a fix into a localized release if I can. ISSUE: MIPRO-122900

    Usually when you try to set a property that does not exist you get an error saying so. In this example you tried:

    Create Ribbon Tab "ControlsTab" Caption "MapTab"
    Active Index 2
    Properties(PROPERTY_ISTRACKED : "True", PROPERTY_TOOLTIP : "This is a Tab ToolTip", PROPERTY_KEYTIP : "Z")
    The property "ToolTip" does exist but we do not support setting it from a string. I think your point is valid that since we can do this with the syntax token ToolTip "text" that we should also support it this way. I will look into it.

    --- tooltip properties---

    'IRibbonToolTip see the ExtensibilityReference for the list of properties you can set, including these: (pasted below)
    Define PROPERTY_SHOWHELPTEXT "ShowHelpText" 'logical
    Define PROPERTY_SHOWSIMPLETOOLTIP "ShowSimpleToolTip" 'logical
    Define PROPERTY_SHOWONDISABLED "ShowOnDisabled" 'logical
    Define PROPERTY_TOOLTIPDESCRIPTION "ToolTipDescription" 'string
    Define PROPERTY_TOOLTIPDISABLEDTEXT "ToolTipDisabledText" 'string
    Define PROPERTY_TOOLTIPTEXT "ToolTipText" 'string


    The IRibbonToolTip type exposes the following members.

    Properties


     

    Name

    Description

    Public property

    HorizontalOffSet

    offset relative to Placement

    Public property

    Placement

    Where to place the tooltip

    Public property

    ShowHelpText

    Show tooltip help text or not.

    Public property

    ShowOnDisabled

    Show tooltip even when command is disabled.

    Public property

    ShowSimpleToolTip

    Show simple tooltip or not.

    Public property

    ToolTipDescription

    Main tooltip text. Brief description. List Shortcut key in parenthesis.

    Public property

    ToolTipDisabledText

    Text displayed only when command is disabled.

    Public property

    ToolTipText

    Longer text describing command

    Public property

    VerticalOffSet

    offset relative to Placement


    Another thing that is not clear is how to get these tooltip advanced properties.
    Getting "ToolTip" just returns the text as a convenience. To get specific properties use the object.property syntax:

    Create Ribbon Tab "ControlsTab" Caption "MapTab" Active Index 1 ToolTip "This is a ToolTip"
    Print RibbonInfo("ControlsTab", "ToolTip")
    Print RibbonInfo("ControlsTab", "ToolTip.ToolTipText")
    Print RibbonInfo("ControlsTab", "ToolTip.ShowOnDisabled")

    results:
    This is a ToolTip
    This is a ToolTip
    T



    ------------------------------
    Bob Fortin
    Software Architect and Distinguished Engineer
    MapInfo Pro Development Team
    ------------------------------



  • 3.  RE: MapBasic Help-File Sample-Code for creating Ribbons not up-to-date

    Posted 12-03-2021 10:52
    Hi Bob,

    thank you for the elaborated answer, - makes things much clearer to me.

    Have a nice weekend
    Stefan