[Seaside] WACompound: creating Seaside Widgets

Nick Ager nick.ager at gmail.com
Sat Nov 8 14:09:35 UTC 2008


Thanks for informative reply. I think I've cracked it and have a validating
lat/long tag.
Is this documented somewhere that I've missed?


Ryan Simmons-4 wrote:
> 
> Components
> 
> Descending from WAComponent produces a seaside component this can be
> called from or embeded into another seaside component. If you embed a
> component into another one you have to add it to the children array.
> Advantages each component has its own state that is maintained, uses
> #renderContentOn: which is very easy to understand.
> Disadvantage must use the children collection to embed it
> 
> Tags
> 
> Descending from WACompound produces a seaside tag that can be embeded
> into a seaside component this would be typically called like html
> latLongInput on: #postition of: self.
> Advantages can easly be added multiple times to a component. Has a
> nice interface.
> Disadvantages has no state, a new instance is created each time the
> page is refreshed.
> 
> The added complexity on WADateInput comes from it trying to maintain
> the standard tag interface allowing you to use #on:of, #callback:,
> #value etc.
> Tags use the same canvas to render themselves on as a component but
> this is done in the #with: method not in #renderContentOn: you also
> use canvas instead of html so for you you could have a #with: method
> something like.
> with: aBlock
>      canvas text: 'latitiude: '.
>      canvas textInput on: #latitude of: self value.
>      canvas text: 'longitude: '.
>      canvas textInput on: #longitude of: self value.
>      canvas hiddenInput callback: [callbackBlock value: self value]
> 
> The hidden callback is used to answer the origional callback defined
> on your component either through #on:of: or #callback:
> To get a working tag you would probalbly want to redefine #value  to
> something like
> value
>     ^value ifNil: [value := MyLongitudeLatitudeClass new]
> 
> This is not very bulletproof (you have to privide a callback when
> rendering (#on:of: is just a shortcut for #value: #callback)) but
> should work
> 
> On Sat, Nov 8, 2008 at 7:53 AM, Nick Ager <nick.ager at gmail.com> wrote:
>> Hi,
>>
>> I want to build a widget for latitude, longitude entry ([N|S], lat
>> degrees, lat minutes; [E|W] long degrees, long minutes). Looking at
>> examples in Seaside it appears I have at least two ways of proceeding:
>> 1) Derive from WAComponent eg WADateSelector
>> 2) Derive from WACompound eg WADateInput
>>
>> In my application I'll be using the latitude and longitude entry in
>> multiple places and like the idea of being able to use it directly as
>> a brush on the canvas as:
>>
>> RenderContentOn: html
>>  html latLongInput on: #position of: self
>>
>> However WADateInput appears to be significantly more complex than
>> WADateSelector and I don't entirely understand what is going on. For
>> example why in WADateInput>>addCallback is a hiddenInput added? I also
>> guess I'd have to modify WARenderCanvas to add something like:
>>
>> WARenderCanvas>>latitudeLongitudeInput
>>   ^ self brush: NALatitudeLongitudeInput new
>>
>> Any thoughts on the relative merits of the two approaches and why are
>> there two Date input widgets?
>>
>> Thanks in advance
>>
>> Nick
>> _______________________________________________
>> seaside mailing list
>> seaside at lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> 
> 

-- 
View this message in context: http://www.nabble.com/WACompound%3A-creating-Seaside-Widgets-tp20393274p20396418.html
Sent from the Squeak - Seaside mailing list archive at Nabble.com.



More information about the seaside mailing list