Yeah, but actually, commands are really much more complicated than they need to
be. Why do they need to be an entire node? You ought to be able to do
something simpler like say:
<handler event="${lz.keys.keycombo(['control', 'c'])}"
enabled="classroot.haswindowfocus">[*]
...
</handler>
i.e., eliminate the useless intermediate node. Am I missing something? Is
there any use for the command being a whole node? Wouldn't you really want to
just tie a key combo event directly to a handler (or method)?
---
[*] This is using my hypothetical `event` property of <handler> that would let
you create handlers that can be dynamically attached to any event, without
having to resort to Javascript. Also, I expose the `enabled` property of a
handler.
See http://jira.openlaszlo.org/jira/browse/LPP-7816
On 2010-02-13, at 17:00, Henry Minsky wrote:
> Hey that is cool, I didn't know about that feature. That's actually a use
> of
> a constraint that had not really occurred to me. I think about states as
> being used
> to enable methods, but if you use that idiom of tying an enabled flag to a
> constraint,
> it is sort of like a state.
>
>
>
> On Sat, Feb 13, 2010 at 3:13 PM, P T Withington <[email protected]> wrote:
>
>> I think it should work for you to say:
>>
>> <command ... active="${classroot.haswindowfocus}">
>>
>> meaning the command will only be active (and hence will only execute) if
>> the window it belongs to has focus.
>>
>> On 2010-02-13, at 11:30, cem sonmez wrote:
>>
>>> sorry for the previous post, this the complete one :
>>>
>>> talking about this testcase.
>>>
>>> <canvas debug="true" width="100%" height="300">
>>> <debug width="350" height="200"/>
>>> <class name="myWindow" extends="window" width="150" height="100" >
>>> <command name="keyCommand" key="['Enter']">
>>> <handler name="onselect">
>>> Debug.write(classroot.name + " Enter command");
>>> </handler>
>>> </command>
>>> </class>
>>>
>>> <class name="myWindow2" extends="window" width="150" height="100" >
>>> <command name="keyCommand" key="['Enter']">
>>> <handler name="onselect">
>>> Debug.write(classroot.name + " Enter command");
>>> </handler>
>>> </command>
>>> </class>
>>>
>>> <simplelayout/>
>>> <myWindow name="win1" title="window 1"/>
>>> <myWindow2 name="win2" title="window 2"/>
>>> </canvas>
>>>
>>> when i hit the enter button on canvas, both of the onselect events are
>> being
>>> called. Is it possible to make this call just for the selected window.
>>> If it is not : this means that, it is not allowed to implement more than
>> two
>>> roles for each key command, isnT it ?
>>>
>>> Regards
>>> --
>>> Cem SONMEZ
>>
>>
>>
>
>
> --
> Henry Minsky
> Software Architect
> [email protected]