'copy card' without going to it? [Workaround found]
Posted: Mon Mar 31, 2014 4:42 pm
Hi,
I'm using 'copy card x of stack y to this stack' to copy a cached card of a substack of my app, to the main stack.
Is there any way to execute the above command without LiveCode then automatically displaying the copied card x? (as I want the initial card to remain on display)
I can add code to store the initial card ID before the copy, then 'go to card initialCardID' after the copy (and use 'lock screen' to stop the flicker) - but the problem is that the 'closeCard' handler of the initial card fires when the 'copy card' command is executed, and the 'openCard' handler fires when I 'go to card initialCardID'.
I did set a Custom Property to tell the initial card's openCard and closeCard handlers to bail out if they were called during the segment of code that copies cards, but that makes the code quite messy.
Hopefully there's a way to use 'copy card' without LiveCode automatically switching to the new card.
Failing that, is there a way to freeze the messages queue, and then clear it of openCard and closeCard messages, and restart it after the 'copy card' so that those messages are never sent? (I had a look at flushEvents, but I'm not sure it's designed for this)
Attached is a small stack that copies a card from a substack when you press a button. The openCard and closeCard handlers of the initial card display a dialog to show you when they're hit (though this doesn't happen in development mode, so you need to build it as a standalone or before running it).
Anyway, thanks for reading about my issue.
Cheers,
Eoghan.
I'm using 'copy card x of stack y to this stack' to copy a cached card of a substack of my app, to the main stack.
Is there any way to execute the above command without LiveCode then automatically displaying the copied card x? (as I want the initial card to remain on display)
I can add code to store the initial card ID before the copy, then 'go to card initialCardID' after the copy (and use 'lock screen' to stop the flicker) - but the problem is that the 'closeCard' handler of the initial card fires when the 'copy card' command is executed, and the 'openCard' handler fires when I 'go to card initialCardID'.
I did set a Custom Property to tell the initial card's openCard and closeCard handlers to bail out if they were called during the segment of code that copies cards, but that makes the code quite messy.
Hopefully there's a way to use 'copy card' without LiveCode automatically switching to the new card.
Failing that, is there a way to freeze the messages queue, and then clear it of openCard and closeCard messages, and restart it after the 'copy card' so that those messages are never sent? (I had a look at flushEvents, but I'm not sure it's designed for this)
Attached is a small stack that copies a card from a substack when you press a button. The openCard and closeCard handlers of the initial card display a dialog to show you when they're hit (though this doesn't happen in development mode, so you need to build it as a standalone or before running it).
Anyway, thanks for reading about my issue.
Cheers,
Eoghan.