[Gambas-user] Making an app gtk/qt switchable

Tobias Boege taboege at gmail.com
Sat Nov 14 23:25:07 CET 2020

On Sat, 14 Nov 2020, Bruce Steers wrote:
> On Sat, 14 Nov 2020 at 20:38, Bruce <adamnt42 at gmail.com> wrote:
> > On 15/11/20 6:04 am, Bruce Steers wrote:
> > > Greetings all.
> > > I'm trying to set an arg/option in my app to choose gui system.
> > >
> > > I'm out of ideas...
> > > Is it even possible to do?
> > > Cheers
> > > BruceS
> > >
> > >
> > No.
> > (Answered several times earlier - search the archives)
> > b
> >
> yeah but Gambas IDE never used to be able to do it either but now it seems
> it can.

Since when? I did not see anything relevant in the last seven days of
git log messages. If you find the commit, or can narrow it down more,
it will be much easier to find the relevant code. Or if you can point
to a button/menu in the IDE where this functionality sits now, I may
be able to find it faster.

... that is what I would ask if I took your statement at face value.
Here's an alternate response based on some speculations about what
you observed and that you drew a wrong conclusion:

Gambas programs using gb.gui can set the toolkit to use via a GB_GUI
environment variable *on process startup*. This has been available for
a long time. That component, however, does not allow switching the
toolkit later during runtime, as far as I know. By the time your
program gets to interpret a --gui option from the command-line, it's
already too late. Instead of supplying the --gui option, set the
GB_GUI environment variable before starting the process, or do what
Tony suggested (but avoid Shell and use Exec With instead).

Related to that is *probably* that GTK is getting a webview now.
Erstwhile, the IDE could only use gb.qt* because it needed a webview
to display the help window. Therefore the IDE had a hard dependency
on gb.gui.qt before, but with the GTK webview available, it can relax
the dependency back to gb.gui, which supports the startup switching
and makes the IDE prefer the GIMP toolkit on systems not running a
K desktop session.

That's why you may see more recent IDEs start up not using QT on your
system and why you can now switch the IDE's toolkit on startup.
But that feature is not to be found in the IDE source code and it
is not dynamic at all.


"There's an old saying: Don't change anything... ever!" -- Mr. Monk

More information about the User mailing list