[Lazarus] Gdk Questions

Paulo Malheiros paulo.malheiros at fe.up.pt
Tue Sep 16 18:21:58 CEST 2008


It didn't fail on my Ubuntu Hardy Gtk2. Works fine.
I used:

implementation

uses gtk2, gdk2;

{ TForm1 }

procedure TForm1.Button1Click(Sender: TObject);
var
    GdkWindow     :PGdkWindow;
    GtkWidget     :PGtkWidget;
begin
    GtkWidget := pointer( Form1.Handle );
    GdkWindow := GtkWidget^.window;
    Memo1.Lines.Add(GtkWidget^.name);
    if GDK_IS_WINDOW(GdkWindow) then memo1.lines.add('Is Window');
end;


Regards,
Paulo



Quoting SteveG <steveg at nevets.com.au>:

> Could anybody tell me why the following fails ?
>
> uses ..., gtk2, glib2, gdk2;
>
> procedure TForm1.Button1Click(Sender: TObject);
> var
>   GdkWindow     :PGdkWindow;
>   GtkWidget     :PGtkWidget;
> begin
>   GtkWidget := pointer( Form1.Handle );
>   GdkWindow := GtkWidget^.window;
>   if GDK_IS_WINDOW(GdkWindow) then memo1.lines.add('Is Window');
> end;
>
> I know the GtkWidget is correct, as reading 'GtkWidget^.name' returns
> the correct data (Form1)
> GdkWindow is filled from the GtkWidget (not NIL) - correct or not I dont
> know
> What I have found, is that any 'Gdk_Window' operation on the data from
> GtkWidget^.window fails
>
> The form is showing and focused (realized), and I have tried
> 'gdk_window_get_toplevel(GtkWidget^.window)' as well - also fails
>
> I am beginning to feel that Gtk/Gdk/xWin is for propeller heads flying a
> lot higher than me :)
>
> any thoughts at all appreciated
>
> SteveG
> _______________________________________________
> Lazarus mailing list
> Lazarus at lazarus.freepascal.org
> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>






More information about the Lazarus mailing list