Results 1 to 5 of 5

Thread: Cannot add a simple button

  1. #1
    Join Date
    Oct 2007
    Posts
    3
    Rep Power
    8

    Default Cannot add a simple button

    Hello anyone.

    i'm encountring difficulties in adding a button. i would like to create my own button over a Dialog. (i have an existing code of a dialog, and just want to add new button). i've tried what "sondor" wrote you on the forum, and i get a JS error. can anyone help me please ?
    my new addition to my existing code is:

    var myButton = new DwtButton(this.getShell());
    myButton.setText("blablabla");
    this.dlg.setButtonListener(myButton , new AjxListener(this, this._dialogOkListener));

    and i want to add it into an existing function:
    Com_Zimbra_Webdialer.prototype._showDnldDlg =
    function (ev) {
    this._initDnldDlg();
    var dialog_args = {title:"Webdialer component missing", view:this._DnldDlgView};
    this.dlg = this._createDialog(dialog_args);
    this.dlg.setButtonVisible(DwtDialog.CANCEL_BUTTON, false);
    this.dlg.setButtonListener(DwtDialog.OK_BUTTON, new AjxListener(this, this._dialogOkListener));
    this.dlg.popup();
    };

    This is mostly urgent
    Thank in advance.

    Ariel

  2. #2
    Join Date
    Nov 2005
    Posts
    477
    Rep Power
    9

    Default

    Quote Originally Posted by relrel View Post
    Hello anyone.

    i'm encountring difficulties in adding a button. i would like to create my own button over a Dialog. (i have an existing code of a dialog, and just want to add new button). i've tried what "sondor" wrote you on the forum, and i get a JS error. can anyone help me please ?
    my new addition to my existing code is:

    var myButton = new DwtButton(this.getShell());
    myButton.setText("blablabla");
    this.dlg.setButtonListener(myButton , new AjxListener(this, this._dialogOkListener));

    and i want to add it into an existing function:
    Com_Zimbra_Webdialer.prototype._showDnldDlg =
    function (ev) {
    this._initDnldDlg();
    var dialog_args = {title:"Webdialer component missing", view:this._DnldDlgView};
    this.dlg = this._createDialog(dialog_args);
    this.dlg.setButtonVisible(DwtDialog.CANCEL_BUTTON, false);
    this.dlg.setButtonListener(DwtDialog.OK_BUTTON, new AjxListener(this, this._dialogOkListener));
    this.dlg.popup();
    };

    This is mostly urgent
    Thank in advance.

    Ariel
    Can you please post the exact javascript error?

    If you are trying to add behavior to a existing dialog box, try this:

    this.dlg = dlg;
    dlg.setButtonListener(DwtDialog.OK_BUTTON,
    new AjxListener(this, function() {
    // do stsuff here.
    }));

    If you are adding a button to a toolbar try this:
    this.dlg = dlg;
    dlg.setButtonListener(DwtDialog.OK_BUTTON,
    new AjxListener(this, function() {
    debugger;
    dlg.popdown();
    var props = this._acctEditor.getProperties();

    for (i=0; i< props.todo_items.length; i++)
    {
    var task_text = "" + props.todo_items[i];
    this._tasklistctl.quickSave(task_text);
    }
    dlg.dispose();
    }));

  3. #3
    Join Date
    Oct 2007
    Posts
    3
    Rep Power
    8

    Default JS error and more

    Hi.
    thank you for the quick response.
    I've already undeployed the zimlet with the JS error but it was something like:
    the error was to the next line:
    it was for that line:
    var myButton = new DwtButton(this.getShell());

    and was something like:
    error on line xxx...this.getShell()); is not recognized.

    to clarify more: i'm trying to add my own button (i want the button's label to be "Install") to an existing Dialog with an "OK" button already in it.
    I can send you the whole JS file is possible through email.

    Thank you once again.

    REL

  4. #4
    Join Date
    Oct 2007
    Posts
    3
    Rep Power
    8

    Default 1 more thing

    One more comment:
    just for the record, i've written in Js before, but i just entered this Zimlet stuff 3 days ago, so the syntax isn't so clear to me.
    thank you

  5. #5
    Join Date
    Nov 2005
    Posts
    477
    Rep Power
    9

    Default

    Quote Originally Posted by relrel View Post
    Hi.
    thank you for the quick response.
    I've already undeployed the zimlet with the JS error but it was something like:
    the error was to the next line:
    it was for that line:
    var myButton = new DwtButton(this.getShell());

    and was something like:
    error on line xxx...this.getShell()); is not recognized.

    to clarify more: i'm trying to add my own button (i want the button's label to be "Install") to an existing Dialog with an "OK" button already in it.
    I can send you the whole JS file is possible through email.

    Thank you once again.

    REL
    My suspcision is that you arn't calling the right getShell. In any case, it makes sense to do the right OO think here. Subclass one of the DwtDialog classes, and add your button there (if it is not a already existing Zimbra Dialog box). If it's a existing Zimbra dialog, Use getShell on that, grab the DIV and then reparent the button inside ofthe container DIV.

Similar Threads

  1. need advice on configuring zimbra to work with fax server
    By pheonix1t in forum Administrators
    Replies: 0
    Last Post: 07-11-2007, 07:46 PM
  2. Zimbra + Samba LDAP, cannot add winxp
    By fajarpri in forum Installation
    Replies: 4
    Last Post: 07-08-2007, 11:45 AM
  3. Replies: 1
    Last Post: 02-20-2007, 12:49 AM
  4. Admin Panel add domain finish button broken
    By tomicles in forum Developers
    Replies: 2
    Last Post: 10-08-2005, 10:09 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
  •