RAD for Linux

User projects written in or related to FreeBASIC.
Munair
Posts: 110
Joined: Oct 19, 2017 15:00
Contact:

RAD for Linux

Postby Munair » Nov 04, 2017 15:34

Hi all.

Long ago, in the 1980s my programming career started with QuickBASIC 4.5 and later QuickBASIC PDS 7.1. At the time I developed a text UI with controls and IDE with syntax highlighting.

In 2007 when Linux became my main OS, I greatly missed RAD software like Visual Studio or Delphi. I know, there is Glade and other tools that can help to fill that void but it isn't quite the same.

Then I came across RealBasic later called RealStudio and Xojo. But it was proprietary and Linux support wasn't too good, especially printer dialogs etc. But I very much liked the RealStudio interface; software development made easy and fast.

Because I like the freebasic compiler (although I still miss full class support) I am thinking about developing a RAD against GTK specifically for Linux similar to RealStudio to make software development for Linux easy and fast. I hope such a project will benefit the Linux community (and FreeBASIC let's not forget).

A first setup may give an impression as to how GUI coding will look like. The following code shows a default window:

Code: Select all

#include "fx2.bi"

gtk_init(@__FB_ARGC__, @__FB_ARGV__)

type TWindow1 extends fxTWindow
  'Label1 as fxTLabel
end type

dim Window1 as TWindow1

Window1.Show()
fxMain()

end

Although I like Qt more than GTK, I believe the latter is the way to go because of its open source. Any ideas, suggestions are welcome!
Last edited by Munair on Nov 14, 2017 2:59, edited 1 time in total.
marcov
Posts: 2373
Joined: Jun 16, 2005 9:45
Location: Eindhoven, NL
Contact:

Re: RAD for Linux

Postby marcov » Nov 08, 2017 16:33

As a Freepascal/Lazarus devel I've engaged in several discussions about what it would take to do something similar in FB.

Search for lazarus on this forum will yield threads like:

viewtopic.php?f=8&t=23168#p203780
viewtopic.php?f=17&t=24901&hilit=lazarus
viewtopic.php?f=17&t=23484&p=206942&hilit=lazarus#p206938
viewtopic.php?f=3&t=19862&hilit=lazarus#p174094

and more, mostly in older threads <2012-2013, often discussions with TJF. Some of the threads above stress some needed language features. (rtti, metaclasses) I assume the old FB-has-no-OOP can be laid to rest.
Munair
Posts: 110
Joined: Oct 19, 2017 15:00
Contact:

Re: RAD for Linux

Postby Munair » Nov 08, 2017 19:11

Thank you for sharing the links Marco. I will have a look.

I currently develop software using Lazarus and it works great, but my background is primarily (Quick)BASIC. I was able to quickly develop software for Linux with RealBasic (now Xojo). However, I wouldn't recommend it, not just because it's commercial but also because support for Linux has become poor to say the least.

I tried FreeBasic several times in the last 10 years and it has become quite mature. I believe it is now possible to at least mimic Real Studio with a simple, clean interface. The hard part is setting up a GUI library against GTK. Most examples I look at come from C source code and some things just need some figuring out. E.G. setting the max width and height for a window:

Code: Select all

constructor TwMain()
   Handle = gtk_window_new(GTK_WINDOW_TOPLEVEL)
   SetSize 600, 400
   ' min size must be set first for max size to work
   SetMinSize fxWindowMinSize
   SetMaxSize 800, 600
end constructor

Currently, the goal is not cross-platform capability. Focus will be on Linux for the time being.
marcov
Posts: 2373
Joined: Jun 16, 2005 9:45
Location: Eindhoven, NL
Contact:

Re: RAD for Linux

Postby marcov » Nov 08, 2017 20:30

That looks like just writing gui code, not really RAD. For me RAD is also non visual components and two way designer (not just designing, generating code, and then doing the rest in code. Also later maintenance must be possible visually)
Munair
Posts: 110
Joined: Oct 19, 2017 15:00
Contact:

Re: RAD for Linux

Postby Munair » Nov 08, 2017 21:21

marcov wrote:That looks like just writing gui code, not really RAD. For me RAD is also non visual components and two way designer (not just designing, generating code, and then doing the rest in code. Also later maintenance must be possible visually)

The project just started and before visual components and a designer, GTK must be implemented. That's what I'm currently working on. So when the user creates a new window, a constructor is automatically created (out of sight). An OnCreate handler can be setup by the user etc. The code above is a first setup and far from finished. I posted it to show GTK behaviour that must be taken into account:

Code: Select all

' min size must be set first for max size to work
SetMinSize fxWindowMinSize
SetMaxSize 800, 600

When the GUI library develops, the RAD interface will be built. If you have tried RealBasic then you may get an idea of the plan.
marcov
Posts: 2373
Joined: Jun 16, 2005 9:45
Location: Eindhoven, NL
Contact:

Re: RAD for Linux

Postby marcov » Nov 10, 2017 17:28

Munair wrote:When the GUI library develops, the RAD interface will be built. If you have tried RealBasic then you may get an idea of the plan.


I don't know how RB works internally, so can't comment on that. The only time I played with the trial (which is probably already 10+ years ago), the concept seemed friendly, but I had my doubts about scaling. Not just performance wise, but also being able to fix own bugs (e.g. fix and recompile libraries, which is possible in e.g. Delphi). RB seemed a bit narrow and confined in that regard.
Munair
Posts: 110
Joined: Oct 19, 2017 15:00
Contact:

Re: RAD for Linux

Postby Munair » Nov 10, 2017 20:05

marcov wrote:
Munair wrote:When the GUI library develops, the RAD interface will be built. If you have tried RealBasic then you may get an idea of the plan.


I don't know how RB works internally, so can't comment on that. The only time I played with the trial (which is probably already 10+ years ago), the concept seemed friendly, but I had my doubts about scaling. Not just performance wise, but also being able to fix own bugs (e.g. fix and recompile libraries, which is possible in e.g. Delphi). RB seemed a bit narrow and confined in that regard.

Correct, RB was commercial and even one's own source code could not be opened in a separate editor to view or print, while printing from the IDE on Linux was bad. However, plugins could be developed. MBS is a good example: https://www.monkeybreadsoftware.de/xojo/welcome.shtml. Performance on the other hand was definitely not a priority. Using CrossBasic's compiler as a basis, functionality always came first. I never went with Xojo when the brand was renamed in 2013. I still have a copy for Linux from 2011 and amazingly it still runs on OpenSUSE Tumbleweed. But it's old and it's time for a good replacement. ;)
marcov
Posts: 2373
Joined: Jun 16, 2005 9:45
Location: Eindhoven, NL
Contact:

Re: RAD for Linux

Postby marcov » Nov 10, 2017 22:12

Munair wrote:Correct, RB was commercial and even one's own source code could not be opened in a separate editor to view or print, while printing from the IDE on Linux was bad.


(I was actually looking at RB because iirc it had a Eur 250 pricepoint when Delphi asked double that for the entry level annual updates, and Delphi runtime sources were packaged and could be recompiled with mods with all but the cheapest editions. In the end I didn't purchase RB, and upgraded my private Delphi one more time (D2009), nowadays for all private use I use Lazarus)
Last edited by marcov on Nov 14, 2017 13:48, edited 2 times in total.
Munair
Posts: 110
Joined: Oct 19, 2017 15:00
Contact:

Re: RAD for Linux

Postby Munair » Nov 14, 2017 2:15

In the last few days I managed to translate essential C headers from GtkSourceView 3.0 and get the widget working with FB. I already wrote the syntax highlight files. Here is a first setup (screenshot). I plan to get this editor working so that further development can take place from there. Feels right at home. Meanwhile Geany is being very helpful in getting this baby on the road. :)
Image
BTW, this is GTK 3 under KDE. Looks great if you ask me.
marcov
Posts: 2373
Joined: Jun 16, 2005 9:45
Location: Eindhoven, NL
Contact:

Re: RAD for Linux

Postby marcov » Nov 14, 2017 13:46

Munair wrote:Although I like Qt more than GTK, I believe the latter is the way to go because of its open source. Any ideas, suggestions are welcome!


(reply to older message, but I read over it initially and just noticed it when I checked munair's recent reply).

Afaik QT is open source with a suitable license (LGPL) for several years now. In the distant past there was an exception for Windows, but that has been gone quite a while already.
Munair
Posts: 110
Joined: Oct 19, 2017 15:00
Contact:

Re: RAD for Linux

Postby Munair » Nov 14, 2017 15:09

marcov wrote:
Munair wrote:Although I like Qt more than GTK, I believe the latter is the way to go because of its open source. Any ideas, suggestions are welcome!


(reply to older message, but I read over it initially and just noticed it when I checked munair's recent reply).

Afaik QT is open source with a suitable license (LGPL) for several years now. In the distant past there was an exception for Windows, but that has been gone quite a while already.

Qt has a dual license (https://www1.qt.io/qt-licensing-terms/). While I think that KDE gives the user a better computer experience, GTK seems to be wider in use given the popularity of Gnome, Cinnamon and XFCE. The advantage of GTK is also that it integrates well in Qt based desktops, while the reverse does not.

In any case, from a practical point of view, current GUI development is for GTK. In time, Qt might be added.
St_W
Posts: 1110
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: RAD for Linux

Postby St_W » Nov 14, 2017 16:25

Munair wrote:In any case, from a practical point of view, current GUI development is for GTK. In time, Qt might be added.
Using Qt from FreeBasic will be quite troublesome as it offers only a C++ API, afaik. You would need some wrapper library or some hacks to access the Qt methods from FreeBasic. GTK in contrast offers a C API which can be used from FreeBasic directly.
Munair
Posts: 110
Joined: Oct 19, 2017 15:00
Contact:

Re: RAD for Linux

Postby Munair » Nov 14, 2017 16:40

St_W wrote:
Munair wrote:In any case, from a practical point of view, current GUI development is for GTK. In time, Qt might be added.
Using Qt from FreeBasic will be quite troublesome as it offers only a C++ API, afaik. You would need some wrapper library or some hacks to access the Qt methods from FreeBasic. GTK in contrast offers a C API which can be used from FreeBasic directly.
I was already wondering about that. So the idea might be dropped altogether. The C API from GTK and Linux in general makes FreeBasic a great language for the platform.
D.J.Peters
Posts: 7154
Joined: May 28, 2005 3:28
Location: Germany

Re: RAD for Linux

Postby D.J.Peters » Nov 14, 2017 17:21

On of the problems with C++ and FreeBASIC are:

in a *.bi file:

type QT_Button extends QT_Object ' <-- this is OK in FreeBASIC

but

type QT_Button extends QT_XYZ, QT_ABC, QT_Object ' <-- this won't work in FreeBASIC

Same for FLTK C++ this is why I wrote the FLTK-C wrapper for FreeBASIC and we can use FLTK for comercial projects also.

For Qt you have to purchase a commercial license !

Joshy
Munair
Posts: 110
Joined: Oct 19, 2017 15:00
Contact:

Re: RAD for Linux

Postby Munair » Nov 14, 2017 18:23

D.J.Peters wrote:For Qt you have to purchase a commercial license !
Joshy

See the link I provided in response to marcov's reply.

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 2 guests