Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Zimlets

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-22-2007, 05:58 PM
New Member
 
Posts: 3
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
Reply With Quote
  #2 (permalink)  
Old 10-22-2007, 06:59 PM
Zimlet Guru & Moderator
 
Posts: 467
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();
}));
Reply With Quote
  #3 (permalink)  
Old 10-23-2007, 01:08 AM
New Member
 
Posts: 3
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
Reply With Quote
  #4 (permalink)  
Old 10-23-2007, 02:38 AM
New Member
 
Posts: 3
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
Reply With Quote
  #5 (permalink)  
Old 10-24-2007, 12:55 PM
Zimlet Guru & Moderator
 
Posts: 467
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.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.