- added a Quit button to AppBundler example app

- slighlty improved button placement
This commit is contained in:
Adam M. Krajewski 2023-09-24 21:08:04 -04:00 committed by GitHub
parent 65851af2eb
commit f8aa9c4e20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,7 +5,8 @@ var mainWin: ID
var lblFile, txtFile, btnFile, lblAuthor, txtAuthor, lblApp,
txtApp, lblImage, txtImage, btnImage, line1, lblVersion,
txtVersion, lblIdent, txtIdent, line2, chkLaunch, btnExec: ID
txtVersion, lblIdent, txtIdent, line2, chkLaunch, btnExec,
btnQuit: ID
const
width:cint = 800
@ -21,6 +22,9 @@ proc getImage(sender: ID) {.cdecl.} =
let fName = newOpenDialog(mainWin, "icns")
if fName.len > 0:
txtImage.text = fName
proc quit(sender: ID) {.cdecl.} =
Cocoa_Quit(mainWin)
proc createAppBundle(sender: ID) {.cdecl.} =
let dt = now()
@ -109,11 +113,14 @@ proc main() =
line2 = newSeparator(mainWin, 20, 240, 750)
chkLaunch = newCheckBox(mainWin, "Launch Application?", 320, 270, 150, 25)
btnExec = newButton(mainWin, "Execute", 680, 270, 100, 25, createAppBundle)
chkLaunch = newCheckBox(mainWin, "Launch Application?", 390, 270, 150, 25)
btnExec = newButton(mainWin, "🟢 Execute", 680, 270, 100, 25, createAppBundle)
chkLaunch.anchor=akLeft + akRight + akBottom; btnExec.anchor=akRight + akBottom
btnQuit = newButton(mainWin, "🔴 Quit", 565, 270, 100, 25, quit)
Cocoa_Run(mainWin)
if isMainModule:
main()