Closed retsyo closed 6 years ago
well I found the solution. Maybe not let the user write endModal every time?
{.this: self.}
import winim/inc/[windef, winerror, winbase, winuser, wingdi, gdiplus, richedit]
import wNim
type
wAboutFrame = ref object of wFrame
proc final(self: wAboutFrame) =
wFrame(self).final()
proc init(self: wAboutFrame, title: string) =
wFrame(self).init(style=wModalFrame or wDefaultFrameStyle)
center()
var
panel = Panel(self)
btnOk = Button(panel, label="button on slave frame", size=(500, 20))
proc aboutFrame(title: string): wAboutFrame {.inline.} =
new(result, final)
result.init(title)
when isMainModule:
let
app = App()
frame = Frame()
panel = Panel(frame)
btn1 = Button(panel, label="click to load slave frame", size=(500, 20))
btn1.wEvent_Button do ():
let frame2 = aboutFrame("hello")
frame2.wEvent_Close do ():
frame2.endModal()
frame2.showModal()
#~ frame2.show() # NO, I don't need this
frame.center()
frame.show()
app.mainLoop()
In the following code, there is an owner(master? sorry I don't know its exact name) frame. When I click the button on it, a modal frame appears, so the bottom owner frame can't be clicked, which is the effect I need.
Then I close the modal frame, I thought the bottom owner frame should be active now. However in fact, I can't click the bottom owner frame anymore! It seems that I should active the bottom owner frame once the modal frame disappears. Sadly I don't know how to realize it.