[lazarus] Forms inside a library
Steve Gatenby
steveg at nevets.com.au
Sun Mar 16 19:49:50 EST 2003
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:
> 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, at Info);
> + if (TheType = 0)
> + then begin
> + TheType := gtk_type_from_name(TYPE_NAME);
> + if TheType = 0
> + then TheType := gtk_type_unique(gtk_fixed_type, at 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 lazarus-request at miraclec.com with
> "unsubscribe" as the Subject
> archives at http://www.lazarus.freepascal.org/mailarchives
>
More information about the Lazarus
mailing list