In general I try to keep codesize small - in this particular example it
might not matter as much. So a solution for this particular situation
would be to use as many QxCommands as I have buttons?
As all these Commands might then call one single function in turn
(sending the event to the server) I would still like to find a more
effective solution.
Being able to identify the triggering component would allow this.
Sebastian, given your suggestion would I be right to assume that the
answer to my initial question is No - I cannot identify the
QxmenuButton in an eventhandler? Could you confirm please so I can
concentrate on a different solution.
(I am working on a framework and I feel that this simple* functionality
might be required quite often: processing certaint events in central
functions which can do their job if they know who called).
* I am saying simple here thinking that an interpreter language wouldn't
really have that much trouble knowing the identifer of an object - I
might be wrong though. As I mentioned I am rather new to JS.
Thanks for answering.
Regards - Ralf
Sebastian Werner wrote:
Why do you want to use the same commands? QxCommand was thought to be
used for a single command, not a group a command. You can use QxCommand
also to define shortcuts like "CTRL+C" for example. You couldn't really
use this feature if you share one QxCommand instance for multiple commands.
Sebastian
Ralf Wenske schrieb:
I don't think that helps as I don't know the hash code on the server.
I would have to create a hash table connecting the code and the object
name when creating the object.
I was hoping that maybe if such a table existed already, then I could
translate the hash code back to the original object name the servers
knows about. Does anyone know if that might be the case?
Thanks - Ralf
Kirill Balyasnikov wrote:
Try to use toHashCode() function. Qooxdoo generates unique id for
each widget. For example:
this.debug( "Execute: " + e.getData().toHashCode() );
Maybe this will help you
Ralf Wenske пишет:
this might be a javascript question (not yet my native language) :)
is it possible to retrieve the object name from inside an eventhandler?
Example: ToolBar_3.html
var c1 = new QxCommand();
c1.addEventListener("execute", function(e) {
this.debug("Execute: " + e.getData().getLabel());
});
var m1 = new QxMenu;
var mb1_01 = new QxMenuButton("New", null, c1);
var mb1_02 = new QxMenuButton("Open", null, c1);
var mb1_03 = new QxMenuButton("Save", null, c1);
Instead of the label I would like to access the name (id?) of the
button eg: mb1_02 .
I have managed to retrieve the hashCode - can that be used to
determine the object name? I want to avoid having to use UserData
just to determine which button was clicked (in this example).
It ought to be really simple - I've tried a lot but seem to miss the
obvious...
Can anyone help please?
Thanks - Ralf
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting
language
that extends applications into web and mobile media. Attend the live
webcast
and join the prime developer group breaking into this new coding
territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting
language
that extends applications into web and mobile media. Attend the live
webcast
and join the prime developer group breaking into this new coding
territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting
language
that extends applications into web and mobile media. Attend the live
webcast
and join the prime developer group breaking into this new coding
territory!
http://sel.as-us.falkag.net/sel?cmd=k&kid0944&bid$1720&dat1642
_______________________________________________
Qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live
webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
Qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel