Skip to content

Commit

Permalink
change dialogue apis for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
bung87 committed Oct 10, 2024
1 parent 4018a7e commit c4766fa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/crowngui/platforms/win/webview2.nim
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,9 @@ proc addUserScriptAtDocumentEnd*(w: WebView; script: string) =

discard w.priv.view.add_DOMContentLoaded(handler, token.addr)

when isMainModule:
SetCurrentProcessExplicitAppUserModelID("webview2 app")
var v = newWebView()
assert v.webview_init() == 0
# when isMainModule:
# SetCurrentProcessExplicitAppUserModelID("webview2 app")
# var v = newWebView()
# assert v.webview_init() == 0

v.run
# v.run
8 changes: 8 additions & 0 deletions src/crowngui/platforms/win/webview2/dialog.nim
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ proc chooseFiles*(root: string = "", description: string = ""): seq[string] {.di
else:
add(result, path)

proc chooseFile*(cb: proc (a: seq[string]); root = "") =
let files = chooseFiles(root, "")
cb(files)

proc saveFile*(root: string = "", description: string = ""): string {.discardable.} =
var
opf: OPENFILENAMEW
Expand All @@ -82,6 +86,10 @@ proc saveFile*(root: string = "", description: string = ""): string {.discardabl
else:
result = ""

proc saveFile*(cb: proc (a: string); root = ""; filename = "") =
let path = saveFile(root)
cb(path)

proc chooseDir*(root: string = "", description: string = ""): string {.discardable.} =
var
lpItemID: PItemIDList
Expand Down

0 comments on commit c4766fa

Please sign in to comment.