Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!gatech!prism!vsserv!loligo!pepke From: pepke@loligo (Eric Pepke) Newsgroups: comp.sys.mac.programmer Subject: Re: Modeless dialogs, what am I doing wrong? Message-ID: <125@vsserv.scri.fsu.edu> Date: 28 Aug 89 15:45:48 GMT References: <1484@ndmath.UUCP> <14455@dartvax.Dartmouth.EDU> <8029@hoptoad.uucp> <14490@dartvax.Dartmouth.EDU> Sender: news@vsserv.scri.fsu.edu Reply-To: pepke@loligo.UUCP (Eric Pepke) Organization: Supercomputer Computations Research Institute Lines: 45 In article <14490@dartvax.Dartmouth.EDU> earleh@northstar.dartmouth.edu (Earle Horton) writes: > If you're using modeless dialogs, you might also want to set the >mouse cursor to the iBeamCursor cursor whenever the mouse is in an >active editText item. > >Point plover; >DialogPeek xyzzy; >CursHandle plugh; > >plugh = GetCursor(iBeamCursor); >GetMouse(&plover); > >if( xyzzy == (DialogPeek)FrontWindow()){ > if(PtInRect(mouse,&(*xyzzy->textH)->viewRect)){ > SetCursor(*plugh); > }else{ > SetCursor(&qd.arrow); > } >} > I was kind of wondering how Mr. Mahoney gets around his >philosophical problem with DialogPeek here. Your code only sets the cursor to an I-beam when it is in the current editText item. I prefer to have my cursor be an I-beam whenever it is in any editText item. After all, one of the main functions of the I-beam is to show where the insertion point will go when you click. This information is important whether there had been a prior click in that item or not. As the modality of the current editText item does not affect the behavior of the mouse, it should not affect the shape of the cursor. All you have to do is determine whether the cursor is within any of the editText items in the dialog. You can easily do this with GetDItem and do not require any DialogPeek access. I'm not going to post any armchair code because I would probably make a mistake and also becuase the method you use to determine what a given window contains is a matter of personal preference. Eric Pepke INTERNET: pepke@gw.scri.fsu.edu Supercomputer Computations Research Institute MFENET: pepke@fsu Florida State University SPAN: scri::pepke Tallahassee, FL 32306-4052 BITNET: pepke@fsu Disclaimer: My employers seldom even LISTEN to my opinions. Meta-disclaimer: Any society that needs disclaimers has too many lawyers.