Sign in Join

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

Mailing lists / lazarus / 2003-03

Forms inside a library

6 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

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

Steve Gatenby
to Marc Weustink: At the time I wrote LCLWinapiWidget I wasn't a gtk expert (and that's still the case :),…

Marc - thanks for the reply - I have never used a patch file before, so after a little study (ie man patch) I used the following 1- saved all between <patch> to </patch> to textfile 'winapipatch' 2- placed patch file in /lazarus/lcl/interfaces/gtk directory 3- changed to same dir in shell
4- tried 'patch gtkwinapiwindow.pp winapipatch
kept getting errors at this point (probably something I have wrong)

So - I manually applied changes to orig file (cut/paste) and rebuilt All seems to be working fine now - really appreciated !

Could you let me know what I did wrong in applying the patch ?

Thanks

Marc Weustink wrote 88 lines
At 02:24 17-3-2003 +1100, Steve Gatenby wrote: > Is it possible to display forms contained in a library (lib***.so) ? > I can use libraries for all non-graphical functions without problems, > but fail with "Gtk-Warning **: gtk_type_create(): type > 'LCLWinapiWidget already exists" > > Any ideas on this ?? At the time I wrote LCLWinapiWidget I wasn't a gtk expert (and that's still the case :), so the code there is merely based on examples and some GTK internals (I used gtkedit ? as an example). However looking at it now I can imagine your problem. I wrote a little patch based on dox, but couldn't test it. So I didn't commit it to cvs. If you aply the patch and it works, please let me know. Marc <patch> Index: gtkwinapiwindow.pp =================================================================== RCS file: /FPC/CVS/projects/lazarus/lcl/interfaces/gtk/gtkwinapiwindow.pp,v retrieving revision 1.43 diff -u -r1.43 gtkwinapiwindow.pp --- gtkwinapiwindow.pp 30 Dec 2002 17:24:08 -0000 1.43 +++ gtkwinapiwindow.pp 16 Mar 2003 23:33:36 -0000 @@ -331,10 +331,11 @@ end; function GTKAPIWidgetClient_GetType: Guint; const + TYPE_NAME = 'LCLWinapiClient'; TheType: Guint = 0; Info: TGTKTypeInfo = ( - type_name: 'LCLWinapiClient'; + type_name: TYPE_NAME; object_size: SizeOf(TGTKAPIWidgetClient)+100; class_size: SizeOf(TGTKAPIWidgetClientClass)+100; class_init_func: @GTKAPIWidgetClient_ClassInit; @@ -344,8 +345,12 @@ base_class_init_func: nil; ); begin - if (TheType = 0) then - TheType := gtk_type_unique(gtk_fixed_type,@Info); + if (TheType = 0) + then begin + TheType := gtk_type_from_name(TYPE_NAME); + if TheType = 0 + then TheType := gtk_type_unique(gtk_fixed_type,@Info); + end; Result := TheType; end; @@ -674,9 +679,10 @@ function GTKAPIWidget_GetType: Guint; const + WAW_NAME = 'LCLWinapiWidget'; wawType: Guint = 0; wawInfo: TGTKTypeInfo = ( - type_name: 'LCLWinapiWidget'; + type_name: WAW_NAME; object_size: SizeOf(TGTKAPIWidget)+100; // a TGTKScrolledWindow class_size: SizeOf(TGTKAPIWidgetClass)+100; class_init_func: @GTKAPIWidget_ClassInit; @@ -687,7 +693,11 @@ ); begin if (wawType = 0) - then wawType := gtk_type_unique(gtk_scrolled_window_get_type, @wawInfo); + then begin + wawType := gtk_type_from_name(WAW_NAME); + if wawType = 0 + then wawType := gtk_type_unique(gtk_scrolled_window_get_type, @wawInfo); + end; Result := wawType; end; </patch> _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives

Reply by email

Marc Weustink
to Steve Gatenby: Is it possible to display forms contained in a library (lib***.so) ? I can use libraries…
Steve Gatenby wrote 6 lines
Is it possible to display forms contained in a library (lib***.so) ? I can use libraries for all non-graphical functions without problems, but fail with "Gtk-Warning **: gtk_type_create(): type 'LCLWinapiWidget already exists" Any ideas on this ??

At the time I wrote LCLWinapiWidget I wasn't a gtk expert (and that's still the case :), so the code there is merely based on examples and some GTK internals (I used gtkedit ? as an example).

However looking at it now I can imagine your problem. I wrote a little patch based on dox, but couldn't test it. So I didn't commit it to cvs. If you aply the patch and it works, please let me know.

Marc

<patch>
Index: gtkwinapiwindow.pp
=================================================================== RCS file: /FPC/CVS/projects/lazarus/lcl/interfaces/gtk/gtkwinapiwindow.pp,v retrieving revision 1.43
diff -u -r1.43 gtkwinapiwindow.pp
--- gtkwinapiwindow.pp 30 Dec 2002 17:24:08 -0000 1.43 +++ gtkwinapiwindow.pp 16 Mar 2003 23:33:36 -0000 @@ -331,10 +331,11 @@

  end;
  function GTKAPIWidgetClient_GetType: Guint;
  const
+  TYPE_NAME = 'LCLWinapiClient';
    TheType: Guint = 0;
    Info: TGTKTypeInfo = (
-    type_name: 'LCLWinapiClient';
+    type_name: TYPE_NAME;
      object_size: SizeOf(TGTKAPIWidgetClient)+100;
      class_size: SizeOf(TGTKAPIWidgetClientClass)+100;
      class_init_func: @GTKAPIWidgetClient_ClassInit;
@@ -344,8 +345,12 @@
      base_class_init_func: nil;
    );
  begin
-  if (TheType = 0) then
-    TheType := gtk_type_unique(gtk_fixed_type,@Info);
+  if (TheType = 0)
+  then begin
+    TheType := gtk_type_from_name(TYPE_NAME);
+    if TheType = 0
+    then TheType := gtk_type_unique(gtk_fixed_type,@Info);
+  end;
    Result := TheType;
  end;

@@ -674,9 +679,10 @@

  function GTKAPIWidget_GetType: Guint;
  const
+  WAW_NAME = 'LCLWinapiWidget';
    wawType: Guint = 0;
    wawInfo: TGTKTypeInfo = (
-    type_name: 'LCLWinapiWidget';
+    type_name: WAW_NAME;
      object_size: SizeOf(TGTKAPIWidget)+100; // a TGTKScrolledWindow
      class_size: SizeOf(TGTKAPIWidgetClass)+100;
      class_init_func: @GTKAPIWidget_ClassInit;
@@ -687,7 +693,11 @@
    );
  begin
    if (wawType = 0)
-  then wawType := gtk_type_unique(gtk_scrolled_window_get_type, @wawInfo);
+  then begin
+    wawType := gtk_type_from_name(WAW_NAME);
+    if wawType = 0
+    then wawType := gtk_type_unique(gtk_scrolled_window_get_type, @wawInfo);
+  end;
    Result := wawType;
  end;
</patch>

Reply by email

Mattias Gaertner
to Marc Weustink
Show quoted text 12 lines
Marc - thanks for the reply - I have never used a patch file before, so after a little study (ie man patch) I used the following 1- saved all between <patch> to </patch> to textfile 'winapipatch' 2- placed patch file in /lazarus/lcl/interfaces/gtk directory 3- changed to same dir in shell 4- tried 'patch gtkwinapiwindow.pp winapipatch kept getting errors at this point (probably something I have wrong) So - I manually applied changes to orig file (cut/paste) and rebuilt All seems to be working fine now - really appreciated ! Could you let me know what I did wrong in applying the patch ?

Strange patch. You have to increase the fuzz factor and deactivate space comparison:

patch -p0 -F4 -l -i diff.txt

Marc, how did you create it?
I applied it to cvs.

Mattias

Show quoted text 98 lines
Thanks Marc Weustink wrote: > At 02:24 17-3-2003 +1100, Steve Gatenby wrote: > >> Is it possible to display forms contained in a library (lib***.so) ? >> I can use libraries for all non-graphical functions without problems, >> but fail with "Gtk-Warning **: gtk_type_create(): type >> 'LCLWinapiWidget already exists" >> >> Any ideas on this ?? > > > At the time I wrote LCLWinapiWidget I wasn't a gtk expert (and that's > still the case :), so the code there is merely based on examples and > some GTK internals (I used gtkedit ? as an example). > > However looking at it now I can imagine your problem. I wrote a little > patch based on dox, but couldn't test it. So I didn't commit it to cvs. > If you aply the patch and it works, please let me know. > > Marc > > <patch> > Index: gtkwinapiwindow.pp > =================================================================== > RCS file: > /FPC/CVS/projects/lazarus/lcl/interfaces/gtk/gtkwinapiwindow.pp,v > retrieving revision 1.43 diff -u -r1.43 gtkwinapiwindow.pp > --- gtkwinapiwindow.pp 30 Dec 2002 17:24:08 -0000 1.43 > +++ gtkwinapiwindow.pp 16 Mar 2003 23:33:36 -0000 > @@ -331,10 +331,11 @@ > end; > > function GTKAPIWidgetClient_GetType: Guint; > const > + TYPE_NAME = 'LCLWinapiClient'; > TheType: Guint = 0; > Info: TGTKTypeInfo = ( > - type_name: 'LCLWinapiClient'; > + type_name: TYPE_NAME; > object_size: SizeOf(TGTKAPIWidgetClient)+100; > class_size: SizeOf(TGTKAPIWidgetClientClass)+100; > class_init_func: @GTKAPIWidgetClient_ClassInit; > @@ -344,8 +345,12 @@ > base_class_init_func: nil; > ); > begin > - if (TheType = 0) then > - TheType := gtk_type_unique(gtk_fixed_type,@Info); > + if (TheType = 0) > + then begin > + TheType := gtk_type_from_name(TYPE_NAME); > + if TheType = 0 > + then TheType := gtk_type_unique(gtk_fixed_type,@Info); > + end; > Result := TheType; > end; > > @@ -674,9 +679,10 @@ > > function GTKAPIWidget_GetType: Guint; > const > + WAW_NAME = 'LCLWinapiWidget'; > wawType: Guint = 0; > wawInfo: TGTKTypeInfo = ( > - type_name: 'LCLWinapiWidget'; > + type_name: WAW_NAME; > object_size: SizeOf(TGTKAPIWidget)+100; // a TGTKScrolledWindow > class_size: SizeOf(TGTKAPIWidgetClass)+100; > class_init_func: @GTKAPIWidget_ClassInit; > @@ -687,7 +693,11 @@ > ); > begin > if (wawType = 0) > - then wawType := gtk_type_unique(gtk_scrolled_window_get_type, > @wawInfo);+ then begin > + wawType := gtk_type_from_name(WAW_NAME); > + if wawType = 0 > + then wawType := gtk_type_unique(gtk_scrolled_window_get_type, > @wawInfo); > + end; > Result := wawType; > end; > </patch> > > _________________________________________________________________ > To unsubscribe: mail with > "unsubscribe" as the Subject > archives at http://www.lazarus.freepascal.org/mailarchives > _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives

Reply by email

Marc Weustink
to Steve Gatenby: Marc - thanks for the reply - I have never used a patch file before, so after a little…

+ From: Steve Gatenby
+
+ Marc - thanks for the reply - I have never used a patch file before, so
+ after a little study (ie man patch) I used the following
+ 1- saved all between <patch> to </patch> to textfile 'winapipatch'
+ 2- placed patch file in /lazarus/lcl/interfaces/gtk directory
+ 3- changed to same dir in shell
+ 4- tried 'patch gtkwinapiwindow.pp winapipatch
+ kept getting errors at this point (probably something I have wrong)

+ So - I manually applied changes to orig file (cut/paste) and rebuilt
+ All seems to be working fine now - really appreciated !

OK, I'll commit the change tonight.

+ Could you let me know what I did wrong in applying the patch ?

I'm not a patch expert either, but IMO it should work. Don't know what errors you get.

Marc

Reply by email

Steve Gatenby

Is it possible to display forms contained in a library (lib***.so) ? I can use libraries for all non-graphical functions without problems, but fail with "Gtk-Warning **: gtk_type_create(): type 'LCLWinapiWidget already exists"

Any ideas on this ??

Thanks

Reply by email