Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!apple!dlyons From: dlyons@Apple.COM (David A. Lyons) Newsgroups: comp.sys.apple2 Subject: Re: problems positioning cursor in window Message-ID: <52617@apple.Apple.COM> Date: 9 May 91 03:26:43 GMT References: <3520@kluge.fiu.edu> Organization: Apple Computer Inc., Cupertino, CA Lines: 48 In article <3520@kluge.fiu.edu> acmfiu@serss0.fiu.edu (ACMFIU) writes: >i have the following window on the desktop > > ------------------------------------------------- > | title | > ------------------------------------------------- > | * | > | ** | > | | > | | > ------------------------------------------------- > >for now, disregard * and **. > >i create the window with _NewWindow2. i then want to write a string to >the upper left corner of the window (where * is located). so, i just >_WriteCString my string and it appears there. now, as far as i know, * >has local coordinates (0, 0). so, if i _LocalToGlobal (0,0) and then >_MoveTo the result of this, i should appear where * is. however, this does >not work. the string appears where ** is located after the _MoveTo. > >someone want to explain what's going on? > >albert Tim Meekins is right--by converting (0,0) to global coordinates and then using the result in MoveTo, you're drawing the string at a position relative to the top left of your window that *depends on* the location of your window on the screen. The point of local coordinates is that you usually don't have to worry about different coordinate systems. MoveTo works within a port, so it uses local coordinates. The only thing to watch out for is that text is mostly drawn *above* the pen. You need to MoveTo the *bottom left* of where you want your text, like MoveTo(2,10). You may want to use GetFontInfo and/or GetFontGlobals to find the ascent, descent, and leading for your font are; or you may want to just hard-code the values for Shaston 8. Depends on your application and how much work you want to do to be flexible. -- David A. Lyons, Apple Computer, Inc. | DAL Systems Apple II System Software Engineer | P.O. Box 875 America Online: Dave Lyons | Cupertino, CA 95015-0875 GEnie:DAVE.LYONS CompuServe:72177,3233 Internet:dlyons@apple.com My opinions are my own, not Apple's.