Dusted off my old translator, because I'm tired of looking for an easy to use macOS GUI.
So I'm re-rolling my own. Here is example syntax:
' ************************************************
' * Demo of AIR's Cocoa Objects Library (libcol) *
' ************************************************
$MODULE "cocoa.inc"
const win_width = 600
const win_height = 400
const button_width = 90
widgets as enum
txtFld
button
colorButton
combo
checkbox
label
edit
end enum
sub btnClick(sender as id)
dim fname$,a$
fname$ = mainWin.openDialog("bas:c:mm")
if len(fname$) then
mainWin.setText(txtFld,fname$)
a$ = LoadFile$(fname$)
mainWin.setText(edit,a$)
end if
end sub
Global mainWin("AIR Cocoa Test Window", win_width, win_height) as FORM
Cocoa_Init()
with mainWin
.newEntry(txtFld, "Testing AIR's Cocoa Library with MBC", 16, 20, win_width-122, 26, akWidth)
.newButton(button, "Load", win_width-100, 20, button_width, 26, akRight, btnClick)
.newButton(colorButton, "Color", win_width-100, 50, button_width, 26, akRight)
.newCombo(combo, 16, 50, 210, 26)
.newCheck(checkbox, "Check Box 1", 240, 50, 100, 26)
.newLabel(label, "This is a Label", 360, 50, 100, 26)
.newEdit(edit,"", 16, 96, 480, 280,akWidth | akHeight)
.Add(combo, "Apples:Oranges:Peaches", "Oranges")
.setText(edit, "Hello, World!")
end with
Cocoa_Run()
This is leveraging the fact the STRUCTS in C++ can be used like CLASSES; the only real difference is that with STRUCTS, all items are public by default whereas with CLASSES they're private by default.
The FORM struct/object uses a Constructor as seen in the creation of 'mainWin', but it is NOT a CLASS although it is used like one.
One of the interesting things is that only the mainWin object is global. In other GUI implementations I've looked at, each GUI object that you might reference are declared Global (unless you're passing a pointer/reference to that object to a function).
The 'widgets' enum is just that: An enum of integers. So they are not GUI objects, but are used internally to track which object a given action needs to be performed on.
The attached screenshots show this demo in 'action', with the 3rd showing the OpenFileDialog which is attached to the form, and the 5th showing how resizing is handled if you use the 'ak*' series of flags.
AIR.