For icons in trees in VisualWorks you should:
(1) have a look at the class ListIconLibrary
(2) make extensions on this class to keep your icons in (just take some
existing ones as example)
suppose you choose myIcon20x20, and myIcon20x20mask
(3) you can then get this icon with the method #visualFor: #myIcon
which will use your picture and the mask to produce a transparant icon.
In the original StarBrowser I do this to have all kinds of icons in the
classifications tree.
If you want a more detailed example where your application controls
really everything you can have a look at StarBrowser2, where I install
custom visual blocks, like what you would do with a list.
Just send me a mail with what you want to do exactly in case you have
no idea what I'm talking about and I'll either do it or give you more
detailed instructions. I don't know how proficient you are with this
:-) In the meantime I figured it out :-)
On 26 Jul 2004, at 13:54, Lukas Renggli wrote:
yes, that
would be much better. I'm working on a better
implementation of
the tree, which use some icons for the nodes, for plus and minus, to
provide
a nicer design than using unordered lists. So there will be a lot of
new
small images now... How can I hold these images within the code?
Sure, but I don't really know how to do it VisualWorks in a
(preferably) portable manner.
- You
added a space into the tree component before the label. This is
the responsibility of the CSS-Stylesheet. No layout information in
the
Smalltalk code. Not even a single space :)
*g* ok, I get that. As mentioned above, the tree implementation I
would
prefer to have, uses images now, so it ain't be possible to discard
all
layout information from the Smalltalk code. To set an image in the
code
should be okay, no? ;)
Images should be part of the CSS as well, I think. So if you have a
green style enabled, you maybe want to have the tree-buttons in blue
as well. I would suggest to keep all the component layout to a very
minimal string-based css-enabled rendering and add images, colors,
etc. using style-sheets.
- I
suspect you didn't understand the idea of RelatedComponent. Why
do
you have for all your subclasses two almost identical method-bodies
like #structures and #search...?
yes, you're right, that's bad...
Mhh ... well, maybe my superclass RelatedComponent isn't very useable,
e.g. for external links you cannot return a structure. Maybe the
method should be #links and return a collection of link instances,
that can be anything: mail, url, structure, broken, valid, etc.
Generally
every
component should consist only of a configurable title-string
(provided
by BodyComponent) and all the necessary information within div, span,
ul, li, etc tags.
okay, that's better, I see. I have already worked on a CSS-Stylesheet
for
the new user interface, but I have not finished it so far. You can
fetch it
from the university server. So I will try to control all the layout
stuff
with this CSS file. Should I place this file also within the Smalltalk
code somewhere, or is better the store it externaly?
I don't know yet, maybe we should discuss. Nothing providing
CSS-Styles is there yet. Seaside is having some functionality, so
maybe we want to build something on top there.
Cheers,
Lukas
--
Lukas Renggli
http://renggli.freezope.org
Roel Wuyts
DeComp
roel.wuyts(a)ulb.ac.be Université Libre de
Bruxelles
Belgique
Board Member of the European Smalltalk User Group: