General XMetaL Discussion

XMetaL Community Forum General XMetaL Discussion Insert Table functionality

  • pooh2583

    Insert Table functionality

    Participants 0
    Replies 1
    Last Activity 9 years, 6 months ago


    In xmetal there is a functionality of inserting a table into an xml document,which is present in built in xmetal,  but icon for insert table is enabled only when it has (selection location)a valid location for adding a table in the location otherwise it is disabled.

    I wnt to have a functionality where clicking on insert table icon(which will be enebled all the time) it will find a proper location to insert a table and then the small window apears which asks to enter no. of rows and columns and header in the table.

    How to achieve this functionality?

    please reply



    Derek Read

    Reply to: Insert Table functionality

    I think you will need to create a macro and hook it up to a button or menu item.

    The logic in the macro will depend on exactly what you want to accomplish but at minimum you would probably call FindInsertLocation() and you'll probably want to check if it succeeded. If it succeeded then you can have it launch Table > Insert Table, or you could have it launch your own custom insert table dialog.

    To launch the built-in Insert Table function, and assuming the Table menu hasn't been modified, you could call it like this:

    // XMetaL Script Language JSCRIPT:
    var mainMenu = Application.CommandBars.item("Menu bar");
    var tableMenu= mainMenu.Controls.item("Table");
    var insertTableCmd = tableMenu.Controls.item(1);

    To launch it from the Table toolbar, and assuming the Table toolbar hasn't been modified, you could call it like this:

    // XMetaL Script Language JSCRIPT:
    var tableToolbar = Application.CommandBars.item("Table");
    var insertTableCmd = tableToolbar.Controls.item(1);

    Those are just quick examples. To be robust (some users do change menus and toolbars around — unless you have disabled that feature) you might implement code that sets the “insertTableCmd” based on looking for the actual menu item's title (probably “Insert &Table…”).

    For info on launching your own custom dialog (XFT) see CreateFormDlg() in the Programmers Guide.


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

Lost Your Password?