PrefabListBox Trouble !!!!!

Chris Reuter cgreuter at csclub.uwaterloo.ca
Fri Jul 18 13:01:21 UTC 2003


On Fri, Jul 18, 2003 at 09:51:38AM +0000, Dominique RICO wrote:
> Hi! I'm programming a software for a
> friend ( and that is a good excuse for me to
> work on squeak!), but i have (only one) trouble with prefab API.
> 
> It concernes the PrefabListBox thing! I think i've done all the stuff
> correctly( i think!) but it doesn't work.

> In the addSemanticActions methode i have implemented:
> listBox targetClicked: self; actionClicked: [Transcript show: 'listBox' ].

> And when i click on an item of the liste, i got the error message:

Your problem is that the BlockContext you're passing to
#actionClicked: needs to take an argument.  When you click on an
entry, the response gets, as an argument, the tag associated with that
entry.  That way, you know which entry was clicked.

Try changing it to:

listBox actionClicked: [ :tag | Transcript show: 'listBox ', tag printString].

(The tags are explained in the PrefabListBox class comment and the
comment preceding its #at:put: method.)

BTW, note that you don't need to set a target (via #targetClicked:) if
you're using a BlockContext as the action.  It's only there if you
give action*: a message to send to target*:.


                              --Chris


-- 
Chris Reuter                           http://www.csclub.uwaterloo.ca/~cgreuter
"Apparently I'm pissing away the Greatest Years Of My Life.  I should be out
 wenching and having a glorious time and grand adventures or something like 
 that.  But I'm just too apathetic to bother. I blame my pants."   --Dave Brown



More information about the Squeak-dev mailing list