Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2008-09

Gdk Questions

5 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

SteveG

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

Reply by email

Paulo Malheiros
to SteveG

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 :

Show quoted text 35 lines
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 http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Paulo Malheiros
to SteveG: Could anybody tell me why the following fails ? uses ..., gtk2, glib2, gdk2; procedure…

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 :

Show quoted text 35 lines
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 http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

SteveG
to Paulo Malheiros

Thanks Paulo - could you tell me what version Lazarus you are using ? I have 0.9.25 (svn 15686) - also on Ubuntu Hardy

I just did a full update of Ubuntu updates and rebooted to be sure Then created a new project and direct copied the code below to the app - fails for me every time at GDK_IS_WINDOW

Your Laz ver may help me track it down, or I will have to find another system with Ubuntu for comparison testing

Regards - SteveG

Paulo Malheiros wrote 21 lines
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;

Reply by email

Paulo Malheiros
to SteveG

SteveG,

I successfully tested in the official release 0.9.24, both in Ubuntu Hardy and also in Mandriva 2008.0. Apparently there's something different in the SVN version, hope it doesn't go to 0.9.26.

Good luck in your quest.

Paulo

Quoting SteveG :

Show quoted text 40 lines
Thanks Paulo - could you tell me what version Lazarus you are using ? I have 0.9.25 (svn 15686) - also on Ubuntu Hardy I just did a full update of Ubuntu updates and rebooted to be sure Then created a new project and direct copied the code below to the app - fails for me every time at GDK_IS_WINDOW Your Laz ver may help me track it down, or I will have to find another system with Ubuntu for comparison testing Regards - SteveG Paulo Malheiros wrote: > 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; > > _______________________________________________ Lazarus mailing list http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email