Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how can show a help picture when mouse on a textbox.

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
ho-kou
131 Views, 3 Replies

how can show a help picture when mouse on a textbox.

hi, everyone

 

I want to show a help picture when mouse on  a textbox like the picture.

eg. when mouse move on Tool Orientation, the help picture will be showed. 

Thank your for your help.

 

hokou_1-1699406308195.png

 

3 REPLIES 3
Message 2 of 4
kandennti
in reply to: ho-kou

Hi @ho-kou -San.

 

For TextBoxCommandInput, it seems that HTML formatting tags can be used in the tooltipDescription property.

https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-fd65f2ef-ad50-4888-900c-3daa169133a8 


I made a sample here.

# Fusion360API Python script

import traceback
import adsk
import adsk.core as core

_app: core.Application = None
_ui: core.UserInterface = None
_handlers = []

CMD_INFO = {
    'id': 'kantoku_test',
    'name': 'test',
    'tooltip': 'test'
}


class MyCommandCreatedHandler(core.CommandCreatedEventHandler):
    def __init__(self):
        super().__init__()

    def notify(self, args: core.CommandCreatedEventArgs):
        core.Application.get().log(args.firingEvent.name)
        try:
            global _handlers
            cmd: core.Command = core.Command.cast(args.command)
            cmd.isOKButtonVisible = False

            onDestroy = MyCommandDestroyHandler()
            cmd.destroy.add(onDestroy)
            _handlers.append(onDestroy)

            inputs: core.CommandInputs = cmd.commandInputs
            txtIpt: core.TextBoxCommandInput = inputs.addTextBoxCommandInput(
                'txtIpt',
                'test',
                '-',
                1,
                False,
            )
            txtIpt.tooltip = "tooltip"
            txtIpt.tooltipDescription = "<h1>tooltipDescription</h1>"

        except:
            _ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))


class MyCommandDestroyHandler(core.CommandEventHandler):
    def __init__(self):
        super().__init__()

    def notify(self, args: core.CommandEventArgs):
        core.Application.get().log(args.firingEvent.name)
        adsk.terminate()


def run(context):
    try:
        global _app, _ui
        _app = core.Application.get()
        _ui = _app.userInterface

        cmdDef: core.CommandDefinition = _ui.commandDefinitions.itemById(
            CMD_INFO['id']
        )

        if not cmdDef:
            cmdDef = _ui.commandDefinitions.addButtonDefinition(
                CMD_INFO['id'],
                CMD_INFO['name'],
                CMD_INFO['tooltip']
            )

        global _handlers
        onCommandCreated = MyCommandCreatedHandler()
        cmdDef.commandCreated.add(onCommandCreated)
        _handlers.append(onCommandCreated)

        cmdDef.execute()

        adsk.autoTerminate(False)

    except:
        if _ui:
            _ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

 

The execution result is here. When the mouse cursor is hovered over TextBoxCommandInput for a certain period of time, tooltipDescription is displayed.

1.png

Message 3 of 4
ho-kou
in reply to: ho-kou

hi @kandennti 

Thank you verymuch for your code.

Message 4 of 4
ho-kou
in reply to: ho-kou

Succeeded to use toolClipFilename to show picture.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report