[Laszlo-user] Adding event handlers to color picker
P T Withington
ptw at pobox.com
Wed Oct 10 04:47:23 PDT 2007
Oh, and in the DHTML runtime, the CSS color parser is probably the
identity function.
On 2007-10-10, at 07:46 EDT, P T Withington wrote:
> Is there a bug to add a runtime CSS color parser? I thought Oliver
> contributed one?
>
> On 2007-10-09, at 19:19 EDT, Henry Minsky wrote:
>
>> The color mappings are confusing ; the compiler does some
>> substititions at
>> compile time, but otherwise, at runtime a color has to be an INTEGER.
>> We happen to bind "red" and "blue" and a few other globals, but don't
>> depend on that. In your example, changing to a var instead of a
>> string:
>>
>> textobject.setAttribute('fgcolor',red) // no quotes around red
>>
>> would work , because it's a global, but better for runtime code to
>> use integers
>> textobject.setAttribute('fgcolor',0xff0000)
>>
>>
>> On 10/9/07, Mike Pence <mike.pence at gmail.com> wrote:
>>> I was able to just use the implicit on* events created for each
>>> attribute
>>>
>>> so...
>>>
>>> <handler name="onmike" reference="a1">
>>>
>>> ...in my client object is fired when the setAttribute('mike'... is
>>> called on object a1. Simple enough. The confusion came from the fact
>>> that objects inside of a tab seem not to be instantiated until that
>>> tab is clicked. Once I take the referenced object out of the
>>> concealed
>>> tab, all is well. Is there a way to tell it to load all objects
>>> in the
>>> tabs explicitly?
>>>
>>> Also, why does textobject.setAttribute('fgcolor','red') not work and
>>> change the fgcolor of lzText object red? Is there some refresh
>>> method
>>> that must be called?
>>>
>>> Thanks in advance.
>>>
>>> Mike Pence
>>>
>>> On 10/9/07, Henry Minsky <henry.minsky at gmail.com> wrote:
>>>> You could manually register an event listener in script using the
>>>> LzDelegate class, one way to call it's constructor takes four
>>>> args, an
>>>> object and methodname to call, and an object and event name to
>>>> listen
>>>> on:
>>>>
>>>> new LzDelegate(myobject, mymethodname, colorpickerobject,
>>>> "oncolorselect")
>>>> or whatever the event name is.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On 10/9/07, Rich Christiansen <warproof at warproof.com> wrote:
>>>>>
>>>>> Henry,
>>>>>
>>>>> When you mention that this is "one way" to do it, it makes me
>>>>> wonder what
>>>>> the other ways would be. Could you elaborate a bit?
>>>>>
>>>>> tia,
>>>>> -Rich
>>>>>
>>>>>
>>>>> Henry Minsky wrote:
>>>>> If you make the color picker send an event, you can register
>>>>> some other
>>>>> guy to trigger on it, one way would be to use the "reference"
>>>>> attribute
>>>>> option
>>>>> on the handler in your other component:
>>>>>
>>>>> <colorpicker id="mycolorpicker"/>
>>>>>
>>>>> <myothercomponent>
>>>>> <handler name="onnewcolor" reference="mycolorpicker"/>
>>>>> </myothercomponent>
>>>>>
>>>>> Then make sure that colorpicker sends a "onnewcolor" event
>>>>> when you change something.
>>>>>
>>>>> On 10/9/07, Mike Pence <mike.pence at gmail.com> wrote:
>>>>>
>>>>>
>>>>> So, I fortunately found Henry's color picker
>>>>> (http://www.openlaszlo.org/pipermail/laszlo-user/2005-March/
>>>>> 000437.html)
>>>>> and I want to have another component (so nice to be talking in
>>>>> components -- freakin' Rails!) notified when the color
>>>>> selection has
>>>>> changed.
>>>>>
>>>>> What is the recommended approach for this?
>>>>>
>>>>> Mike Pence
>>>>> http://mikepence.wordpress.com
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Henry Minsky
>>>> Software Architect
>>>> hminsky at laszlosystems.com
>>>>
>>>
>>
>>
>> --
>> Henry Minsky
>> Software Architect
>> hminsky at laszlosystems.com
>
More information about the Laszlo-user
mailing list