Yue Posted September 4, 2021 Share Posted September 4, 2021 I have a concern about the command to check if a window is closed. What happens is that after pressing the close button, it always returns true, I would expect it to automatically return false, after being pressed. This has me in trouble with the exit management of the program through a menu where it should show a dialog box that is activated from an exit menu button and the title bar on the close button. Quote Link to comment Share on other sites More sharing options...
Josh Posted September 7, 2021 Share Posted September 7, 2021 Use the events system to detect a WINDOWCLOSE event if you need more advanced event handling. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Yue Posted September 7, 2021 Author Share Posted September 7, 2021 5 hours ago, Josh said: Use the events system to detect a WINDOWCLOSE event if you need more advanced event handling. Hello, is there any documentation on what you are telling me? Quote Link to comment Share on other sites More sharing options...
Josh Posted September 7, 2021 Share Posted September 7, 2021 https://www.leadwerks.com/learn?page=API-Reference_Object_EventQueue_Wait https://www.leadwerks.com/learn?page=API-Reference_Object_EventQueue_Peek 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Yue Posted September 19, 2021 Author Share Posted September 19, 2021 On 9/7/2021 at 9:56 AM, Josh said: https://www.leadwerks.com/learn?page=API-Reference_Object_EventQueue_Wait https://www.leadwerks.com/learn?page=API-Reference_Object_EventQueue_Peek I really don't know how to do this. I'm trying to figure this out, but I have no idea. Quote Link to comment Share on other sites More sharing options...
Josh Posted September 19, 2021 Share Posted September 19, 2021 while (PeekEvent()) { auto = WaitEvent(); if (e.id = EVENT_WINDOWCLOSE) Print("CLOSE!"); } Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Yue Posted September 21, 2021 Author Share Posted September 21, 2021 On 9/19/2021 at 12:58 AM, Josh said: while (PeekEvent()) { auto = WaitEvent(); if (e.id = EVENT_WINDOWCLOSE) Print("CLOSE!"); } One question, that only works in C++, I'm in lua, and I can't find the equivalent for the window close event. while EventQueue:Peek() do local event = EventQueue:Wait() if event.id == Event.WindowClose then System:Print("CLOSE TEST") .... Quote Link to comment Share on other sites More sharing options...
Yue Posted September 21, 2021 Author Share Posted September 21, 2021 while EventQueue:Peek() do local event = EventQueue:Wait() if event.id == Event.WindowClose then System:Print("CLOSE TEST") elseif event.id == Event.WidgetAction then if event.source == self.btnStart then self.Gui:Hide() self.button = self.START end if event.source == self.btnOptions then self.pnlOptions:Show() self.pnlStart:Hide() elseif event.source == self.btnExit then self.pnlStart:Hide() self.pnlBox:Show() elseif event.source == self.btnNot then self.pnlBox:Hide() self.pnlStart:Show() elseif event.source == self.btnYes then self.pnlBox:Hide() self.button = self.YES elseif event.source == self.btnSave then self:SaveConfig() elseif event.source == self.btnCancel then self.pnlOptions:Hide() self.pnlStart:Show() self:CancelConfig() end elseif event.id == Event.WidgetSelect then end end Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.