erratic behavior of push buttons in Dolphin 98?

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

erratic behavior of push buttons in Dolphin 98?

Job ter Haar
Hello,

I am new to Dolphin and I have installed the free Dolphin 98 on my
computer. At this moment, I am making a user interface for an
application that I have ported from Visual Age to Dolphin 98.

I am having a problem with the push buttons. When I edit my view in
the View Composer, I enable or disable my push buttons according to
the desired state of my UI at startup.

In the View Composer itself they look just fine, but when I test my
view from the View Composer, or when I start my application, all
buttons are enabled.

In an earlier version of my UI I had exactly the opposite situation:
all buttons were all disabled at startup. Then I changed something
else in the view (I added a text presenter) and suddenly all the
buttons showed up as being enabled.

To try to work around this problem, I have added a method to my
presenter (a Shell) that brings the push buttons in their desired
state. The method works fine when I call it on a running application
(from a workspace), but when I call it from the presenter (shell)
itself just after opening the view, it doesn't seem to work: all
buttons show up enabled.

When I call my workaround method on my presenter shell from a
workspace, I manage to get my buttons in the right state, but only for
a short moment of victory: as soon as I touch any of the lists, text
presenters or enabled buttons, all buttons take their chance to become
enabled again.

Any suggestions?

Thanks in advance,

Job ter Haar

to email me, remove "GeenSpam" from my email address.


Reply | Threaded
Open this post in threaded view
|

Re: erratic behavior of push buttons in Dolphin 98?

Ian Bartholomew
Job,

"Job ter Haar" <[hidden email]> wrote in message
news:[hidden email]...
[..]
> I am having a problem with the push buttons. When I edit my view in
> the View Composer, I enable or disable my push buttons according to
> the desired state of my UI at startup.
[..]
> Any suggestions?

I guess from the above that you are just sending #enable/#disable to the
buttons? If so then Dolphin does not work this way for GUI objects that
generate commands - you enable/disable the command itself rather that the
GUI object sending the command.

The advantage of this is that if you have the same command generated by a
number of different sources, main menu + context menu + toolbar button +
normal button for example, then you only have to disable the command once
and everything that generates it is automatically disabled.

There have been a number of threads about this (you should search through
the news archive looking for "queryCommand") but the basic outline is -

Every so often (idle times, when a menu is opened or when you tell it to)
Dolphin will send a #queryCommand: message to a Presenter with the selector
for a command generated by that Presenter as an argument. This is done once
for every command that the Presenter generates.

The Presenters job is to set the enabled/disabled state of the command - it
is up to the presenter to decide what that should be.

A typical method would be

queryCommand: aCommandQuery
    super queryCommand: aCommandQuery.
    aCommandQuery command = #start
        ifTrue: [aCommandQuery enabled: self isStarted not].
    aCommandQuery command = #stop
        ifTrue: [aCommandQuery enabled: self isStarted].

So any GUI object sending the #start command would only be enabled if the
Presenter was not already started (whatever that means) and vice versa for
stop.

There are many examples of #queryCommand: in the image to look at for
further details. There is a bit more to it than I mention above
(CommandPolicy et al. Models and Views can generate commands as well as
Presenters) but it should be enough to get you started.

BTW The news archive for Dolphin  (going back to the start of the first
newsgroup) and a reader are available on my web site -
http://www.iandb.org.uk

Ian


Reply | Threaded
Open this post in threaded view
|

Re: erratic behavior of push buttons in Dolphin 98?

Job ter Haar
On Tue, 13 Feb 2001 13:27:14 -0000, "Ian Bartholomew"
<[hidden email]> wrote:

Ian,

Thanks a lot for your reaction. I implemented your suggestions and my
buttons now behave exactly as I intended them to do.

>I guess from the above that you are just sending #enable/#disable to the
>buttons?

The construction of my sentence wasn't very clear, I guess. Initially,
I just toggled the checkboxes controlling the state of the buttons in
the View Composer. Later I started sending #enable and #disable to the
buttons (not anymore).

Thanks again,

Job