The Artima Developer Community
Sponsored Link

Agile Buzz Forum
I have a Row with LabelAndIcon

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
I have a Row with LabelAndIcon Posted: Oct 4, 2007 8:57 PM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: I have a Row with LabelAndIcon
Feed Title: Travis Griggs - Blog
Feed URL: http://www.cincomsmalltalk.com/rssBlog/travis-rss.xml
Feed Description: This TAG Line is Extra
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From Travis Griggs - Blog

Advertisement

LabelAndIcon is one of the more contrived objects in VisualWorks. At first it seems tame enough. Then we find there's this heirarchy of all these tweaked variants under it. But they all take just one graphic. And they all want the graphic to go on the left side. We ran into this as problem for the merge tool in VW 7.5. As a result, a simple little object was introduced called "VisualRow". It's just a collection of VisualComponents which are drawn horizontally. Using this, we could put N icons to the left of a label, with an expression something like:

(LabelAndIcon with: 'Hello World') icon: (VisualRow withAll: (#(#handWave #globe) collect: [:each | ListIconLibrary visualFor: each]))
It turned out pretty handy. But when I was working on the new browser tabs, I came upon a case, where I wanted one icon to the left of the text, and one to the right. I could have made another LabelAndIcon subclass. But by backing up for a minute, I realized that TabLabelAndIcon weren't doing anything more than what VisualRow already was. So I inverted the relationship and used it as the top level thing:
VisualRow withAll: (Array
	with: anObject toolListIcon
	with: (Label with: 'Comment')
	with: ToolListIconLibrary warning)
Often we create these DSL's in Smalltalkm and we get so in the groove with them that we start hacking away at all kinds of stuff, when if we back up for a minute, often we'll find a simpler/more general solution just outside of our perhipheral view.

Read: I have a Row with LabelAndIcon

Topic: Home Office Previous Topic   Next Topic Topic: At the Agile Business Conference

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use