acmfiu@serss0.fiu.edu (ACMFIU) (05/08/91)
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
meekins@gryphon.cis.ohio-state.edu (Tim Meekins) (05/08/91)
In article <3520@kluge.fiu.edu> acmfiu@serss0.fiu.edu (ACMFIU) writes: > >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? Isn't MoveTo using local coordinates? So, by passing a global coordinate from _LocalToGlobal to a function expecting local coordinates will do exactly what you describe. > >albert -- +---------------------------S-U-P-P-O-R-T-----------------------------------+ |/ Tim Meekins <<>> Snail Mail: <<>> Apple II \| |> meekins@cis.ohio-state.edu <<>> 8372 Morris Rd. <<>> Forever! <| |\ timm@pro-tcc.cts.com <<>> Hilliard, OH 43026 <<>> /|
dlyons@Apple.COM (David A. Lyons) (05/09/91)
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.
bazyar@ernie (Jawaid Bazyar) (05/10/91)
In article <118378@tut.cis.ohio-state.edu> meekins@gryphon.cis.ohio-state.edu > >Isn't MoveTo using local coordinates? So, by passing a global coordinate >from _LocalToGlobal to a function expecting local coordinates will do >exactly what you describe. ToolBox ref #2 claims MoveTo uses global coordinates. This actually seems pretty brain dead to me- I would check manual updates, technotes,etc. Or wait for Dave or Matt or Andy to say something. -- Jawaid Bazyar | "Twenty seven faces- with their eyes turned to Senior/Computer Engineering | the sky. I have got a camera, and an airtight bazyar@cs.uiuc.edu | alibi.." Apple II Forever! | I need a job... Be privileged to pay me! :-)
mattd@Apple.COM (Matt Deatherage) (05/11/91)
In article <1991May9.204833.23227@m.cs.uiuc.edu> bazyar@cs.uiuc.edu (Jawaid Bazyar) writes: >In article <118378@tut.cis.ohio-state.edu> meekins@gryphon.cis.ohio-state.edu >> >>Isn't MoveTo using local coordinates? So, by passing a global coordinate >>from _LocalToGlobal to a function expecting local coordinates will do >>exactly what you describe. > > ToolBox ref #2 claims MoveTo uses global coordinates. This actually seems >pretty brain dead to me- I would check manual updates, technotes,etc. >Or wait for Dave or Matt or Andy to say something. > You guys can't always wait on one of us -- we might go get a real life. (Dave continually claims he has one, but Dave thinks he's funny at 3 AM after 18 hours of LineEdit and 25 caffiene-filled soft drinks.) Toolbox Reference Volume 3, page 43-2, "QuickDraw II Error corrections": "Chapter 16 states that the coordinates passed to the LineTo and MoveTo calls should be expressed as global coordinates. In fact, the coordinates must be local and must refer to the GrafPort in which the drawing or moving takes place." -- ============================================================================ Matt Deatherage, Developer Technical | The opinions expressed herein are Support, Apple Computer, Inc. | not those of Apple Computer, and Personal mail only, please. Thanks. | shame on you for thinking otherwise. ============================================================================