Best Practice for updating the screen?
Paul Dupuis
paul at researchware.com
Tue May 23 11:53:33 EDT 2017
Thank you Richard and Mark,
Okay, another reason (among so very many) why I have to get our main app
from 6.7.11 up to 8.1.x or higher as soon as possible.
That said, this particular case is as follows:
We have a substack that is a PDF window using XPDF. XPDF can take some
time to load large PDF files (say several hundred pages). While the
external is actually loading the PDF file, the script continues, so we
hide the PDFViewer and display a image behind it that informs the user
to please wait. I actually unlock the screen before hiding the PDF
viewer, but it seemed I needed a wait 0 with messages AFTER hiding the
viewer for it to actually disappear. The script then relocks the screen
and does some more work to set up for the PDF file.
The bug we discovered recently is a user action in another window,
pressing the down arrow key (actually holding it down constantly) to
rapidly scroll through a list of "bookmarks" in the PDF, mean that while
the arrow down key handler was invoking the script to load a new PDF
file to display the bookmark, the "wait 0 with messages" in the pdf open
handler allows the next arror down message to start executing.
I addressed this this morning by flushing key events before the 'wait 0
with messages' which actually works rather well to solve this problem. I
also added checks to handlers that display the "bookmark" to skip that
action if the pdfViewer is not visible (still hidden while a file is
loading).
These two fixes seem to have addressed the issue nicely, but I was
curious as to what the "best practice" was. The answer is "be on a
current release of livecode and just unlock the screen", so back to work
for me on getting to that state! :-)
More information about the use-livecode
mailing list