Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0002357 [Squeak] Morphic minor always 12-13-05 07:26 12-16-05 05:17
Reporter asparagi View Status public  
Assigned To
Priority normal Resolution open  
Status new   Product Version 3.9
Summary 0002357: transparent PluggableButtonMorphs turn inappropriate shades of green
Description s1 := Switch new.
b1 := (PluggableButtonMorph on: s1 getState: #isOn action: #switch) label: 'S1'.
b1 beTransparent.
b1 openCenteredInWorld

b1 will be the color of whatever is in the center of your world. However, if you mouse over it, when the mouse leaves the boundaries of b1, b1 will turn green, and stay various shades of green depending on the current highlight.
Additional Information
Attached Files

- Relationships

- Notes
(0003320 - 868 - 1007 - 1007 - 1007 - 1007 - 1007)
wiz
12-14-05 02:15
edited on: 12-15-05 06:34

Try:
| s1 b1 |
s1 := Switch new.
b1 := (PluggableButtonMorph on: s1 getState: #isOn action: #switch) label: 'S1'.
b1 beTransparent.
 
b1 offColor: b1 color . " * * * * "

b1 openCenteredInWorld

This will give you a transparent button color when the button is off.
It will not visibly "hilitght" on mouse over (cause a darker shade of transparent is...).

The off and on color are set separately as things now stand. One could write an overriding beTransparent method for this class to set the offColor but I don't know if that would be an improvement.

asparagi what is the user story for what you wished to do? Is this enough info to let you do it? Do you still feel there is a bug here?

A good way to experiment would be to define a subclass of PluggableButtonMorph and try different initializations and behaviours for color changing methods.

 
(0003327 - 2862 - 3209 - 3209 - 3304 - 3304 - 3304)
asparagi
12-15-05 06:46

That is a pretty good suggestion, but it doesn't get me all the behavior I need. I think I misidentified the problem.

In the 3.7-5989-based image I wrote my code in, I use PluggableButtonMorphs as tabs to navigate a TabbedPalette-like object (BookMorph and its subclasses did not do what I wanted). The current tab is highlighted compared to the other tabs; I'm using highlight and unHighlight to achieve this. I think I made them transparent to start with because when I create them, I don't know what color their containing Morph will be. In the 3.7 image, my tabs do nothing at all on mouseover. In a 3.9a-6696 image, my tabs turn green as described above. With your suggestion in a 3.9a-6696 image, my tabs (including the highlighted one) provide feedback on mouseover the first time they are moused over, but not thereafter, and the highlighted tab drops its highlight at this time. I'm not actually using the state detection part of PluggableButtonMorph for these tabs; sorry to mislead you with the Switch example.

Try:

s1 := Switch new.
b2 := (PluggableButtonMorph on: s1 getState: #isOn action: #switch) label: 'S1'.
b2 beTransparent.
b2 offColor: b1 color.
b2 openCenteredInWorld.
b2 highlight

If b1 is a button configured as in your example, and b2 is as above (your example plus highlight), here are some instance variables before mouseover:
 
b1 color: Color transparent
     offColor: Color transparent
     onColor: (Color r: 0.736 g: 0.92 b: 0.552)
     feedbackColor: Color red
b2 color: (Color r: 0.774 g: 0.774 b: 0.774)
     offColor: Color transparent
     onColor: (Color r: 0.736 g: 0.92 b: 0.552)
     feedbackColor: Color red

After mouseover for both buttons (mouseover feedback occurred for b2), both buttons have b1's settings above for color-related instance variables.

So, I think the real problem has nothing to do with transparency: the mouseover feedback, when the mouse exits a PluggableButtonMorph, doesn't revert to the previous color, it reverts to a new determination of what the button's color should be. That determination takes the wrong things into account:

1. Even when getStateSelector is nil, onColor and offColor appear to be used, or your suggestion wouldn't have changed the behavior of my application at all; it seems like only color should be used if getStateSelector is nil, or at least that color: should set both onColor and offColor.

2. A morph doesn't store whether it is highlighted anywhere but its color, which the mouseover feedback apparently doesn't examine.

Of course, looking at the code, 0000002 doesn't make any sense, since self color is the only thing mouseLeave: examines. But while I was investigating this problem, I discovered that for whatever reason, PluggableButtonMorphPlus does not suffer from the problem, so I'll just use that instead.
 
(0003336 - 1205 - 1336 - 1336 - 1336 - 1336 - 1336)
wiz
12-16-05 05:17

Hi asparagi,

I looked into it some more.

There is a big clash of cultures here.

 Several diffent systems for dealing with color all not listening to each other.

The highligh color might be more easily controled if it is set explicitly else it defaults to self color.

However, highlight only changes the color not the onColor or offColor so it doesn't hold sway once the button updates its state. The buttons should probably not even inherit the highlighting methods. Ah well, Morph is a messy portmanteau class.

The button itself checks its state and then uses onColor or offColor.
And the mouse over adjusts the color brighttness by 5 percent on mouse leave.

Because it is a clash of cultures a true fix would require knowing what each method is intending to do and in which context it intends to do it and then sorting it out and cleaning up the mess.

I'd want to either do all of it or none of it. Trying a patch here would more than like cause problems elsewhere. No elegance in that.

So if you've found a work around I'd go with that.

And put this bug on a back burner for a future time and a clean up crew who would look at the total picture and sort things out.
 

- Issue History
Date Modified Username Field Change
12-13-05 07:26 asparagi New Issue
12-14-05 02:15 wiz Note Added: 0003320
12-15-05 06:34 wiz Note Edited: 0003320
12-15-05 06:46 asparagi Note Added: 0003327
12-16-05 05:17 wiz Note Added: 0003336


Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
44 total queries executed.
32 unique queries executed.
Powered by Mantis Bugtracker