<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7651.59">
<TITLE>Re: [Seaside] Usage of Canvas' #select and #labels</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=2>No, personally I would much rather see,<BR>
<BR>
labels: [:o | o ifNil: [] ifNotNil: []];<BR>
enablement: [:o | o notNil];<BR>
<BR>
Its just a little more consistent, your suggestion seems very specialized IMHO and this would still work and be readable.<BR>
<BR>
Cheers!<BR>
<BR>
-Boris<BR>
(Sent from a BlackBerry)<BR>
<BR>
----- Original Message -----<BR>
From: seaside-bounces@lists.squeakfoundation.org &lt;seaside-bounces@lists.squeakfoundation.org&gt;<BR>
To: sea &gt;&gt; &quot;The Squeak Enterprise Aubergines Server - general discussion.&quot; &lt;seaside@lists.squeakfoundation.org&gt;<BR>
Sent: Fri Apr 06 11:57:59 2007<BR>
Subject: [Seaside] Usage of Canvas' #select and #labels<BR>
<BR>
Hi all..<BR>
<BR>
I'm trying to find a way to cleanup some of my existing code. I've got,<BR>
in a handful of places, items coming out of a Glorpified database and<BR>
use this data as the items in various Canvas API #select lists for<BR>
various forms I've got.<BR>
<BR>
What I currently do is prepend an item to the front of the select array<BR>
when the component is initially drawn by Seaside that has text similar<BR>
to&nbsp; &quot;Select one...&quot;..&nbsp;&nbsp; I've got code that will take the array that I<BR>
get back from Glorp and add a nil item to the front of the array that I<BR>
can then check for in the labels: code block -- if the item being<BR>
processed is nil, then I make the label say 'Select one...', otherwise<BR>
use the database data.. Below is the code I use more or less to<BR>
achieve this :<BR>
<BR>
html select list: orgs ;<BR>
&nbsp;&nbsp; callback: [:i | self orgId: i];<BR>
&nbsp;&nbsp; labels: [:org | org = '' ifTrue: [ 'Select One..' ] ifFalse: [ org name ] ].<BR>
<BR>
Does anyone use anything more elegant to overcome this or is everyone<BR>
selecting their data directly from the database items without the need<BR>
for a 'select one...' initially selected label?&nbsp; I'd love to ditch the code<BR>
I've got that has to manipulate the array I get from Glorp along with the<BR>
extra code to fiddle w/ Seaside labels to do what I want..<BR>
<BR>
I guess I could take a stab at writing up a modification to the Canvas<BR>
API's #select method that takes an #initiallySelectedLabel: method call<BR>
to set the name for that initially selected label item -- would anyone<BR>
else find that useful?&nbsp; Perhaps the result would allow for something like<BR>
the following:<BR>
<BR>
html select list: orgs ;<BR>
&nbsp;&nbsp; callback: [:i | self orgId: i];<BR>
&nbsp;&nbsp; labels: [:org | org name ];<BR>
&nbsp;&nbsp; initiallySelectedLabel: 'Select One...'.<BR>
<BR>
Comments?<BR>
_______________________________________________<BR>
Seaside mailing list<BR>
Seaside@lists.squeakfoundation.org<BR>
<A HREF="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</A><BR>
</FONT>
</P>

</BODY>
</HTML>