If I want to use Ctrl-N as hot key to create a new file and Ctrl-O to open a file, what is the correct method?
I tried with this code, but it seems that press Ctrl-N on keyboard cannot active the event.
menu.append(idNew,"N&ew\tCtrl-N","New File")
Here is simple code to reproduce the issue.
import wNim/[wApp, wFrame, wPanel, wMenubar]
type
MenuID = enum
idNew = wIdUser, idOpen , idSave
let app = App()
let frame = Frame(title="Menu hokey test",size=(800,600))
let menuBar = MenuBar(frame)
let menu = Menu(menuBar, "&File")
menu.append(idNew,"N&ew\tCtrl-N","New File")
menu.append(idOpen,"&Open\tCtrl-O","Open File")
menu.append(idSave,"&Save\tCtrl-S","Save File")
let panel = Panel(frame)
frame.wEvent_Menu do (event: wEvent):
if event.id == idNew:
echo "New File"
elif event.id == idOpen:
echo "Open File"
elif event.id == idSave:
echo "Save File"
else:
echo "unexpected event"
frame.center()
frame.show()
app.mainLoop()
If I want to use Ctrl-N as hot key to create a new file and Ctrl-O to open a file, what is the correct method? I tried with this code, but it seems that press Ctrl-N on keyboard cannot active the event.
Here is simple code to reproduce the issue.