Hi
I try to investigate why setcolor in form don't work (in Linux+GTK)
in simple program
procedure testBrush;
begin
Application.CreateForm(TForm1, Form1);
form1. color:=clred; <-- this not work
Application.Run;
end;
I make procedure to set style of widget and try where this work
procedure setMyColor(aColor: longint;var aWidget : pGTKWidget);
var
WindowStyle: PGtkStyle;
czerwony:tGDKColor;
begin
windowStyle:=gtk_widget_get_style(aWidget);
czerwony:=AllocGDKColor(aColor);
windowstyle^.bg[0]:=czerwony;
gtk_widget_set_style(aWidget,WindowStyle);
end;
And I discover, that in function CreateDCForWidget is critical place
function TGtkWidgetSet.CreateDCForWidget(TheWidget: PGtkWidget;
TheWindow: PGdkWindow; WithChildWindows: boolean): HDC;
.....
writeln(' create a new device context for this window');
setMyColor($f61111,theWidget); <--- this work
if TheWindow=nil then begin
ClientWidget := GetFixedWidget(TheWidget);
if ClientWidget = nil then RaiseWidgetWithoutClientArea;
TheWindow:=GetControlWindow(ClientWidget);
if TheWindow=nil then begin
//force creation
setMyColor($f61111,theWidget); <-- this works
gtk_widget_realize(ClientWidget);
setMyColor($f61111,theWidget); <-- this not work
gtk_widget_unrealize(ClientWidget);
setMyColor($f61111,theWidget); <-- this work
gtk_widget_realize(ClientWidget);
TheWindow := GetControlWindow(ClientWidget);
if TheWindow=nil then
RaiseException('TGtkWidgetSet.CreateDCForWidget: Unable to
realize GdkWindow');
end;
end else
ClientWidget:=TheWidget;
writeln('stop create');
setMyColor($f61111,theWidget); <-this not work
--------------
for me problem is with gtk_widget_realize and gtk_widget_unrealize
when widget is realized then no changes of color can be made
any hints
Regards
Darek
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives