Jim
On 11/14/06, Aaron Cooper <[EMAIL PROTECTED]> wrote:
Thanks Sebastian,
Working now. I think this would fall into option #2, but it's not exactly
extending Button.
For the archive and anyone else as green as me, here is what I did:
/****************************************************************************
/* Logout Button
/***************************************************************************/
function logoutButton(name) {
var btnLogout = new qx.ui.form.Button("Logout", "icon/16/decrypted.png");
btnLogout.setRight(5);
btnLogout.setBottom(5);
btnLogout.name = name;
btnLogout.addEventListener("execute", function(e) {
// Run ajax process for logout - I'm using SACK which I included before
this code
ajax.requestFile = "ajax/logout.php";
ajax.method = 'get';
ajax.> ajax.> ajax.runAJAX();
});
return btnLogout;
}
And then I use this on the widows by:
// Custom Logout Button
myLogoutButton = new logoutButton('hw_logout');
Window.add(myLogoutButton);
Cheers
Aaron
----- Original Message -----
From: "Sebastian Werner" <[EMAIL PROTECTED]>
To: "qooxdoo Development" <[email protected] >
Sent: Tuesday, November 14, 2006 7:30 PM
Subject: Re: [qooxdoo-devel] Reusing a button
> You have many options:
>
> #1: Cloning the button
>
> #2: Write an own class which extends Button. Add the event listeners and
> styling into the constructor for example. Then create instances from
> this class instead of Button.
>
> #3: To extract the command part, it's better to create a instance of
> qx.client.Command , attach the stuff there and connect all Commands with
> the Button instances (buttonInstance.setCommand(commandInstance))
>
> I would suggest #2 or #3 because they perform best. You can combine #2
> and #3, too.
>
> Sebastian
>
>
> Aaron Cooper schrieb:
>> Hi all,
>>
>> I've got a button (well several actually) that I want to use on multiple
>> windows of my app. In this case it's for logging out:
>>
>> /****************************************************************************
>> /* Logout Button
>> /***************************************************************************/
>> var btnLogout = new qx.ui.form.Button("Logout", "icon/16/decrypted.png");
>> btnLogout.setRight(5);
>> btnLogout.setBottom(5);
>> btnLogout.name= 'logoutButton';
>>
>> btnLogout.addEventListener("execute", function(e) {
>> // Run ajax process for logout
>> ajax.requestFile = "ajax/logout.php";
>> ajax.method = 'get';
>> ajax.>>> ajax.>>> ajax.runAJAX();
>> });
>>
>> // Actions to take when a logout has bee completed
>> function whenLogoutComplete() {
>> if(ajax.response == 1) {
>> currentWindow.close();
>> loginBox.open();
>> currentWindow = loginBox;
>> } else {
>> alert('Logout Failed');
>> }
>> }
>>
>> // Only a serious error will kick this (e.g. PHP file missing)
>> function whenLogoutError() {
>> alert('There has been a backend error while logging out - Please
>> contact Us');
>> }
>> /****************************************************************************
>> /* END Logout Button
>> /***************************************************************************/
>>
>> Don't worry too much about the code itself, as it works fine.
>>
>> What I want to do be able to use multiple instances of this button
>> whereever I want. At the moment, even if I add the button to more than
>> one window, it will only display on the last one it was added to.
>>
>> I'm reading up on OO and prototyping as I havn't done this aspect of JS
>> before, and can only guess that it's the key to what I want.
>>
>> I was wondering if anyone had any guidence on the this sort of thing
>> please?
>>
>> Cheers
>> Aaron
>>
>>
>> ------------------------------------------------------------------------
>>
>> -------------------------------------------------------------------------
>> Using Tomcat but need to do more? Need to support web services, security?
>> Get stuff done quickly with pre-integrated technology to make your job
>> easier
>> Download IBM WebSphere Application Server v.1.0.1 based on Apache
>> Geronimo
>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> qooxdoo-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ qooxdoo-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
