erratic behavior of push buttons in Dolphin 98? 
Author Message
 erratic behavior of push buttons in Dolphin 98?

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.



Sat, 02 Aug 2003 20:41:55 GMT  
 erratic behavior of push buttons in Dolphin 98?
Job,



[..]

Quote:
> 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



Sat, 02 Aug 2003 21:27:14 GMT  
 erratic behavior of push buttons in Dolphin 98?
On Tue, 13 Feb 2001 13:27:14 -0000, "Ian Bartholomew"

Ian,

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

Quote:
>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



Sun, 03 Aug 2003 21:48:05 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Erratic Behavior of OPTIONAL attribute in Fortran 90

2. Simple expect script has erratic behavior, why?

3. Erratic import behavior

4. The future of Dolphin 2.1/98

5. Dolphin 98 question

6. Dolphin 98 exception handling problem

7. Windows 98 and Dolphin

8. Dolphin 98 Mutate View Bug?

9. The future of Dolphin 2.1/98

10. Dolphin Smalltalk 98

11. Dolphin Smalltalk/98 Release

12. Push Button problem 5.1 RC

 

 
Powered by phpBB® Forum Software