[lazarus] Black clBtnFace fix? was Patchforsearchresults dialog

Andrew Johnson acjgenius at earthlink.net
Sun Nov 23 07:35:27 EST 2003


I think you are correct and I am a moron. I am mixing up functions in my
head, which is probably what happened when I added that code.

At this function if invalid it should be _allocating_ a color not
querying for one.

so it should be, if invalid pixel, allocate, else, query.

so it should look something like -

if (result.foreground.pixel = 0) and ((result.foreground.red <> 0) or
(result.foreground.blue <> 0) or (result.foreground.green <> 0)) then
begin
  if (style <> nil) and (style^.colormap <> nil) then  
    gdk_colormap_alloc_colors(style^.colormap, @result.foreground, 1,
false, true, nil);
  else
    gdk_colormap_alloc_colors(gdk_colormap_get_system(),
@result.foreground, 1, false, true, nil);

end else 
  if (style <> nil) and (style^.colormap <> nil) then
    gdk_colormap_query_color(style^.colormap,result.foreground.pixel,
@result.foreground)
  else      
    gdk_colormap_query_color(gdk_colormap_get_system(),
result.foreground.pixel, @result.foreground);


so please test this out. later today I will look ad test myself, 
and if it works for everything I will commit a fix.

Andrew

On Sun, 2003-11-23 at 02:47, Tony Maro wrote:
> > -----Original Message-----
> > From: Andrew Johnson [mailto:acjgenius at earthlink.net] 
> > 
> > Coul you try adding a test? This will not work for gtk2 
> > because gtk2 is different but if you add a test that does 
> > something like this -
> > 
> > if (result.foreground.pixel = 0) and ((result.foreground.red 
> > <> 0) or (result.foreground.blue <> 0) or 
> > (result.foreground.green <> 0)) then
> >   if (style <> nil)
> > 	.....
> > 
> > it _might_ fix it for when the color already has a valid pixel.
> > 
> > which sounds like in this case it is.
> > 
> 
> Maybe I said it backwards, but whatever color I pick results in a pixel
> equal to zero, so your conditional would always run.  Also, I thought
> the code you're asking to wrap this in would take a pixel and turn it
> into RGB, not the other way around...  Since my pixel is invalid (0) it
> wipes the RGB value.  Am I reading this backwards?
> 
> -Tony
> 
> _________________________________________________________________
>      To unsubscribe: mail lazarus-request at miraclec.com with
>                 "unsubscribe" as the Subject
>    archives at http://www.lazarus.freepascal.org/mailarchives






More information about the Lazarus mailing list