General XMetaL Discussion

  • Qing

    Refresh Tool Bar

    Participants 2
    Replies 3
    Last Activity 8 years, 10 months ago

    Hi all,
    We are customizing on the XMetal Author Essential to add some new buttons to the tool bar, which need validation to decide some are enable and some are not.
    Recently, we find that, after the validation completed, the enabled buttons will never effect until a selection change event (e.g. mouse click in other element).

    I am wondering do you know any api or macro to refresh the tool bar to make the validation result effect?
    Thank you all in advance.

    Reply

    Derek Read

    Reply to: Refresh Tool Bar

    The On_Update_UI event is normally used to disable macros (they are always enabled unless disabled) using the DisableMacro API. I think you should look at the logic you have in place inside this event to see if it is incorrectly disabling a macro associated with a toolbar button. For a detailed description of how it works with toolbars see the XMetaL Developer Programmer's Guide topic called “When the context changes”.

    There are no other useful events or APIs that I can think of that you would be using. But if you need further assistance I think it would be best for you to send your customization to XMetaL Support to have them look at it. Without knowing what you are doing I don't think anyone would really be able to guess what's causing your issue.

    Reply

    Qing

    Reply to: Refresh Tool Bar

    Thank you Derek.
    I may didn't describe my question clearly. My question is not how to disable the buttons, but to enable them.

    The DisableMacro disable the buttons in the beginning for they are enable in default, and when I want to enable them, I attempt to use PushInMacro, but the reality is that PushInMacro seems not enable them. So my confusion is how to enable the button when I want to?
    The handle macro of a button just do some binding the OnButtonClick, like this: OnButtonClick(controlId).

    Thank you very much.

    Reply

    Derek Read

    Reply to: Refresh Tool Bar

    The default state for a toolbar button is to always be enabled when associated with a macro that exists. The default state is also not to be “pushed in” (it should be drawn like a regular pushable button).

    If your toolbar button is disabled and you are not calling DisableMacro in On_Update_UI for the macro associated with it then the only possibility I can think of is that the macro is unavailable. When a macro is not available but a toolbar button is associated with it then that toolbar button is disabled.

    Change your macro so that it has a shortcut key associated with it and run it using the shortcut key, or change the hidden property to “false” and then look for it in the Macros toolbar. If you can't access the macro these ways then I suspect there is something wrong with the MCR file that is stopping the macro from loading. It could be a scripting error (in which case I would recommend debugging) or the file might be corrupted. XMetaL is fairly robust when loading customization files but it is possible to break portions of an MCR file so that some things inside it load and others do not.

    Reply

  • You must be logged in to reply to this topic.

Lost Your Password?

Products
Downloads
Support