[lazarus] Black clBtnFace fix? was Patch forsearchresults dialog
Tony Maro
tony at maro.net
Sun Nov 23 17:54:29 EST 2003
Andrew Johnson wrote:
>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
>
>
Close. You can't pass nil as the success variable to
gdk_colormap_alloc_colors. After fixing that it works great, fixes the
build Lazarus dialog, static text, clBtnFace, etc...
Try this. Add:
Var
success: Boolean;
...snip...
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, @success);
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);
More information about the Lazarus
mailing list