2010/8/17 Gary Chambers
<gazzaguru2@btinternet.com>
Ask away if you'd like more examples of
Morphic/Polymorph things...
I think everybody want to have (lot) more examples ;)
More seriously, on Pharocasts the GUI tab is the most clicked one by far (according to google analytics), so I suppose a lot of people want (including ��me) to start by doing a little graphical app. ��Polymorph seems cool, but aaarggghhh ��almost no documentation. Indeed I'm just starting to feel the logic behind it so I will try to record more screencasts on it.
��
Even for me, that was the first time I used a Block
as the model for a button! :-)
And I think that's how it should be for all callbacks: it's far easier to think (for me at least) and design by giving a block to an action than a selector and a model.
Laurent (who is waiting for more examples :)
��
Regards, Gary
----- Original Message -----
Sent: Monday, August 16, 2010 7:31
PM
Subject: Re: [Pharo-project] Pharocasts:
Display Picasa photos
This example is really interesting, I've just learn a lot of
things.
Laurent
On Mon, Aug 16, 2010 at 2:10 PM, Gary Chambers
<gazzaguru2@btinternet.com>
wrote:
Indeed, nice...
Here's an adaptation for
Flickr...
| xmlStream xmlDoc photos builder clickBlock |
xmlStream
:= 'http://api.flickr.com/services/feeds/photos_public.gne?id=12018791@N06&lang=en-us&format=rss_200'
asUrl retrieveContents contentStream.
xmlDoc := XMLDOMParser
parseDocumentFrom: xmlStream.
photos := OrderedCollection
new.
xmlDoc tagsNamed: #item do:
�� �� �� �� ��
�� [:item| | title thumbUrl photoUrl |
�� �� �� ��
�� �� ��title := (item firstTagNamed: #title)
characterData.
�� �� �� �� �� �� ��thumbUrl
:= ((item firstTagNamed: #media:thumbnail) attributeAt: #url)
asUrl.
�� �� �� �� �� �� ��photoUrl := ((item
firstTagNamed: #media:content) attributeAt: #url) asUrl.
�� ��
�� �� �� �� ��photos add: title -> (Form
fromBinaryStream: thumbUrl retrieveContents contentStream) ->
photoUrl].
clickBlock := [:url :title | | scrollPane |
scrollPane
:= GeneralScrollPane new
��scrollTarget: (builder
��newImage:
(Form fromBinaryStream: url retrieveContents contentStream)).
scrollPane
openInWindow
��setLabel: title;
��extent:
600@400.
scrollPane color: Color transparent].
builder := UITheme
builder.
((builder
�� newRow: (photos collect:
�� ��
�� �� �� �� �� �� �� ��[:aPhoto|
��
�� �� �� �� �� �� �� �� ��
(builder
�� ��newButtonFor: clickBlock
�� ��getState:
nil
�� ��action: #value:value:
�� ��arguments: {aPhoto
value. aPhoto key key}
�� ��getEnabled: nil
��
��label: ((builder newColumn: {
�� �� ��builder newImage:
aPhoto key value.
�� �� ��builder newLabel: aPhoto key
key})
�� �� ��cellPositioning: #center;
�� ��
��layoutInset: 10)
�� ��help: nil)]))
wrapDirection:
#topToBottom;
openInWindow)
��setLabel: (xmlDoc firstTagNamed:
#title) characterData;
��extent: 700@680.
Regards,
Gary
----- Original Message ----- From: "Germ��n Arduino" <garduino@gmail.com>
To: <Pharo-project@lists.gforge.inria.fr>
Cc: "A friendly
place where any question about pharo is welcome" <pharo-users@lists.gforge.inria.fr>
Sent: Sunday,
August 15, 2010 11:14 PM
Subject: Re: [Pharo-project] Pharocasts: Display
Picasa photos
_______________________________________________
Pharo-project mailing list
Pharo-project@lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project