GoVCL, a cross-platform GUI lib

External libraries (GTK, GSL, SDL, Allegro, OpenGL, etc) questions.
oyster
Posts: 216
Joined: Oct 11, 2005 10:46

GoVCL, a cross-platform GUI lib

Postby oyster » Jun 17, 2020 7:09

https://github.com/ying32/govcl is a cross-platform GUI lib based on freepascal/lazarus's LCL. Since the core is a dynamic library and the author has released the auto-generated C header, we can use it in any language supports DLL

Here is a demo which is translated from the bundled CPP version. However there are 2 problems
1. The callback function does not be called
2. No unicode string can be used as the caption
any fix is appretiated

Maybe I should use fbfrog to auto-generated the bi file from the auto-generated C header other than do it by hand;)

Code: Select all

dim as any ptr DLL

dim Application_Instance as function cdecl() as any ptr
dim Application_Initialize as sub cdecl(f as any ptr)
dim Application_CreateForm as function cdecl(f as any ptr, tag as boolean) as any ptr
dim Application_Run as sub cdecl(f as any ptr)
dim Button_Create as function cdecl(f as any ptr) as any ptr
dim Button_SetParent as sub cdecl(i as any ptr, f as any ptr)
dim DShowMessage  as sub cdecl(f as any ptr)
dim Button_SetOnClick as sub cdecl(item as any ptr, fun as any ptr)
dim Button_SetCaption as sub cdecl(i as any ptr, f as any ptr)

DLL = dylibload("liblcl.dll")


Application_Instance = dylibsymbol( DLL, "Application_Instance" )
Application_Initialize = dylibsymbol( DLL, "Application_Initialize" )
Application_CreateForm = dylibsymbol( DLL, "Application_CreateForm")
Application_Run = dylibsymbol( DLL, "Application_Run")
DShowMessage = dylibsymbol( DLL, "DShowMessage")
Button_Create = dylibsymbol( DLL, "Button_Create")
Button_SetParent = dylibsymbol( DLL, "Button_SetParent")
Button_SetOnClick = dylibsymbol( DLL, "Button_SetOnClick")
Button_SetCaption = dylibsymbol( DLL, "Button_SetCaption")

sub btnClick(sender as any ptr)
    'DShowMessage("Hello world!")
    ? 11
end sub

var Application = Application_Instance()
Application_Initialize(Application)

var form = Application_CreateForm(Application, False)

var btn = Button_Create(form)
Button_SetParent(btn, form)
Button_SetOnClick(btn, @btnClick)

Button_SetCaption(btn, strptr("hello"))

Application_Run(Application)

DyLibFree( DLL )
srvaldez
Posts: 2482
Joined: Sep 25, 2005 21:54

Re: GoVCL, a cross-platform GUI lib

Postby srvaldez » Jun 17, 2020 10:23

oyster wrote:Maybe I should use fbfrog to auto-generated the bi file from the auto-generated C header other than do it by hand;)

where's the C header?
never mind, you have to download the master repository, then you will find it in govcl-master\Tools\makeCHeader\test
[edit]
fbfrog -target windows liblcl.h
>liblcl.bi (26605 declarations, 1689 TODOs)

it took a long time, I thought that fbfrog was in an enless loop
oyster
Posts: 216
Joined: Oct 11, 2005 10:46

Re: GoVCL, a cross-platform GUI lib

Postby oyster » Jul 14, 2020 3:38

https://github.com/starwing/amoeba
a Cassowary constraint solving algorithm implements in pure C.

which can be used for something like https://ebassi.github.io/emeus/, in other word, GUI auto layout.
marcov
Posts: 3004
Joined: Jun 16, 2005 9:45
Location: Eindhoven, NL
Contact:

Re: GoVCL, a cross-platform GUI lib

Postby marcov » Jul 14, 2020 8:37

(Probably need update, Lazarus and Free Pascal both released in the last 3-4 weeks)

Return to “Libraries”

Who is online

Users browsing this forum: No registered users and 2 guests