[Gambas-user] how to detect compilation runtime componets available?

Bruce Steers bsteers4 at gmail.com
Thu Apr 1 19:46:25 CEST 2021


So use
If Component.IsLoaded("gb.gui")
to test for gb.gui explicitly.

Or there's using "Try" to attempt something and see if it's possible?
something like ..

Dim sVar As String, HasGUI as Boolean
Try sVar = Message("Hello")
If Error Then
  Print "Hello"
  HasGUI=False
Else
  HasGUI=True
Endif

On Thu, 1 Apr 2021 at 18:29, PICCORO McKAY Lenz <mckaygerhard at gmail.com>
wrote:

> ha ha ha thanks but now get a problem.. i trey to detect as suggested
> and ok.. but at build time it fails.. if i do not have gb.gui loaded..
>
> i guess i do not ask correctly but it makes sense.. i cannot use
> message if i do not have gb.gui component defined XD
> El jue, 1 de abr. de 2021 a la(s) 13:12, Bruce Steers
> (bsteers4 at gmail.com) escribió:
> >
> > Something like this will work..
> >
> > Public Sub GetGUI() As String
> > Dim GUIs As String[] = ["gb.gtk", "gb.gtk3", "gb.qt4", "gb.qt5"]
> > For Each gui As String In GUIs
> >  if Component.IsLoaded(gui) then Return gui
> > Next
> >
> > Return "wayland"
> > End
> >
> >
> > Something like that
> > BruceS
> >
> >
> > On Thu, 1 Apr 2021 at 16:44, PICCORO McKAY Lenz <mckaygerhard at gmail.com>
> wrote:
> >>
> >> how to detect compilation runtime components available?
> >>
> >> by example try to detect if gb.gui are loaded or used or compiled in
> >> the project/app and if true, then try to use some gui things.. if not
> >> just use console only..
> >>
> >> Lenz McKAY Gerardo (PICCORO)
> >> http://qgqlochekone.blogspot.com
> >>
> >> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
> >
> >
> > ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210401/84928cdd/attachment.htm>


More information about the User mailing list