Nick Ager | 8 Nov 06:53

WACompound: creating Seaside Widgets

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
(Continue reading)

Ryan Simmons | 8 Nov 08:59

Re: WACompound: creating Seaside Widgets

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: '.
(Continue reading)

Nick Ager | 8 Nov 15:09

Re: WACompound: creating Seaside Widgets


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
(Continue reading)


Gmane