Alvin wrote: > MacArthur, Ian (SELEX) (UK) wrote: >> I think setting "evt" only for the events we want is the only way to get >> it to work right on WinXP - or, at the very least we must ignore the >> "spurious" FL_MOVE events that we get after the FL_PASTE occurs. >> >> Either using add_timeout() or add_check() works pretty much the same on >> WinXP here. I'm not keen on using an idle callback for this, since it >> maxes out the CPU whilst the confirmation dialog is displayed, which is >> a Bad Thing for my money. >> >> I guess if it works OK everywhere then add_check() is probably the most >> natural way to go. >> >> In all three cases it only works if "evt" is not allowed to be >> overwritten by FL_MOVE events that occur after the FL_PASTE is received, >> before it is processed. >> >> >>> I'll hold back updating the example till we know if either of >>> those work >>> better than a timeout. When I update the example, I will also include >>> making copies of Fl::event() and Fl::event_length() as that >>> is another good >>> suggestion too (by Greg I think). >> >> Yes - I've been using Greg's modified version of the code. The previous >> version does not work at all on OSX, so it needs the copy of event_text >> and event_length to work. >> > > Sounds good. I will update the article to use add_check(). The only reason > I went with add_timeout() was that it does not require it to be explicitly > removed once it is done. > > Thanks for testing on Windows. > > Alvin
I have updated the Fl_DND_Box code in both articles (Receiving #770 and Initiating #771) to make a copy of the event and event payload. In the end, I stuck with add_timeout(). After re-reading the docs for add_timeout and add_check, add_timeout seemed like the cleanest way. For example, a timeout is executed regardless of the events that are coming in. Whereas, a "check" can be blocked if a lot of events are coming in as per this sentence in the docs: " ... If events are coming in quickly, whole blocks of them will be processed before this is called once. ..."[1]. Also, I like how a timeout, by default, is executed once and then is gone as per the docs[2] stating its a "one-shot" callback. Now, I haven't used a "check" callback all that much. But, what I'm not clear on from the docs[1] is whether a check is repeatedly called and stopped only if removed, or if it is called just once and then "goes away"? [1] http://www.fltk.org/documentation.php/doc-1.1/Fl.html#Fl.add_check [2] http://www.fltk.org/documentation.php/doc-1.1/Fl.html#Fl.add_timeout -- Alvin _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

