GoVCL, a cross-platform GUI lib

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

GoVCL, a cross-platform GUI lib

Post by oyster »

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: 3379
Joined: Sep 25, 2005 21:54

Re: GoVCL, a cross-platform GUI lib

Post by srvaldez »

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: 274
Joined: Oct 11, 2005 10:46

Re: GoVCL, a cross-platform GUI lib

Post by oyster »

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: 3462
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: GoVCL, a cross-platform GUI lib

Post by marcov »

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