Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!ames!elroy.jpl.nasa.gov!mipl3!dfs059 From: dfs059@ipl.jpl.nasa.gov (Dan Stanfill) Newsgroups: comp.sys.mac.programmer Subject: Re: Modeless dialogs, what am I doing wrong? Message-ID: <5331@ipl.jpl.nasa.gov> Date: 18 Jul 89 12:27:51 GMT Organization: Jet Propulsion Laboratory, Image Processing Lab Lines: 46 tim@toad.com (Tim Maroney) writes: >In article <5266@ipl.jpl.nasa.gov> dfs059@ipl.jpl.nasa.gov (Dan Stanfill) >writes: >>NO! While that may work, for a modeless dialog, IsDialogEvent() handles the >>cursor blinking. The secret is to make sure you call it even when there is no >>event, as in the following example: >> >> something_happened = GetNextEvent(everyEvent, &event); >> if (IsDialogEvent(&event)) /* call even if nothing happened */ >> { /* to make cursor blink */ >> doDialogs(&event); >> if (event.what != keyDown) continue; >> } > >No, I'm sorry, but if you'd taken the ten seconds to consult Inside Mac >before you posted this, you'd have seen that IsDialogEvent does no such >thing. It is DialogSelect that will do the cursor blinking on a null >event. IsDialogEvent by itself will do exactly nothing. >-- >Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com Well, instead of the ten seconds Mr. Maroney took to consult his manual, I actually read it. Inside Mac I-416 says under IsDialogEvent: Warning: If your modeless dialog contains any editText items, you must call IsDialogEvent (and then DialogSelect) even if GetNextEvent returns FALSE; otherwise your dialog won't receive null events and the caret won't blink. In the code fragment above, doDialogs() calls DialogSelect(), only when IsDialogEvent() returns TRUE. This code works flawlessly, and editable text items always blink just fine. I have verified with the debugger that indeed DialogSelect is not called except in response to an actual user event, thus it is clearly IsDialogEvent which causes the caret to blink. Also, responses such as "if you'd taken the ten seconds to consult Inside Mac..." are ridiculously juvenile and uncalled for on a forum in which people are trying to help others. Dan Stanfill Image Processing Laboratory Jet Propulsion Laboratory dfs@mipl8.jpl.nasa.gov dfs059@ipl.jpl.nasa.gov