Via VNC looking at the result of the GTK3 Theming result on a Pine64 running Ubuntu 16 LTS with Mate desktop. The VNC-server shows the result on the XFCE4-desktop. As you can see it looks great!
Just as Tim says: many MANY thanks for this fine solution.
And let’s not forget @jim mckay 's dogged determination on the deeper details.
I’ve also asked @Jason Parsley to pin this conversation in the Linux target section.
Yup, thanks a lot - also for providing the CSS live editor, which makes it so much more convenient to try different things.
Not with that title, please
I’d like to see this to be added to the example projects (in Platform-Specific/Linux/GTK3 Themes) that come along with Xojo.
[quote=407856:@Jürg Otter]Not with that title, please
I’d like to see this to be added to the example projects (in Platform-Specific/Linux/GTK3 Themes) that come along with Xojo.[/quote]
Why don’t you start a fresh thread that introduces the modGTK3 module and we’ll ask that they pin THAT one :).
… and, I changed the name
Since 2017r2, Xojo uses GTK3 for Linux. The default GTK3 Controls are quite big. That makes a cross platform layout quite difficult.
This example Xojo project shows how one can style Controls using CSS in Xojo-built Applications. The example is trying to just set a minimal amount of styles, so that Controls can be sized at
.Height=26 and look good on most Linux distributions.
This is achieved in two steps: A global theme, and some tweaks for a couple of Controls.
Many thanks to @jim mckay for digging in the deeper details providing the CSS live editor, which makes it so much more convenient to try different style adjustments!
The example Xojo project includes a Module
modGTK3. All the required Declares and Styles are in there. If you intend to use it in your own projects, have a look at where the global theme is set, and where/how the Control tweaks are set:
App.Open[/code] -> [code]modGTK3.InitGlobalGTK3Style()
Control.Open[/code] -> [code]me.InitGTK3Control()
InitGTK3Control for Controls. In this example project, it’s called from Control Subclasses. Subclassing your Controls is highly recommended anyway, as you get a single place for tweaks and workarounds for different XojoVersions or BuildTargets.
You’re probably wondering about the reply above
The main reason is that I usually don’t keep my DropBox links alive for long… so I’ve moved the example project to a Webserver, where my “Xojo - some pieces 4u” are available.
Since it is (for now), maybe you could mark it as the answer? So a link to the example project is right on top.
Such a fantastic job with this module. Well done!
Hey guys. I did a bunch more work on this (kind of got lost in it over the weekend)
I eliminated the need to subclass controls by adding handlers for the GtkWidget and GtkEntry classes ‘map’ signals. All controls’ height will be set to be at least their default ‘min-height’ property (not the css value) and all GtkEntries will have char-width set to zero.
Added conditional parsing for the CSS. #IF - #END IF style
I added a css nodes viewer and a GtkWidget properties viewer.
I put up a BitBucket of the project. Please take a look and add css for any quirks you find for specific distro’s, OS’s, Desktops and Xojo versions. (Syntax is very simple and explained in the readme.)
Be sure to add the init methods before any windows are shown or the ‘map’ signals will be missed.
Is this still working? When I add the mod following the instructions, I get an error when compiling:
There is no class with this name
Shared LastParsingError As modGTK3.GtkCssParsingErrorInfo[/quote]
That’s a very strange error…
Did you open the modGtk3.xojo_project and copy the module from there or drag it from the downloaded folder?
Did you add the full module to your project? It should look something like this is the Navigator:
[quote=444308:@jim mckay]That’s a very strange error…
Did you open the modGtk3.xojo_project and copy the module from there or drag it from the downloaded folder?[/quote]
I cannot open that, it ask immediately for the location of “Build Automation.xojo_code”,which is nowhere to be found.
It looks like Build Automation was added to my gitignore file and not uploaded. I’ve fixed the problem.
Great, it compiles now error free. Thanks for updating it!
Since you got me looking at the project, I’ve updated the repo to fix a 64bit bug in the demo and to improve tab panel handling to hopefully align contents correctly and aviod clipping.
[quote=398704:@Ivan Tellez]As my second post states, GTK is NOT designed to work in a fixed layout like apps in windows or Mac. So, the only way Xojo could fix this problem is to implement and expose the GTK native containers. But, doing that, they will break the multiplatform compatibility of the layout designer. So, not an easy solution.
But, Maybe if Xojo implement GTK in ALL 3 desktop platforms…
- Lots of contros out of the box for xojo
- Great Layout widgets to make modern interfaces
- Awesome performance with hardware accelerated drawing
- Consistency in all the 3 platforms
- Cairo Drawing could be used to add PDF capabilities
- Xojo team will focus in 1 UI instead of 3
- Apps with themes in all the platforms.
Feedback Case 52860 - Implement the full GTK widget set and Cairo drawings on all 3 platforms for better multiplatform compatibility
Gimp On Windows
Gimp On Linux
Gimp On Mac
New Gimp style On Windows
New Gimp style On Windows other theme
Feedback Case 52860 - Implement the full GTK widget set and Cairo drawings on all 3 platforms for better multiplatform compatibility[/quote]
I think the idea of using GTK on Mac and Windows would spoil the whole idea of Xojo using native UI.
And while on Windows this can be doable due there is much more UI look & feel fragmentation, this would be a disaster on Mac. Does someone notice on Mac it looks UGLY?
I personally don’t want my Mac applications looking like that and if Xojo would ever think to implement this, I would probably search for alternatives. There are other cross platform environments around, but all of them fail on the UI due to non native controls, etc.
This is one of biggest plus of Xojo. It looks great on all platforms.
[quote]I personally don’t want my Mac applications looking like that and if Xojo would ever think to implement this, I would probably search for alternatives. There are other cross platform environments around, but all of them fail on the UI due to non native controls, etc.
This is one of biggest plus of Xojo. It looks great on all platforms.[/quote]
Whilst the concept of native GUI controls for each OS is great in practice we actually get the lowest common denominator because there are so many differences between the three desktop platforms. For example, this is probably why we still dont have a date picker control without having to spend additional money for a third party solution.
Additionally, because Xojo dont provide that many controls themselves (because they have to cater for all three platforms with three different GUI toolkits) developers end up with non-native canvas-based hacks to simulate what has already been implemented in a cross-platform toolkit like GTK3.
Personally, I would have no problem at all if Xojo decided to support GTK3 on all three platforms. That would actually speed up development time for me. Much of my debugging time is spent fixing weird GUI glitches between platforms which would probably be solved if there was just one underlying toolkit. I find the logic side of my apps tends to just work as advertised by Xojo but the GUI side is often broken.
Additionally, even as a die hard macOS user, I really dont mind the look of GTK3.
Just my two cents.
[quote=444552:@Massimo Valle]I think the idea of using GTK on Mac and Windows would spoil the whole idea of Xojo using native UI.
But … if you look at modern Mac apps, you’ll discover that they really aren’t adhering to any specific look and feel outside of a design that works for them - even Apple’s own apps.