Results 1 to 2 of 2

Thread: [SOLVED] Creating Multiple Buttons?

  1. #1
    Join Date
    Sep 2006
    Location
    Illinois
    Posts
    374
    Rep Power
    9

    Default [SOLVED] Creating Multiple Buttons?

    Hi,

    I need to have this Zimlet have three buttons with three different actions. Right now this code just shows an OK button with a label of "Close", and when you click it the popup closes.

    Code:
    dlg.getButton(DwtDialog.OK_BUTTON).setText("Close");
        dlg.setButtonVisible(DwtDialog.CANCEL_BUTTON, false);
        // dlg.setButtonListener block is optional; you can use it to augment the default OK button handler 
        // (popdown, dispose) to do interesting things like set a flag somewhere that the user has been notified, etc. 
        // As it is below, it duplicates the default OK button handler.
        dlg.setButtonListener(DwtDialog.OK_BUTTON, new AjxListener(this, function() {
            dlg.popdown();
            dlg.dispose();
        }));
    I need to have three buttons. One called "More Info" that opens a webpage, one called "Change Password" that opens a second webpage, and the third as it is now, just a button labeled "Close" that closes the dialog.

    Thanks,
    Matt

  2. #2
    Join Date
    Mar 2008
    Location
    Stanford, CA
    Posts
    15
    Rep Power
    7

    Default

    Create the extra buttons before you create the dialog, with something like this:

    Code:
    myzimlet.prototype.setupDialog = 
    function() {
        var infoButtonId = Dwt.getNextId();
        this._infoButton = new DwtDialog_ButtonDescriptor(infoButtonId, "More Info");
        var chpassButtonId = Dwt.getNextId();
        this._chpassButton = new DwtDialog_ButtonDescriptor(chpassButtonId, "Change Password");
    
        this._dlg = new DwtDialog({parent: ..., title: '...', standardButtons: [DwtDialog.DISMISS_BUTTON], extraButtons: [this._infoButton, this._chpassButton]});
    
        this._dlg.setButtonListener(infoButtonId, new AjxListener(this, this.dlgButtonHandler, "info"));
        this._dlg.setButtonListener(chpassButtonId, new AjxListener(this, this.dlgButtonHandler, "chpass"));
        this._dlg.setButtonListener(chpassButtonId, new AjxListener(this, this.dlgButtonHandler, ""));
    };
    
    myzimlet.prototype.dlgButtonHandler = 
    function(action) {
        this._dlg.popdown();
        this._dlg.dispose();
        switch (action) {
            case "info":
                window.open(infoURL, "More Info");
                break;
            case "chpass":
                window.open(chpassURL, "Change Password");
                break;
        }
    };

Similar Threads

  1. Replies: 2
    Last Post: 08-04-2009, 04:12 AM
  2. [SOLVED] Edit Button in Documents Gray After Upgrade
    By weathertation in forum Administrators
    Replies: 10
    Last Post: 05-14-2008, 01:47 PM
  3. Replies: 6
    Last Post: 12-07-2007, 09:35 AM
  4. 4.0.4 to 4.5.6 upgrade failed in network edition
    By chenthil in forum Administrators
    Replies: 1
    Last Post: 08-27-2007, 10:36 AM
  5. [SOLVED] Simple backup question...
    By dameron in forum Administrators
    Replies: 3
    Last Post: 08-25-2007, 10:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •