Thanks for your answer here Mattias - GetActiveWindow does seem to be just what I need to be able to create my own code from - but I cant get it to work :( I have extracted the function and placed in a new app - causes exception at gtk_is_window
Are Gtk windows the same as Gdk windows ? - 'get_toplevels' returns gdkwindows, but using as gtkwindow ? uses gtk2, glib, gdk; function GetActiveWindow :integer; var TopList, List: PGList; Widget: PGTKWidget; Window: PGTKWindow; begin Result := 0; TopList := glib.pglist(gdk_window_get_toplevels); List := TopList; while List <> nil do begin if (List^.Data <> nil) then begin gdk_window_get_user_data(PGDKWindow(List^.Data), Pgpointer(@Window)); // --------FAILS AT NEXT LINE // if gtk_is_window(Window) then begin Widget := Window^.focus_widget; if Widget=nil then Widget:=PGtkWidget(Window); if (Widget <> nil) and gtk_widget_has_focus(Widget) then begin Result := 1;//PtrUInt(GetMainWidget(PGtkWidget(Window))); Break; end; end; end; list := g_list_next(list); end; if TopList <> nil then g_list_free(TopList); end; Mattias Gärtner wrote: > Zitat von SteveG <[EMAIL PROTECTED]>: > > >> Need some pointers on the way Laz/fpc handle gtkwidgets if possible. >> >> I am attempting (as a test) to get and then set the size and position of >> a Laz form using Gtk / Gdk - (not necessary I know, just leading to >> further things) >> > > See in gtk intf: > procedure SetWindowSizeAndPosition > > > _______________________________________________ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus