Could someone make a list of FreeBASIC GUI libraries/frameworks?

General discussion for topics related to the FreeBASIC project or its community.
Post Reply
systemctl
Posts: 182
Joined: Mar 27, 2020 5:15

Re: Could someone make a list of FreeBASIC GUI libraries/frameworks?

Post by systemctl »

I only put it here to note that is it worth to use a C++ GUI library? Even if we just use it as a backend for our own toolkit we have to ship it DLLs alongside with our program, too. The DLLs are very large. For example: the whole shared library (.so) of CopperSpice is about 175 MB which CsWebKit took about 75 MB. Most of the program only uses CsCore and CsGui, some also use CsNetwork so it's about 100 MB (less than 100 MB to be clear). Running strip --strip-all on these shared library not helped much. The size saved is too small so it doesn't make any different. Imagine our fbc compiled program (usually tended to be very small) has to be packaged alongside these bloated DLLs, is it worth to download a 101 MB package just to use a less than 1 MB program? Some kind of redistribute package or runtime environment would work, but it will give rise to other problems.

As I have said we already have very good GTK+ binding. We could develop our own toolkit that use the Windows API as backend on Windows and GTK+ as backend on Linux. We do not need any extra layer!

Library like Ultimate++, WXWidgets... use GTK+ underlying to draw their widgets on Linux. It's silly to use them as backend for our own GUI library since we already have a very good GTK+ binding.

p/s: WXWidgets does have a X11 version, without using GTK+ underlying, but this version is not tested and developed much. They also have a Qt version, named WXQt, but is experimental. We already have X11 library binding, isn't it? There is no need for an extra layer especially if that layer is C++! If you develop for Mac, you could consider using them. But as far as I know, FreeBASIC doesn't support Mac.
marcov
Posts: 3462
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: Could someone make a list of FreeBASIC GUI libraries/frameworks?

Post by marcov »

systemctl wrote:
CopperSpice: I list it instead of Qt because it has removed MOC, so it's left with just standard C++. But the library itself requires latest C++ version (C++17) and as I think it's template heavy.
fyi:
https://forum.lazarus.freepascal.org/in ... n.html#new
systemctl wrote: CopperSpice is about 175 MB
Just for perspective. How big is your C: or *nix root partititon?

Having a good GTK binding isn't worth much if GTK is unstable itself.
systemctl
Posts: 182
Joined: Mar 27, 2020 5:15

Re: Could someone make a list of FreeBASIC GUI libraries/frameworks?

Post by systemctl »

marcov wrote:
systemctl wrote:
systemctl wrote: CopperSpice is about 175 MB
Just for perspective. How big is your C: or *nix root partititon?
It's about distribute your apps. Not how big your root partition is.
Last edited by systemctl on Apr 18, 2020 18:10, edited 1 time in total.
systemctl
Posts: 182
Joined: Mar 27, 2020 5:15

Re: Could someone make a list of FreeBASIC GUI libraries/frameworks?

Post by systemctl »

Note: just checked, FLTK supports Mac. If someday fbc ever managed to support Mac, we could use FLTK to develop Mac application. BTW, if someone could come up with a GUI designer for FLTK (no, I'm not mean the original FLTK which is in C++, I mean the FLTK ported to FreeBASIC by D.J.Peters and our GUI designer generates FreeBASIC code, not C++), it's much better. FLUID is very difficult and counter intuitive to use (at least for me) and it's for C++.

Update: I searched the forum and found this: https://freebasic.net/forum/viewtopic.php?f=8&t=23491. Everyone not much interested and I think it's no longer developed.
ShawnLG
Posts: 142
Joined: Dec 25, 2008 20:21

Re: Could someone make a list of FreeBASIC GUI libraries/frameworks?

Post by ShawnLG »

Munair wrote:I think it is safe to say that people across the FreeBasic community have little to no interest in GUI programming. This is probably because FB has some serious limitations (I know because I tried) that are probably due to the fact that it started out as a QuickBASIC clone. These limitations can be circumvented, but only by making heavy use of pointers, and that's the area where FB is way too much C-like.

Really! A little over a year ago I needed a GUI interface for a graph program I was developing. So for the next year I have been working on my own GUI framework entirely in FreeBASIC. Over the period of months it has become much more than I have originally thought. In the beginning I want the framework to be reuseable and cross platform compatible. So I followed these guidelines through out it's development. The menu and quick buttons are fully customizable by the programmer. It has scroll bars for the application window. Two other features is a load/save GUI window which allows the user to browse the file system to load or save a file for the application. The other feature is a built in proprietary HTML help file system. Yes, an interpreted GUI in a GUI. This is a powerful concept. This help system is similar to the Microsoft Compiled HTML Help system used in some windows applications. This GUI is not posted on the forum because it is in a work-in-progress. Although it is fully event driven and can process key presses and mouse clicks. It is lacking features for additional user input such as dialog boxes. It's performance is responsive even on a crappy processor such as AMD's C50 laptop CPU. It does not do any flashy graphics effects like in modern Windows or macOS. It is straight to the point like linux GUIs.

deltarho[1859] wrote:Looking at WinFBE's source code we see that when it comes to writing GUI's the only limiting factor to FreeBASIC and WinFBX is our imagination.
That right. It's limited to our imagination. I do not see FreeBASIC having serious limitations. It's the user's limitations on utilizing FreeBASIC's full potential. Pointers are part of FreeBASIC's toolset. I see it difficult to write any substantial application without them. I was first introduced to pointers in C++ decades ago. Using them in FreeBASIC was only a minor adjustment for me. Pointers do have their pitfalls, but It takes a lot of experience to get used to them and use them properly.
marcov
Posts: 3462
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: Could someone make a list of FreeBASIC GUI libraries/frameworks?

Post by marcov »

systemctl wrote:
marcov wrote:
systemctl wrote:
Just for perspective. How big is your C: or *nix root partititon?
It's about distribute your apps. Not how big your root partition is.
No, since that goes via the package system and is probably already installed anyway.
BasicCoder2
Posts: 3917
Joined: Jan 01, 2009 7:03
Location: Australia

Re: Could someone make a list of FreeBASIC GUI libraries/frameworks?

Post by BasicCoder2 »

RNBW wrote:
BasicCoder2 wrote:I downloaded window9 yesterday from here but couldn't get the examples to work without compiler errors.
https://sourceforge.net/projects/guiwindow9/
Did you follow the instructions in this post viewtopic.php?f=14&t=17058 in respect of placing of libraries?
Honestly I didn't. If I can't just download and unzip into a folder and have it just work I tend to lose interest. Having now just tried to implement all those messy instructions it still fails and I have given up on trying it. The motivation is low as I haven't had the need for a GUI that I couldn't roll out myself although I can see the need for it in professionally written software.
jj2007
Posts: 2326
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: Could someone make a list of FreeBASIC GUI libraries/frameworks?

Post by jj2007 »

Here is a 77 lines sizable boilerplate GUI application with a menu, a control, and some MessageBoxes saying "Menu xxx not yet implemented". Would it run on Linux with Wine?

Code: Select all

#Include "windows.bi"
Dim Shared as Handle hEdit
Function WndProc(hWnd As HWND, msg As  UINT, wParam As WPARAM, lParam As LPARAM) As LRESULT
  Dim As RECT rc
  Dim As PAINTSTRUCT ps
  Dim As HANDLE PtDC
  Dim As HANDLE hMenu, hPopup, hEsi
  Select Case msg
  Case WM_CREATE
	hMenu=CreateMenu()					' create the main menu
	hPopup=CreatePopupMenu()					' create a sub-menu
	AppendMenu(hMenu, MF_POPUP, hPopup, "&File")		' add it to the main menu
	AppendMenu(hPopup, MF_STRING, 101, "&Open") 		' one more main item
	hEsi=CreatePopupMenu()					' create a sub-menu
	AppendMenu(hEsi, MF_STRING, 121, "&sources")		' fill it
	AppendMenu(hEsi, MF_STRING, 122, "&includes")		' with various
	AppendMenu(hEsi, MF_STRING, 123, "&DLLs")			' options
	AppendMenu(hPopup, MF_POPUP, hEsi, "&Dir")		' and add it to the main menu as "Dir"
	AppendMenu(hPopup, MF_STRING, 102, "&Save") 		' one more main item
	AppendMenu(hPopup, MF_STRING, 103, "E&xit") 		' one more main item
	SetMenu(hWnd, hMenu)					' attach menu to main window
	hEdit=CreateWindowEx(WS_EX_CLIENTEDGE, "edit", "Hello, I am an edit control",_
	WS_CHILD Or WS_VISIBLE or ES_MULTILINE, 0, 0, 100, 100, hWnd, 100, 0, 0)
  Case WM_COMMAND
	Select Case wParam
 		Case 101: MessageBox(hWnd, "Open not implemented", 0, MB_OK)
 		Case 102: MessageBox(hWnd, "Save not implemented", 0, MB_OK)
 		Case 121: MessageBox(hWnd, "No *.bas files found", 0, MB_OK)
 		Case 122: MessageBox(hWnd, "No *.inc files found", 0, MB_OK)
 		Case 123: MessageBox(hWnd, "No *.dll files found", 0, MB_OK)
 		Case 103: SendMessage(hWnd, WM_CLOSE, 0, 0)
	End Select
  Case WM_PAINT
	PtDC=BeginPaint(hWnd, @ps)
	TextOut(PtDC, 3, 3, "TextOut in the WM_PAINT handler", 31)
	EndPaint(hWnd, @ps)
  Case WM_KEYDOWN
  	if wParam=VK_ESCAPE then SendMessage(hWnd, WM_CLOSE, 0, 0)
  Case WM_SIZE
	GetClientRect(hWnd, @rc)
	MoveWindow(hEdit, 3, 28, rc.right-6, rc.bottom-30, 0)
  Case WM_DESTROY
      PostQuitMessage(0)
  End Select
  return DefWindowProc(hwnd, msg, wParam, lParam)
End Function

Function WinMain(hInstance As HINSTANCE, hPrevInstance As HINSTANCE, lpCmdLine As LPSTR, nShowCmd As Integer) As Integer
   Dim As WNDCLASSEX wc
   Dim As MSG msg
   Dim As string classname="FbGui"
   wc.cbSize = sizeof(WNDCLASSEX)
   wc.hbrBackground = COLOR_BTNFACE+1
   wc.hCursor = LoadCursor(0, IDC_ARROW)
   wc.hIcon = LoadIcon(hInstance, IDI_APPLICATION)
   wc.hIconSm = wc.hIcon
   wc.hInstance = hInstance
   wc.lpfnWndProc = @WndProc
   wc.lpszClassName = StrPtr(classname)
   wc.style = CS_HREDRAW Or CS_VREDRAW
   RegisterClassEx(@wc)

   if CreateWindowEx(0, wc.lpszClassName, "Hello World",_
	WS_OVERLAPPEDWINDOW Or WS_VISIBLE, (GetSystemMetrics(SM_CXSCREEN) / 2) - 150,_
	(GetSystemMetrics(SM_CYSCREEN) / 2) - 150, 300, 300, 0, 0, hInstance, 0)=0 then
		    MessageBox(0, "Creating hMain failed miserably", 0, MB_OK)
		    return 0
   End If

   While GetMessage(@msg, 0, 0, 0)
      TranslateMessage(@msg)
      DispatchMessage(@msg)
   Wend

   return msg.wParam
End Function
WinMain(GetModuleHandle(NULL), NULL, COMMAND(), SW_NORMAL)
badidea
Posts: 2594
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: Could someone make a list of FreeBASIC GUI libraries/frameworks?

Post by badidea »

jj2007 wrote:Here is a 77 lines sizable boilerplate GUI application with a menu, a control, and some MessageBoxes saying "Menu xxx not yet implemented". Would it run on Linux with Wine?
Yes, this is how it looks like:
Image
jj2007
Posts: 2326
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: Could someone make a list of FreeBASIC GUI libraries/frameworks?

Post by jj2007 »

badidea wrote:
jj2007 wrote:Here is a 77 lines sizable boilerplate GUI application with a menu, a control, and some MessageBoxes saying "Menu xxx not yet implemented". Would it run on Linux with Wine?
Yes, this is how it looks like:
Image
That looks much better than my genuine Windows 7 version, congrats ;-)
Image
Here's the full source including the part with the butterfly icon, plus a check which ComCtrl32 version is being used.

Code: Select all

#Include "windows.bi"	' JJ 18.4.2020
Dim Shared as Handle hEdit
Function WndProc(hWnd As HWND, msg As  UINT, wParam As WPARAM, lParam As LPARAM) As LRESULT
  Dim As RECT rc
  Dim As PAINTSTRUCT ps
  Dim As HANDLE PtDC
  Dim As HMENU hMenu, hPopup, hEsi
  Select Case msg
  Case WM_CREATE
	hMenu=CreateMenu()					' create the main menu
	hPopup=CreatePopupMenu()					' create a sub-menu
	AppendMenu(hMenu, MF_POPUP, hPopup, "&File")		' add it to the main menu
	AppendMenu(hPopup, MF_STRING, 101, "&Open") 		' one more main item
	hEsi=CreatePopupMenu()					' create a sub-menu
	AppendMenu(hEsi, MF_STRING, 121, "&sources")		' fill it
	AppendMenu(hEsi, MF_STRING, 122, "&includes")		' with various
	AppendMenu(hEsi, MF_STRING, 123, "&DLLs")			' options
	AppendMenu(hPopup, MF_POPUP, hEsi, "&Dir")		' and add it to the main menu as "Dir"
	AppendMenu(hPopup, MF_STRING, 102, "&Save") 		' one more main item
	AppendMenu(hPopup, MF_STRING, 103, "E&xit") 		' one more main item
	SetMenu(hWnd, hMenu)					' attach menu to main window
	hEdit=CreateWindowEx(WS_EX_CLIENTEDGE, "edit", "Hello, I am an edit control",_
	WS_CHILD Or WS_VISIBLE or ES_MULTILINE, 0, 0, 100, 100, hWnd, 100, 0, 0)
  Case WM_COMMAND
	Select Case wParam
 		Case 101: MessageBox(hWnd, "Open not implemented", 0, MB_OK)
 		Case 102: MessageBox(hWnd, "Save not implemented", 0, MB_OK)
 		Case 121: MessageBox(hWnd, "No *.bas files found", 0, MB_OK)
 		Case 122: MessageBox(hWnd, "No *.inc files found", 0, MB_OK)
 		Case 123: MessageBox(hWnd, "No *.dll files found", 0, MB_OK)
 		Case 103: SendMessage(hWnd, WM_CLOSE, 0, 0)
	End Select
  Case WM_PAINT
	PtDC=BeginPaint(hWnd, @ps)
	TextOut(PtDC, 3, 3, "TextOut in the WM_PAINT handler", 31)
	EndPaint(hWnd, @ps)
  Case WM_KEYDOWN
  	if wParam=VK_ESCAPE then SendMessage(hWnd, WM_CLOSE, 0, 0)
  Case WM_SIZE
	GetClientRect(hWnd, @rc)
	MoveWindow(hEdit, 3, 28, rc.right-6, rc.bottom-30, 0)
  Case WM_DESTROY
      PostQuitMessage(0)
  End Select
  return DefWindowProc(hwnd, msg, wParam, lParam)
End Function

Function WinMain(hInstance As HINSTANCE, hPrevInstance As HINSTANCE, lpCmdLine As LPSTR, nShowCmd As Integer) As Integer
  Dim As WNDCLASSEX wc
  Dim As MSG msg
  Dim As string classname="FbGui"
  Dim As HANDLE hIconLib, hDll
  type pCall as function (xy as any ptr) as long
  Dim As pCall pGetVersion
  type DLLVERSIONINFO
	cbSize as long
	dwMajorVersion as long
	dwMinorVersion as long
	dwBuildNumber as long
	dwPlatformID as long
  end type
  Dim As DLLVERSIONINFO dvi
  dvi.cbSize=sizeof(DLLVERSIONINFO)
  hIconLib=LoadLibrary("shell32")
  wc.hIcon = LoadIcon(hIconLib, 239)	' get the butterfly icon
  FreeLibrary(hIconLib)
  hDll=LoadLibrary("ComCtl32")
  pGetVersion=GetProcAddress(hDll, "DllGetVersion")
  pGetVersion(@dvi)
  if @dvi.dwMajorVersion then print "Using common controls version ";str(dvi.dwMajorVersion);".";str(dvi.dwMinorVersion)
  FreeLibrary(hDll)
  wc.cbSize = sizeof(WNDCLASSEX)
  wc.hbrBackground = COLOR_BTNFACE+1
  wc.hCursor = LoadCursor(0, IDC_ARROW)
  wc.hIconSm = wc.hIcon
  wc.hInstance = hInstance
  wc.lpfnWndProc = @WndProc
  wc.lpszClassName = StrPtr(classname)
  wc.style = CS_HREDRAW Or CS_VREDRAW
  RegisterClassEx(@wc)
  if CreateWindowEx(0, wc.lpszClassName, "Hello World",_
	WS_OVERLAPPEDWINDOW Or WS_VISIBLE, (GetSystemMetrics(SM_CXSCREEN) / 2) - 150,_
	(GetSystemMetrics(SM_CYSCREEN) / 2) - 150, 300, 300, 0, 0, hInstance, 0)=0 then
		    MessageBox(0, "Creating hMain failed miserably", 0, MB_OK)
		    return 0
  End If

  While GetMessage(@msg, 0, 0, 0)
      TranslateMessage(@msg)
      DispatchMessage(@msg)
  Wend

  return msg.wParam
End Function
WinMain(GetModuleHandle(NULL), NULL, COMMAND(), SW_NORMAL)
marcov
Posts: 3462
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: Could someone make a list of FreeBASIC GUI libraries/frameworks?

Post by marcov »

jj2007 wrote:Here is a 77 lines sizable boilerplate GUI application with a menu, a control, and some MessageBoxes saying "Menu xxx not yet implemented". Would it run on Linux with Wine?
The win32 version of Lazarus runs fairly completely under Wine. That's 3.2MLoc of windows code.
jj2007
Posts: 2326
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: Could someone make a list of FreeBASIC GUI libraries/frameworks?

Post by jj2007 »

marcov wrote:The win32 version of Lazarus runs fairly completely under Wine. That's 3.2MLoc of windows code.
So we have a complete GUI framework available on Linux (and MacOS?): WinAPI. And it looks even better than the original ;-)

Image
marcov
Posts: 3462
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: Could someone make a list of FreeBASIC GUI libraries/frameworks?

Post by marcov »

jj2007 wrote:
marcov wrote:The win32 version of Lazarus runs fairly completely under Wine. That's 3.2MLoc of windows code.
So we have a complete GUI framework available on Linux (and MacOS?): WinAPI. And it looks even better than the original ;-)

Image
Yeah, and already for a decade+. In the early 2000s, the Linux version of Kylix(commercial project) used the winelib approach.

Besides for apps, it is also useful for build systems, e.g. to sign win32 exes after building a nightly snapshot on Linux
jj2007
Posts: 2326
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: Could someone make a list of FreeBASIC GUI libraries/frameworks?

Post by jj2007 »

So what stops the Linux community from using WinAPI on Wine as "the" GUI framework? The name? A general aversion against Windows? Or are there technical arguments?

WinAPI is not extremely simple, but there are guides all over the web, and I guess each and every little problem has been discussed somewhere.
Munair
Posts: 1286
Joined: Oct 19, 2017 15:00
Location: Netherlands
Contact:

Re: Could someone make a list of FreeBASIC GUI libraries/frameworks?

Post by Munair »

Wine is usually a last resort. I used it long ago to run Dreamweaver 8 on Linux. The problem with Wine was (probably still is) that after an update,one or two Windows programs may no longer run. I consider Wine a nasty patch for running programs for which there are no good Linux alternatives.
Post Reply