Problem with vw7.7 ExtraEmphasis.ColoredText>>color:while:

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

Problem with vw7.7 ExtraEmphasis.ColoredText>>color:while:

MarkPetersen
In migrating to VW7.7, I noticed that I lost the color of text items in a List and DataSet.  Everything was simply black, even though an Inspect on the item showed that the text was emphasized with a color value.
I tracked the issue down to the ExtraEmphasis.ColoredText color:while: method.  In the vw7.4 method, it was coded as:

color: aGC while: aBlock
        | originalPaint |
        originalPaint := aGC paint.
        aGC paint: self color.
        aBlock ensure: [aGC paint: originalPaint]

while in vw7.7 it is coded as:
color: aGC while: aBlock
        "Change the color to that specified in this font"

        | originalPaint defColors |
        "If we are on Windows and displaying a selection, don't change color
        (i.e. use the already set selectionForeground color, probably white)"

        "Windows-like, i.e. normal selected text is not the same color as normal text"
        defColors := aGC medium defaultWidgetPolicy class defaultColorWidgetColors.
        ((defColors matchAt: SymbolicPaint selectionForeground ifAbsent: [ColorValue black]) ~=
        (defColors matchAt: SymbolicPaint foreground ifAbsent: [ColorValue black])
                and:
        ["Telling if we are in a selection is tricky, so we need to try a couple of ways"
        "Scrolling and normal display in a TextView"
        aGC paint == SymbolicPaint selectionForeground or:
                ["DataSet visuals for InputFieldView - see DataSetView>>displayVisualsOn:"
                (aGC paintPreferencesMatchAt: SymbolicPaint selectionForeground) ==
                (aGC paintPreferencesMatchAt: SymbolicPaint foreground)]])

                ifTrue: [aBlock value]
                ifFalse: [originalPaint := aGC paint.
                                aGC paint: self color.
                                aBlock ensure: [aGC paint: originalPaint]]


If I naively replace the 7.7 method with the 7.4 method, I get my colors back.  So all the extra logic is causing the ifTrue block to be used when it should be the ifFalse path.  I made the big mistake of trying to put a break in this method to try to debug further.  Eventually I had to reboot after locking up my system.  I also tried to unload the ExtraEmphasis parcel, which also did not work and produced exceptions in every window.

This method change seems to be expecting color foreground settings from the widget settings, but I'm setting the color of fonts programatically based on the type of object displayed.  So foreground colors can be different for every row in the list or dataset.  But without being able to put a break into this method without causing a runaway image makes debugging very difficult.

Probably need Cincom to work on this one, but thought I'd post as a warning.

Mark Petersen
Reply | Threaded
Open this post in threaded view
|

Re: Problem with vw7.7 ExtraEmphasis.ColoredText>>color:while:

Karsten Kusche
Hi Mark,

you could try to set a One-Shot-Breakpoint. Such breakpoints only fire
once and don't keep firing.

Kind Regards
Karsten



Am 15.03.10 17:31, schrieb MarkPetersen:

> In migrating to VW7.7, I noticed that I lost the color of text items in a
> List and DataSet.  Everything was simply black, even though an Inspect on
> the item showed that the text was emphasized with a color value.
> I tracked the issue down to the ExtraEmphasis.ColoredText color:while:
> method.  In the vw7.4 method, it was coded as:
>
> color: aGC while: aBlock
> | originalPaint |
> originalPaint := aGC paint.
> aGC paint: self color.
> aBlock ensure: [aGC paint: originalPaint]
>
> while in vw7.7 it is coded as:
> color: aGC while: aBlock
> "Change the color to that specified in this font"
>
> | originalPaint defColors |
> "If we are on Windows and displaying a selection, don't change color
> (i.e. use the already set selectionForeground color, probably white)"
>
> "Windows-like, i.e. normal selected text is not the same color as normal
> text"
> defColors := aGC medium defaultWidgetPolicy class defaultColorWidgetColors.
> ((defColors matchAt: SymbolicPaint selectionForeground ifAbsent:
> [ColorValue black]) ~=
> (defColors matchAt: SymbolicPaint foreground ifAbsent: [ColorValue black])
> and:
> ["Telling if we are in a selection is tricky, so we need to try a couple of
> ways"
> "Scrolling and normal display in a TextView"
> aGC paint == SymbolicPaint selectionForeground or:
> ["DataSet visuals for InputFieldView - see DataSetView>>displayVisualsOn:"
> (aGC paintPreferencesMatchAt: SymbolicPaint selectionForeground) ==
> (aGC paintPreferencesMatchAt: SymbolicPaint foreground)]])
>
> ifTrue: [aBlock value]
> ifFalse: [originalPaint := aGC paint.
> aGC paint: self color.
> aBlock ensure: [aGC paint: originalPaint]]
>
>
> If I naively replace the 7.7 method with the 7.4 method, I get my colors
> back.  So all the extra logic is causing the ifTrue block to be used when it
> should be the ifFalse path.  I made the big mistake of trying to put a break
> in this method to try to debug further.  Eventually I had to reboot after
> locking up my system.  I also tried to unload the ExtraEmphasis parcel,
> which also did not work and produced exceptions in every window.
>
> This method change seems to be expecting color foreground settings from the
> widget settings, but I'm setting the color of fonts programatically based on
> the type of object displayed.  So foreground colors can be different for
> every row in the list or dataset.  But without being able to put a break
> into this method without causing a runaway image makes debugging very
> difficult.
>
> Probably need Cincom to work on this one, but thought I'd post as a warning.
>
> Mark Petersen
>    

--
Karsten Kusche - Dipl. Inf. - [hidden email]
Georg Heeg eK - Köthen
Handelsregister: Amtsgericht Dortmund A 12812

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Problem with vw7.7 ExtraEmphasis.ColoredText>>color:while:

Alan Knight-2
You can also try tricks like

   InputState default altDown ifTrue: [self halt].

So that it will only halt if the alt key is down, and letting up the key should stop a cascade of debuggers.

I note that ExtraEmphases is contributed code.

At 03:55 AM 2010-03-16, Karsten wrote:
Hi Mark,

you could try to set a One-Shot-Breakpoint. Such breakpoints only fire
once and don't keep firing.

Kind Regards
Karsten



Am 15.03.10 17:31, schrieb MarkPetersen:
> In migrating to VW7.7, I noticed that I lost the color of text items in a
> List and DataSet.  Everything was simply black, even though an Inspect on
> the item showed that the text was emphasized with a color value.
> I tracked the issue down to the ExtraEmphasis.ColoredText color:while:
> method.  In the vw7.4 method, it was coded as:
>
> color: aGC while: aBlock
>       | originalPaint |
>       originalPaint := aGC paint.
>       aGC paint: self color.
>       aBlock ensure: [aGC paint: originalPaint]
>
> while in vw7.7 it is coded as:
> color: aGC while: aBlock
>       "Change the color to that specified in this font"
>
>       | originalPaint defColors |
>       "If we are on Windows and displaying a selection, don't change color
>       (i.e. use the already set selectionForeground color, probably white)"
>
>       "Windows-like, i.e. normal selected text is not the same color as normal
> text"
>       defColors := aGC medium defaultWidgetPolicy class defaultColorWidgetColors.
>       ((defColors matchAt: SymbolicPaint selectionForeground ifAbsent:
> [ColorValue black]) ~=
>       (defColors matchAt: SymbolicPaint foreground ifAbsent: [ColorValue black])
>                and:
>       ["Telling if we are in a selection is tricky, so we need to try a couple of
> ways"
>       "Scrolling and normal display in a TextView"
>       aGC paint == SymbolicPaint selectionForeground or:
>                ["DataSet visuals for InputFieldView - see DataSetView>>displayVisualsOn:"
>                (aGC paintPreferencesMatchAt: SymbolicPaint selectionForeground) ==
>                (aGC paintPreferencesMatchAt: SymbolicPaint foreground)]])
>
>                ifTrue:  [aBlock value]
>                ifFalse:         [originalPaint := aGC paint.
>                                  aGC paint: self color.
>                                  aBlock ensure: [aGC paint: originalPaint]]
>
>
> If I naively replace the 7.7 method with the 7.4 method, I get my colors
> back.  So all the extra logic is causing the ifTrue block to be used when it
> should be the ifFalse path.  I made the big mistake of trying to put a break
> in this method to try to debug further.  Eventually I had to reboot after
> locking up my system.  I also tried to unload the ExtraEmphasis parcel,
> which also did not work and produced exceptions in every window.
>
> This method change seems to be expecting color foreground settings from the
> widget settings, but I'm setting the color of fonts programatically based on
> the type of object displayed.  So foreground colors can be different for
> every row in the list or dataset.  But without being able to put a break
> into this method without causing a runaway image makes debugging very
> difficult.
>
> Probably need Cincom to work on this one, but thought I'd post as a warning.
>
> Mark Petersen
>   

--
Karsten Kusche - Dipl. Inf. - [hidden email]
Georg Heeg eK - Köthen
Handelsregister: Amtsgericht Dortmund A 12812

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

--
Alan Knight [|], Engineering Manager, Cincom Smalltalk

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Problem with vw7.7 ExtraEmphasis.ColoredText>>color:while:

MarkPetersen

Thanks Karsten and Alan for your suggestions.  I'll give it a shot.

Thanks,


                                                                       
 Mark K. Petersen        (Embedded image moved to    Home Office: (319)
 Semiconductor Research  file: pic08805.jpg)         406-4165 Cell: (845)
 and Development Center                              235-4360          
 IBM Global Engineering                              Internet email:  
 Solutions                                           [hidden email]
                                                     DMACS Wiki        
                                                     DMACS Forum      
                                                                       








                                                                       
  From:       Alan Knight <[hidden email]>                            
                                                                       
  To:         Karsten <[hidden email]>, Mark Petersen/Fishkill/IBM@IBMUS
                                                                       
  Cc:         [hidden email]                                        
                                                                       
  Date:       03/16/2010 07:09 AM                                      
                                                                       
  Subject:    Re: [vwnc] Problem with vw7.7  ExtraEmphasis.ColoredText>>color:while:
                                                                       





You can also try tricks like

   InputState default altDown ifTrue: [self halt].

So that it will only halt if the alt key is down, and letting up the key
should stop a cascade of debuggers.

I note that ExtraEmphases is contributed code.

At 03:55 AM 2010-03-16, Karsten wrote:
      Hi Mark,

      you could try to set a One-Shot-Breakpoint. Such breakpoints only
      fire
      once and don't keep firing.

      Kind Regards
      Karsten



      Am 15.03.10 17:31, schrieb MarkPetersen:
      > In migrating to VW7.7, I noticed that I lost the color of text
      items in a
      > List and DataSet.  Everything was simply black, even though an
      Inspect on
      > the item showed that the text was emphasized with a color value.
      > I tracked the issue down to the ExtraEmphasis.ColoredText
      color:while:
      > method.  In the vw7.4 method, it was coded as:
      >
      > color: aGC while: aBlock
      >       | originalPaint |
      >       originalPaint := aGC paint.
      >       aGC paint: self color.
      >       aBlock ensure: [aGC paint: originalPaint]
      >
      > while in vw7.7 it is coded as:
      > color: aGC while: aBlock
      >       "Change the color to that specified in this font"
      >
      >       | originalPaint defColors |
      >       "If we are on Windows and displaying a selection, don't
      change color
      >       (i.e. use the already set selectionForeground color, probably
      white)"
      >
      >       "Windows-like, i.e. normal selected text is not the same
      color as normal
      > text"
      >       defColors := aGC medium defaultWidgetPolicy class
      defaultColorWidgetColors.
      >       ((defColors matchAt: SymbolicPaint selectionForeground
      ifAbsent:
      > [ColorValue black]) ~=
      >       (defColors matchAt: SymbolicPaint foreground ifAbsent:
      [ColorValue black])
      >                and:
      >       ["Telling if we are in a selection is tricky, so we need to
      try a couple of
      > ways"
      >       "Scrolling and normal display in a TextView"
      >       aGC paint == SymbolicPaint selectionForeground or:
      >                ["DataSet visuals for InputFieldView - see
      DataSetView>>displayVisualsOn:"
      >                (aGC paintPreferencesMatchAt: SymbolicPaint
      selectionForeground) ==
      >                (aGC paintPreferencesMatchAt: SymbolicPaint
      foreground)]])
      >
      >                ifTrue:  [aBlock value]
      >                ifFalse:         [originalPaint := aGC paint.
      >                                  aGC paint: self color.
      >                                  aBlock ensure: [aGC paint:
      originalPaint]]
      >
      >
      > If I naively replace the 7.7 method with the 7.4 method, I get my
      colors
      > back.  So all the extra logic is causing the ifTrue block to be
      used when it
      > should be the ifFalse path.  I made the big mistake of trying to
      put a break
      > in this method to try to debug further.  Eventually I had to reboot
      after
      > locking up my system.  I also tried to unload the ExtraEmphasis
      parcel,
      > which also did not work and produced exceptions in every window.
      >
      > This method change seems to be expecting color foreground settings
      from the
      > widget settings, but I'm setting the color of fonts programatically
      based on
      > the type of object displayed.  So foreground colors can be
      different for
      > every row in the list or dataset.  But without being able to put a
      break
      > into this method without causing a runaway image makes debugging
      very
      > difficult.
      >
      > Probably need Cincom to work on this one, but thought I'd post as a
      warning.
      >
      > Mark Petersen
      >

      --
      Karsten Kusche - Dipl. Inf. - [hidden email]
      Georg Heeg eK - Köthen
      Handelsregister: Amtsgericht Dortmund A 12812

      _______________________________________________
      vwnc mailing list
      [hidden email]
      http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

--
Alan Knight [|], Engineering Manager, Cincom Smalltalk
[hidden email]
[hidden email]
http://www.cincom.com/smalltalk

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

pic08805.jpg (9K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Problem with vw7.7 ExtraEmphasis.ColoredText>>color:while:

Steven Kelly
In reply to this post by MarkPetersen
Those aren't really 7.4 and 7.7 versions of the code: they are versions
with and without a hacky correction for coloring text in a selection. On
Windows XP, red text should become white when selected. Before the
change, VW and ExtraEmphases left the text red, which was wrong for
Windows, and often hard to read against the blue selection background.

The right choice would probably be to change all of VWs widgets so they
force text in selections to be white, but that was obviously outside
ExtraEmphases' scope.

Looking forward, Microsoft seem to be moving towards selection being
accomplished with a translucent lighter blue covering and affecting the
whole row, text color included. Since we're still waiting for Vista and
Windows 7 look&feels from Cincom, it's a little unclear how best to
proceed. With Skinny, I've no idea how text coloring would work. With
Cairo, I imagine the new translucent selection would be easy, but the
old forcing to white would still require either a hack or then changes
to every widget.

As it stands, I don't think the basic idea of this hack is too bad. VW
already sets the text color to white for a selection; this just stops
ExtraEmphases changing it. I guess the quick solution is to find out why
the code now gives false positives in 7.7, and correct that. That test
should then be moved into its own message, to make things more readable.

Steve

> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On
> Behalf Of MarkPetersen
> Sent: 15 March 2010 18:31
> To: [hidden email]
> Subject: [vwnc] Problem with vw7.7
> ExtraEmphasis.ColoredText>>color:while:
>
>
> In migrating to VW7.7, I noticed that I lost the color of text items
in

> a
> List and DataSet.  Everything was simply black, even though an Inspect
> on
> the item showed that the text was emphasized with a color value.
> I tracked the issue down to the ExtraEmphasis.ColoredText color:while:
> method.  In the vw7.4 method, it was coded as:
>
> color: aGC while: aBlock
> | originalPaint |
> originalPaint := aGC paint.
> aGC paint: self color.
> aBlock ensure: [aGC paint: originalPaint]
>
> while in vw7.7 it is coded as:
> color: aGC while: aBlock
> "Change the color to that specified in this font"
>
> | originalPaint defColors |
> "If we are on Windows and displaying a selection, don't change
> color
> (i.e. use the already set selectionForeground color, probably
> white)"
>
> "Windows-like, i.e. normal selected text is not the same color
as

> normal
> text"
> defColors := aGC medium defaultWidgetPolicy class
> defaultColorWidgetColors.
> ((defColors matchAt: SymbolicPaint selectionForeground ifAbsent:
> [ColorValue black]) ~=
> (defColors matchAt: SymbolicPaint foreground ifAbsent:
> [ColorValue black])
> and:
> ["Telling if we are in a selection is tricky, so we need to try
a
> couple of
> ways"
> "Scrolling and normal display in a TextView"
> aGC paint == SymbolicPaint selectionForeground or:
> ["DataSet visuals for InputFieldView - see
> DataSetView>>displayVisualsOn:"
> (aGC paintPreferencesMatchAt: SymbolicPaint
> selectionForeground) ==
> (aGC paintPreferencesMatchAt: SymbolicPaint
foreground)]])
>
> ifTrue: [aBlock value]
> ifFalse: [originalPaint := aGC paint.
> aGC paint: self color.
> aBlock ensure: [aGC paint:
originalPaint]]

>
>
> If I naively replace the 7.7 method with the 7.4 method, I get my
> colors
> back.  So all the extra logic is causing the ifTrue block to be used
> when it
> should be the ifFalse path.  I made the big mistake of trying to put a
> break
> in this method to try to debug further.  Eventually I had to reboot
> after
> locking up my system.  I also tried to unload the ExtraEmphasis
parcel,
> which also did not work and produced exceptions in every window.
>
> This method change seems to be expecting color foreground settings
from

> the
> widget settings, but I'm setting the color of fonts programatically
> based on
> the type of object displayed.  So foreground colors can be different
> for
> every row in the list or dataset.  But without being able to put a
> break
> into this method without causing a runaway image makes debugging very
> difficult.
>
> Probably need Cincom to work on this one, but thought I'd post as a
> warning.
>
> Mark Petersen
> --
> View this message in context: http://n4.nabble.com/Problem-with-vw7-7-
> ExtraEmphasis-ColoredText-color-while-tp1593638p1593638.html
> Sent from the VisualWorks mailing list archive at Nabble.com.
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc