StatusBarItem walkback

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

StatusBarItem walkback

Ian Bartholomew
Open up a StatusBar in the ViewComposer then select and change the
#getImageBlock or #getTextBlock of the default StatusBarItem. You get a
walkback because StatusBarItem>>getTipText is trying to access a nil model.

Ian


Reply | Threaded
Open this post in threaded view
|

Re: StatusBarItem walkback

David Steinberg
"Ian Bartholomew" <[hidden email]> penned:
>Open up a StatusBar in the ViewComposer then select and change the
>#getImageBlock or #getTextBlock of the default StatusBarItem. You get a
>walkback because StatusBarItem>>getTipText is trying to access a nil
>model.

OK... I feel better now. Generally I attribute the problems I encounter while
programming to some goofy thing I've done, or haven't done. As a *real*
newbie to smalltalk, I don't have a clue...

In my first foray into trying to make something (anything) with Dolphin, I'm
doing all right, having only pulled out a few handfuls of hair and gnashing my
teeth down some, but I can still eat without food falling out. Anyway, I'm done
with everything except for putting text into the status bar. The UI is responding
properly, controls control and I'm feeling pretty good about myself.

Can I figure out how to put text into the status bar? Well, of course not! My rather
suspect VB skills are useless here... There's no text property for the status bar!
Uh Oh. I'm getting the same feeling I had when realizing I didn't have any idea how
to reference a scrollbar in the view from the presenter. Uh, get the value how?

Anyway, I'm frantically sending messages to stuff in the workspace trying to see
what gives (or the alternative) and I see #getTextBlock:. 'Cool', says I. So I try
sending this message to stuff (I think it was the right kind of stuff) with some
probably unsuitable argument (what is a Monadic Valuable... Is that like someone
with one testicle?) and get nothing but walkbacks. 'Crap', says I. I must be doing
something goofy... Eventually I give up in frustration figuring I'll bet back to it later.

In the meantime I download Ian's Goodie package for Dolphin 4. I startup the News
Archive Browser. Whoa! There's a status bar with text... Well, there's only a few
flies on me, so I dug into his code and pretty much copied what was done there
to complete my little smalltalk programming exercise. Turns out I probably
shouldn't have been mucking about in the #getTextBlock: stuff. All I got was a
bunch of walkbacks, but maybe this time it wasn't my fault!

So thanks Ian! I'm a tad closer to actually having a clue. Perhaps Andy and Blair
would consider providing gift certificates at a therapist in lieu of documentation :-)

Regards,
David
___________________
David Steinberg
Orlando, FL                                Take deep breaths...
[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: StatusBarItem walkback

Ian Bartholomew
David,

"David Steinberg" <[hidden email]> wrote in message
news:Xns8FFDAA3A0dbergmagicnetnet@209.155.56.81...
[with snips]

> Can I figure out how to put text into the status bar? Well, of course not!
My rather
> suspect VB skills are useless here... There's no text property for the
status bar!

Think of StatusBarItems, ToobarButtons and ListViewColumns as wanna-be
views. Because of the way Windows works they can't be view resources in
their own right so that have to try to emulate the normal view behaviour.
StatusBarItems get quite close but for some reason they don't have a default
model?

> Uh Oh. I'm getting the same feeling I had when realizing I didn't have any
idea how
> to reference a scrollbar in the view from the presenter. Uh, get the value
how?

I get exactly the same feeling now when I try poking around (the proper
description for what I do) in the ActiveX classes that Dolphin now provides.
I dimly recall the same feelings from when I first started poking around in
Smalltalk but, thankfully, the "mists of time" obscures most of them:)

> So thanks Ian! I'm a tad closer to actually having a clue. Perhaps Andy
and Blair
> would consider providing gift certificates at a therapist in lieu of
documentation :-)

Glad I could help - providing code to be copied is one of the main uses of
my goodies.

For anyone else who wants some hints on using StatusBars -

1) Setting the layout manager aspect of the status bar's parent view to
"Border" and the arrangement aspect of the status bar itself to "South" -
makes things a lot easier.

2) Give each StatusBarItem (listed in the "items" aspect of the status bar)
a name so that it can be referenced.

3)
EITHER create and manage the model for each status bar item yourself
YourShell>>onViewOpened
...
    (self view viewNamed: 'statusBarItemName')
        model: 'Initial String' asValue

YourShell>>updateStatus
    (self view viewNamed: 'statusBarItemName')
        model value: 'A New String'

OR add a presenter to do it for you
YourShell>>createComponents
...
    statusItem := self add: TextPresenter new name: 'statusBarItemName'

YourShell>>onViewOpened
...
    statusItem value: 'Initial String'

YourShell>>updateStatus
    statusItem value: 'A New String'

4) If you don't want the icon to appear on the status bar then set the
#getImageBlock aspect of the status item to nil (ignoring the error that D4
throws)

5) Because the default #getTextBlock for the status bar item uses
#displayString (see BasicListAbstract>>value:) then you don't need to
convert to a String before updating the status bar items - in the last
example above the following would still work
    statusItem value: Time now

Ian


Reply | Threaded
Open this post in threaded view
|

Re: StatusBarItem walkback

Blair McGlashan
In reply to this post by Ian Bartholomew
Ian

"Ian Bartholomew" <[hidden email]> wrote in message
news:906f26$46hb$[hidden email]...
> Open up a StatusBar in the ViewComposer then select and change the
> #getImageBlock or #getTextBlock of the default StatusBarItem. You get a
> walkback because StatusBarItem>>getTipText is trying to access a nil
model.

Thanks. We'll put it on the list for PL2.

Regards

Blair