Lazarus

Programming => Widgetset => Other => Topic started by: x2nie on May 16, 2014, 11:54:26 am

Title: New Widgetset
Post by: x2nie on May 16, 2014, 11:54:26 am
Hi gurus !


I am looking for a step-by-step / tutorial of how to implement a widgetset as LCL interface.
Is there a link / explanation of it?
I've read the Lazarus code, I still don't know where I could start from.


Any pointer / advice would be appreciated.
Title: [solved] Re: New Widgetset
Post by: x2nie on May 16, 2014, 12:05:03 pm
okay, I have better keyword for search-engine's feed.
I found one:
http://wiki.lazarus.freepascal.org/LCL_Internals#How_to_create_a_new_Widgetset
Title: Re: [solved] Re: New Widgetset
Post by: JuhaManninen on May 16, 2014, 02:13:58 pm
okay, I have better keyword for search-engine's feed.
I found one:
http://wiki.lazarus.freepascal.org/LCL_Internals#How_to_create_a_new_Widgetset

Good luck :)

Zeljan has made bindings also for GTK3. It works somehow but is still in alpha state.
If you need practice with widgetsets, please consider improving it. Building Lazarus IDE using GTK3 would be a nice goal.
Title: Re: New Widgetset
Post by: valdir.marcos on May 16, 2014, 03:07:38 pm
See more information here:
http://forum.lazarus.freepascal.org/index.php/topic,23609.msg141128.html#msg141128
Title: Re: [solved] Re: New Widgetset
Post by: zeljko on May 16, 2014, 03:25:53 pm
Good luck :)

Zeljan has made bindings also for GTK3. It works somehow but is still in alpha state.
If you need practice with widgetsets, please consider improving it. Building Lazarus IDE using GTK3 would be a nice goal.

Well IDE builds with gtk3 and it even start :)
Title: Re: New Widgetset
Post by: Blaazen on May 16, 2014, 04:09:15 pm
When I try to run an empty project with GTk3 it always stop me in unit LazGObject2 at line 63:
Code: [Select]
G_PARAM_DEPRECATED: TGParamFlags = 2147483648;and when I comment it then it gives SIGSEGV in gtk3object.inc at
Code: [Select]
procedure TGtk3WidgetSet.SetDefaultAppFontName;
var
  AValue: TGValue;
begin
  AValue.init(G_TYPE_STRING);  //<--- HERE
  g_object_get_property(gtk_settings_get_default, 'gtk-font-name', @AValue);
  FDefaultAppFontName := AValue.get_string;
  AValue.unset;
end;
I've installed GTk3 libraries from repositories.
Title: Re: New Widgetset
Post by: x2nie on May 16, 2014, 04:58:48 pm
See more information here:
http://forum.lazarus.freepascal.org/index.php/topic,23609.msg141128.html#msg141128 (http://forum.lazarus.freepascal.org/index.php/topic,23609.msg141128.html#msg141128)
Nice, there are many link to same topic too. !

Zeljan has made bindings also for GTK3. It works somehow but is still in alpha state.
If you need practice with widgetsets, please consider improving it. Building Lazarus IDE using GTK3 would be a nice goal.
I wonder, is it possible to deploy an GTK3 application without building lazarus to GTK3 ?
I heard there was a cross-compile to do so, but this one is a mystery for me.

I can not found in Project Option about changing to specific widgetset.
How can we change the target widgetset of current active project when Lazarus is built in onther widgetset?
 :o
Title: Re: New Widgetset
Post by: x2nie on May 16, 2014, 05:01:17 pm
When I try to run an empty project with GTk3 ...
I've installed GTk3 libraries from repositories.

I can not found download link for "G.T.K.3".
I went to http://www.gtk.org/download/index.php
and only GTK+ download available.
Is GTK+ = GTK3 ?
Title: Re: New Widgetset
Post by: Blaazen on May 16, 2014, 06:00:47 pm
Your distro havn't got anything in repositories?

Quote
Is GTK+ = GTK3 ?
Just follow the links on that page. There are GTK+ versions 1.2 (old GTK), then 2.4 up to 2.24 (GTK2) and GTK 3. up to 3.10 (GTK3).
Title: Re: New Widgetset
Post by: zeljko on May 16, 2014, 07:57:37 pm
I wonder, is it possible to deploy an GTK3 application without building lazarus to GTK3 ?
I heard there was a cross-compile to do so, but this one is a mystery for me.

I can not found in Project Option about changing to specific widgetset.
How can we change the target widgetset of current active project when Lazarus is built in onther widgetset?
 :o

You mean is it possible to build eg. gtk2 application with lazarus qt ide ? Of course it is. That's main feature of lazarus :)
Yes, you can deploy your application whenever it works (arhitecture is ok and you have all needed libraries installed).
Title: Re: New Widgetset
Post by: zeljko on May 16, 2014, 07:58:38 pm
When I try to run an empty project with GTk3 it always stop me in unit LazGObject2 at line 63:
Code: [Select]
G_PARAM_DEPRECATED: TGParamFlags = 2147483648;and when I comment it then it gives SIGSEGV in gtk3object.inc at
Code: [Select]
procedure TGtk3WidgetSet.SetDefaultAppFontName;
var
  AValue: TGValue;
begin
  AValue.init(G_TYPE_STRING);  //<--- HERE
  g_object_get_property(gtk_settings_get_default, 'gtk-font-name', @AValue);
  FDefaultAppFontName := AValue.get_string;
  AValue.unset;
end;
I've installed GTk3 libraries from repositories.

Version of gtk3,glib2,cairo and pango libs is very important.




Title: Re: New Widgetset
Post by: Blaazen on May 16, 2014, 08:15:57 pm
I have (all from repos):
GTK 3.10.7.-2
Pango 1.36.2-1
Cairo 1.12.16-2
glib2 2.38.2-1
Title: Re: New Widgetset
Post by: JuhaManninen on May 16, 2014, 08:18:25 pm
I heard there was a cross-compile to do so, but this one is a mystery for me.

Cross-compilation is needed only when targeting another CPU and/or OS, not when selecting a different widgetset.

Quote
I can not found in Project Option about changing to specific widgetset.
How can we change the target widgetset of current active project when Lazarus is built in onther widgetset?

Project Option  -> Additions and Overrides -> Add -> Set "LCLWidgetType". Select GTK3.
Title: Re: New Widgetset
Post by: x2nie on May 17, 2014, 06:36:57 am
I can not found in Project Option about changing to specific widgetset. How can we change the target widgetset of current active project when Lazarus is built in onther widgetset? :o 

You mean is it possible to build eg. gtk2 application with lazarus qt ide ? Of course it is. That's main feature of lazarus :)
Yes, you can deploy your application whenever it works (arhitecture is ok and you have all needed libraries installed).

Project Option  -> Additions and Overrides -> Add -> Set "LCLWidgetType". Select GTK3.


Horay! I can't believe that finally I can do it (cross-widget-compile).


Anyway, the "Add - Set LCLWIdgetType" is not searchable !
We can NOT found it by typing "Widget" in Project-Option's SearchBox.

edit: add atachment
Title: Re: New Widgetset
Post by: zeljko on May 17, 2014, 09:03:25 am
I have (all from repos):
GTK 3.10.7.-2
Pango 1.36.2-1
Cairo 1.12.16-2
glib2 2.38.2-1

Fedora 19 64bit - everything ok, simple app works w/o problem.
gtk3-3.8.8-2.fc19.x86_64
pango-1.34.1-3.fc19.x86_64
cairo-1.12.14-2.fc19.x86_64
glib2-2.36.4-1.fc19.x86_64

Title: Re: New Widgetset
Post by: JuhaManninen on May 17, 2014, 11:29:32 am
Anyway, the "Add - Set LCLWIdgetType" is not searchable !
We can NOT found it by typing "Widget" in Project-Option's SearchBox.

Good point. The Additions and Overrides GUI is extremely powerful but also very geeky. You are not the only one who is puzzled with it.
Earlier the IDE Macros had a different GUI. I feel we should make a separate GUI for them again.
Even now LCLWIdgetType gets a special treatment as it has its own menu item but it is not visible without clicking the "Add" button and indeed the filter cannot find it.
The logical solution would be to make another pane above the grid and put a GUI for adding IDE Macros, Custom and OutDir settings there.
The grid has other usability issues, too. It is difficult to tell wich "Stored in " section is selected initially when opening the window.

You seem to have energy now for studying Lazarus. Maybe you can look at ide/frames/Compiler_ModeMatrix.pas ?
Title: Re: New Widgetset
Post by: x2nie on May 17, 2014, 01:39:41 pm
Hi JuhaManninen,
it is my first time opening Compiler_Matrix.pas. I will learn this first, and see if I can improve it.


Anyway, my new widgetset is based on fpGUI, so it is clear that I must edit above file because my widgetset has choices of whether "X11 or GDI" too.



Title: Re: New Widgetset
Post by: zeljko on May 17, 2014, 02:10:11 pm
Hi JuhaManninen,
it is my first time opening Compiler_Matrix.pas. I will learn this first, and see if I can improve it.


Anyway, my new widgetset is based on fpGUI, so it is clear that I must edit above file because my widgetset has choices of whether "X11 or GDI" too.
Why ? Should gdi ever work on linux or should X11 ever work on windows ? I don't think so, you should set that choices automatically inside widgetset without touching anything in lcl.
Title: Re: New Widgetset
Post by: x2nie on May 17, 2014, 02:39:48 pm
Anyway, my new widgetset is based on fpGUI, so it is clear that I must edit above file because my widgetset has choices of whether "X11 or GDI" too.
Why ? Should gdi ever work on linux or should X11 ever work on windows ? I don't think so, you should set that choices automatically inside widgetset without touching anything in lcl.
Which "work" do you refer to?
Under the term of compile, I think we can cross compile GDI in Linux and X11 on Windows. That is this Project-Option configuration designed for.
While refering to Run, of course it will "not work".
Title: Re: New Widgetset
Post by: Martin_fr on May 17, 2014, 02:55:01 pm
Maybe "Widgetset" should be added to the "Config and Target" page?
Title: Re: New Widgetset
Post by: Rails on May 17, 2014, 03:00:09 pm
Maybe "Widgetset" should be added to the "Config and Target" page?

Yes, that would make much more sense than its current location.  8)
Title: Re: New Widgetset
Post by: x2nie on May 17, 2014, 03:06:29 pm
Maybe "Widgetset" should be added to the "Config and Target" page?
Wait, Anyway, I think the issue is around the "not searchable", and it is occurred because several problem:
* TPopUp menu is not TWinControl, therefore all of popup's contents will be ignored. (I am working on fixing it)
* BMMAddPopupMenu is not populating it's contents until it being poped-up.
Give me more minutes, I will upload the patch
Title: Re: New Widgetset
Post by: x2nie on May 17, 2014, 03:13:18 pm
Okay, here is patch of TMenu = searchable, for IDE options.


Edit:
I've post the patch here: http://bugs.freepascal.org/view.php?id=26178
Title: Re: New Widgetset
Post by: JuhaManninen on May 17, 2014, 07:20:38 pm
Okay, here is patch of TMenu = searchable, for IDE options.

See my comments in the report. Your patch makes the usabilily worse and counter-intuitive. I know, designing an intuitive user interface is difficult but we must try.

I admire your energy, I would love to apply a patch from you so it will not get wasted. Just be careful with GUI usability issues. :)
Title: Re: New Widgetset
Post by: x2nie on May 18, 2014, 06:12:46 am
See my comments in the report. Your patch makes the usabilily worse and counter-intuitive. I know, designing an intuitive user interface is difficult but we must try.
I think you want to say: "Let forget any usage of TPopupMenu inside the IDE Options / Project Option, because they are hidden somehow".
If so, I am agree.
The alternative of TPopupMenu is already, there:
1. TreeView. Eclipse IDE uses it in many "preference"
2. ListBox + Switch Button. Lazarus uses in Project Option: Form:
AutoCreateForm <-->AvailableForm
3 TextBox / Combobox. in Project Option Resources: Resource | Resource Type


All of above will be used together with current Matrix-Grid.


Is it you mean with "intuitive" ?
TinyPortal © 2005-2018