Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    SmartClient 6.5.1 Addendum: Support for setTabIcon() / setTabProperties()

    Support for an API to update the icon for a TabSet's Tab has been requested.
    This feature, along with a more generic "setTabProperties()" API for performing applying an arbitrary set of properties to an existing tab will be part of SmartClient release 7.0
    In the meantime this addendum will add these APIs to SmartClient version 6.5.1

    Documentation for the new APIs:

    method tabSet.setTabIcon()
    Changes the icon for a tab
    param tab (Tab | number | ID) tab to update
    param icon (SCImgURL) new icon

    method tabSet.setTabProperties()
    Apply properties to an existing tab in a tabSet.
    param tab (Tab | number | ID) Identifier for the tab to be modified
    param properties (object) Javascript object containing the set of properties to be applied to the tab.

    Code:
    //----------------------------------------------------------------------------
    // Isomorphic SmartClient 6.5.1 addendum
    // Purpose: Add support for setTabIcon() and setTabProperties() APIs scheduled to be part 
    // of SmartClient core functionality as of version 7.0
    // 
    // Applies to SmartClient 6.5.1 build only
    //----------------------------------------------------------------------------
    if (window.isc && isc.version.startsWith("6.5.1/")) {
    if (isc.TabSet) {
    
    isc.TabSet.addProperties({
    
    setTabTitle : function (tab, title) {
        this.getTabObject(tab).title = title;
        this.getTab(tab).setTitle(title);
        // reset the menu to pick up the new title
        this.resetTabPickerMenu();
    },
    
    setTabIcon : function (tab, icon) {
        this.setTabProperties(tab, {icon:icon});
    },
    
    setTabProperties : function (tab, properties) {
        if (!properties) return;
        
        if (properties.ID != null) {
            this.logWarn("setTabProperties(): Unable to modify ID for an existing tab - ignoring " +
                        "this property");
            delete properties.ID;
        }
        
        if (properties.pane != null) {
            this.updateTab(tab, properties.pane);
            delete properties.pane;
        }
        if (properties.disabled != null) {
            this.setTabDisabled(tab, properties.disabled);
            delete properties.disabled;
        }
        
        var tabObject = this.getTabObject(tab),
            tab = this.getTab(tab);
        if (!tabObject) return;
        isc.addProperties(tabObject, properties);
        
        if (tab) {
            tab.setProperties(properties);
        }
        
        this.resetTabPickerMenu();
    },
    
    resetTabPickerMenu : function () {
        if (this.$8d) {
            this.$8d.destroy();
            delete this.$8d;
        }
    }
    });
    
    
    }
    } else if (window.isc) {
      isc.Log.logWarn("Addendum for SmartClient 6.5.1 build included in this application. " +
                "You are currently running SmartClient verion '"+ isc.version + 
                "'. This patch is not compatible with this build and will have no effect. " +
                "It should be removed from your application source.");
    
    }
    
    // End of addendum
    // ------------
Working...
X