Skip to content

Commit

Permalink
saveFile with file name
Browse files Browse the repository at this point in the history
  • Loading branch information
bung87 committed Sep 20, 2024
1 parent 711dfe8 commit cbb4c7f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/crowngui/platforms/macos/dialog.nim
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,12 @@ proc chooseFile*(root: string = ""; completionHandler: Block[OpenCompletionHandl
objc_msgSend(cast[Id](completionHandler), $$"invoke", nil)
[cast[ID](openPanel1) beginWithCompletionHandler: b2]

proc saveFile*(root: string = ""; completionHandler: Block[SaveCompletionHandler] = nil) =
proc saveFile*(root = ""; filename = "", completionHandler: Block[SaveCompletionHandler] = nil) =
objcr:
var savePanel = [NSSavePanel savePanel]
[savePanel setCanCreateDirectories: 1]
# [savePanel setNameFieldStringValue: filename]
if filename.len > 0:
[savePanel setNameFieldStringValue: NSString(filename)]
let blk = toBlock() do(r: Id):
if r == cast[Id](NSModalResponseOK):
var url: Id = objc_msgSend(savePanel, $$"URL")
Expand Down

0 comments on commit cbb4c7f

Please sign in to comment.