delsquaredb Posted December 18, 2008 Share Posted December 18, 2008 I am having an issue using popup windows. I have a series of popups that the user can choose to view by pushing the appropriate button. When switching between popups Daqfactory intermittently and unpredictably crashes. So far I have tried using quick sequence, scripting and the built in action to do the switching. Here is my quick sequence: Page.Stack2.ClosePopup() Page.Stack3.ClosePopup() Page.Stack4.ClosePopup() Page.Stack5.ClosePopup() Page.Stack1.PopupModeless( 0, 0, 0, 1024, 1024) where the pages are named Stack1, Stack2, etc. Peculiarly, when I add a statement at the beginning of this sequence to close the page before reopening it the statement is executed after the PopupModeless statement so that the popup flashes on the screen and then closes. Has anyone else run into an issue like this? Thanks in advance for any help. Link to comment Share on other sites More sharing options...
AzeoTech Posted December 18, 2008 Share Posted December 18, 2008 For reasons I won't go into, Windows can only create new windows (popups) from the primary thread of the application (or, for those of you that are saying I'm wrong, a thread with a message pump, which sequences do not have for performance reasons). So, when you do ClosePopup or any of the other popup commands in a sequence what is actually happening is that DF is adding the command to a list of things for the main thread to do. The main thread goes through this list about 5 times a second, so it basically appears to immediately popup when you just have one command. But, in your case, you have five commands that get added to the list and they don't necessarily get done in order. Anyhow, try adding a delay(0.5) between each of the commands you have above. Link to comment Share on other sites More sharing options...
Davarius Posted February 12, 2009 Share Posted February 12, 2009 Would there be any way to tell if a pop-up is active? I know there is the strCurrentpage() Function to determine what the active page is, but in the case of pop-up's the active page returned is the one you initially called the pop-up from (assuming you had a button to bring up the pop-up). Is there a "work around" to determine if a pop-up has closed? For instance to ignore or stop a section of code managing components on the page what was used as a pop-up Link to comment Share on other sites More sharing options...
AzeoTech Posted February 12, 2009 Share Posted February 12, 2009 No, but you could track it yourself. Use a variable that you set to 1 when you display the popup. In displaying the popup, use the function, not the component action: page.page_1.PopupModal(1) the 1 means no-close which eliminates the X in the window's top bar. The only way the popup can then be closed is through a button you create that closes it. In that button you can then set your flag back to 0. BE CAREFUL: if you do PopupModal(1) on a page that you haven't created a button to close the popup, you will not be able to close the popup ever and will not be able to access the rest of DAQFactory, including the ability to save your document. Link to comment Share on other sites More sharing options...
Gammatech Posted February 18, 2009 Share Posted February 18, 2009 I use the popup with the noclose set to 1 in a menu system. The small 'x' is no longer able to close the popup (I have a 'Clear' button) but the small 'x' remains visible. Is there any way to actually remove it? Link to comment Share on other sites More sharing options...
AzeoTech Posted February 18, 2009 Share Posted February 18, 2009 Not that I know of. Link to comment Share on other sites More sharing options...
andrewjfox Posted May 5, 2011 Share Posted May 5, 2011 Nothing for months, then 2 queries in the space of hours, lucky you guys never seem to sleep. I also am trying to track when a popup is closed. I have a popup numeric keypad, that loads a result which is used after the popup is closed. I try tracking a value but the popupmodal function returns before window closes define NUMBER_ENTRY_HEIGHT = 222 define NUMBER_ENTRY_WIDTH = 165 global NumberEntryResult function NumberEntryDialog(PosX,PosY) if (argc < 2) PosX = 100 PosY = 100 endif Page.Enter_Number.Component.EditBox.strContents = '0' NumberEntryResult = INVALID_NUMBER Page.Enter_Number.PopupModal(0,PosY,PosX, PosY+NUMBER_ENTRY_HEIGHT,PosX+NUMBER_ENTRY_WIDTH) //waitfor(NumberEntryResult != INVALID_NUMBER,1) return NumberEntryResult I'm assuming PopupModal is non-blocking, since without the waitfor the function returns immediately, with NumberEntryResult = INVALID_NUMBER If I include the waitfor, then DAQFactory hangs Am I missing something simple Link to comment Share on other sites More sharing options...
AzeoTech Posted May 5, 2011 Share Posted May 5, 2011 Its non-blocking but runs in the UI thread of the application, so if you try and execute code with a waitfor(), or for that matter anything else slow, from the Action of a button, it will hang DAQFactory. You have to do this sort of thing using two functions, one to display the popup and one that executes when the popup is complete, usually in the action of some sort of Close/Enter button in the popup, and perhaps a different script for a Cancel button. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.