Status Bar Text?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Status Bar Text?

Patrick Huffer
How do I set the text in a status bar? I see the RegEdit sample has some
code in the "onViewOpened" method that appears to be setting the model of a
status bar item to a new instance of ValueHolder. And in the view composer I
see that the status bar "items" aspect has a status bar item that contains
an aspect called "getTextBlock" that shows a value of "Message selector:
#fullPath" in the workspace next to it. Does all this mean that the method
"fullPath" is called when the status bar item wants to set its text? And if
so, how is it possible to set this message selector in the workspace--I
can't figure out how that is done. Thanks!


Reply | Threaded
Open this post in threaded view
|

Re: Status Bar Text?

Patrick Huffer
Never mind.

I figured out that "Message selector: #fullPath" is actually a bit of code
to evaluate; I thought it was merely a description...
I also figured out that the selector entered here appears to be sent to
whatever value you set the status bar item to; I don't need that so I
removed it - everything works!

"Patrick Huffer" <[hidden email]> wrote in message
news:mepR8.13816$[hidden email]...
> How do I set the text in a status bar? I see the RegEdit sample has some
> code in the "onViewOpened" method that appears to be setting the model of
a
> status bar item to a new instance of ValueHolder. And in the view composer
I
> see that the status bar "items" aspect has a status bar item that contains
> an aspect called "getTextBlock" that shows a value of "Message selector:
> #fullPath" in the workspace next to it. Does all this mean that the method
> "fullPath" is called when the status bar item wants to set its text? And
if
> so, how is it possible to set this message selector in the workspace--I
> can't figure out how that is done. Thanks!
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Status Bar Text?

Ian Bartholomew-15
In reply to this post by Patrick Huffer
Patrick,

> How do I set the text in a status bar?

I'm not sure what you have done so far so from the top ...

1) In the ViewComposer add a StatusBar to the Shell. By setting the Shell's
#layoutManager to BorderLayout and the StatusBar's #arrangement aspect to
South it automatically positions itself.
2) Add status items to the StatusBar #items aspect and give each item a name
and appropriate width. If you only want one you can just use the existing,
predefined, item and leave it's width at-1. Unless you really want icons
it's best to set the StatusItem's #getImageBlock aspect to nil
3) In your Shell class add a #createComponents method

createComponents
    super createComponents.
    statusItem1 := self add: TextPresenter new name: 'statusItem1'.
    "and so on for all the status items you added"

4) Set the value of the presenter in any appropriate place

onViewOpened
    super onViewOpened.
    statusItem1 value: 'Hello, World'.
    "or, as it uses a #etTextBlock"
    statusItem1 value: 12345

I often treat status items as second class citizens (they tend to only get
referenced/changed in one place) and don't bother giving them an instance
variable. You can just use

    (self presenterNamed: 'statusItem1') value: 'Hello'

Regards
    Ian