Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.acorn.programmer > #238
| Date | 2011-04-28 08:20 +0100 |
|---|---|
| From | Matthew Phillips <mnews@sinenomine.freeserve.co.uk> |
| Newsgroups | comp.sys.acorn.programmer |
| Subject | Re: How to put a caret in a window |
| Message-ID | <7fbce5ca51.Matthew@sinenomine.freeserve.co.uk> (permalink) |
| References | (3 earlier) <702330ca51.Matthew@sinenomine.freeserve.co.uk> <8a105eca51.Matthew@sinenomine.freeserve.co.uk> <51ca78d47ePaul@sprie.nl> <31d0a1ca51.Matthew@sinenomine.freeserve.co.uk> <51caa8d5c0Paul@sprie.nl> |
In message <51caa8d5c0Paul@sprie.nl> on 27 Apr 2011 Paul Sprangers wrote: > > You'll need to set bit 8 in order to make sure the right font is measured > > As far as I understand, bit 8 doesn't need to be set if R1 contains the > pointer to the intended font. Yes, that makes sense. > > I think that bit 17 should only be set if you have a real x,y of a mouse > > click in your R3,4 and want to know the caret position and index into the > > string that is appropriate for placing the caret given the click at that > > x,y position. > > That is exactly what is next on my ToDo list, > My window has to mimic a writable icon, so it must be possible to click > somewhere in a given string and put the caret there. The only question at > the moment is: How? This one is not too bad. Subtract from the x and y of the mouse click the x and y screen co-ordinates of the place you are painting the string and pass those in R3 and R4. Pass the pointer to the string in R1 as before, and R5 and R6 equal to zero unless you want to use those features. Flags should be (1<<7)+(1<<17) Put the length of the full string in R7 (this may be unnecessary but I guess it might ensure that Font_ScanString knows where to stop scanning, which is probably a good thing to know). You'll then be given the correct co-ordinates for setting the caret in R3,R4 and R1 will point to the character in the string which the caret is before, i.e. the position you would need to insert any new characters typed. The coordinates are returned in millipoints, so use Font_ConverttoOS to get OS units. I see I have code which just divides by 400 but that's probably not particularly good practice. Regarding my suggestion that you avoid using &7FFFFFFF for big values in R3 and R4. Looking at my code again I see that actually it was only the "y" value that caused a problem, and in fact only when using the call with bit 17 set. I use &10000000 in y and &7FFFFFFF for x and it all works fine. I cannot remember what the symptoms of the problem were: I think it only affected certain fonts or font sizes. I don't seem to have documented it in the source code. It's perhaps in my CVS logs somewhere. But anyway, I'd advise not using &7FFFFFFF for R4 to be on the safe side. -- Matthew Phillips Durham
Back to comp.sys.acorn.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to put a caret in a window Paul Sprangers <Paul@sprie.nl> - 2011-04-25 17:34 +0200
Re: How to put a caret in a window Matthew Phillips <mnews@sinenomine.freeserve.co.uk> - 2011-04-25 19:29 +0100
Re: How to put a caret in a window Paul Sprangers <Paul@sprie.nl> - 2011-04-25 23:28 +0200
Re: How to put a caret in a window Matthew Phillips <mnews@sinenomine.freeserve.co.uk> - 2011-04-26 23:17 +0100
Re: How to put a caret in a window Matthew Phillips <mnews@sinenomine.freeserve.co.uk> - 2011-04-27 07:38 +0100
Re: How to put a caret in a window Paul Sprangers <Paul@sprie.nl> - 2011-04-27 13:31 +0200
Re: How to put a caret in a window Jeremy Nicoll - news posts <jn.nntp.scrap007@wingsandbeaks.org.uk> - 2011-04-27 13:14 +0100
Re: How to put a caret in a window Paul Sprangers <Paul@sprie.nl> - 2011-04-27 17:15 +0200
Re: How to put a caret in a window pdm <pd.miller2@tiscali.co.uk> - 2011-04-27 08:59 -0700
Re: How to put a caret in a window Paul Sprangers <Paul@sprie.nl> - 2011-04-27 21:50 +0200
Re: How to put a caret in a window pdm <pd.miller2@tiscali.co.uk> - 2011-04-27 23:19 -0700
Re: How to put a caret in a window Matthew Phillips <mnews@sinenomine.freeserve.co.uk> - 2011-04-27 19:58 +0100
Re: How to put a caret in a window Paul Sprangers <Paul@sprie.nl> - 2011-04-27 22:15 +0200
Re: How to put a caret in a window Martin Wuerthner <spamtrap@mw-software.com> - 2011-04-30 17:12 +0200
Re: How to put a caret in a window Rick Murray <heyrickmail-usenet@yahoo.co.uk> - 2011-04-30 19:12 +0200
Re: How to put a caret in a window Paul Sprangers <Paul@sprie.nl> - 2011-05-02 09:37 +0200
Re: How to put a caret in a window Alan Wrigley <spamhater@keepyourfilthyspamtoyourself.co.uk> - 2011-05-02 08:49 +0100
Re: How to put a caret in a window Paul Sprangers <Paul@sprie.nl> - 2011-05-02 09:59 +0200
Re: How to put a caret in a window Alan Adams <alan@adamshome.org.uk> - 2011-05-02 21:27 +0100
Re: How to put a caret in a window Steve Fryatt <news@stevefryatt.org.uk> - 2011-05-02 09:08 +0100
Re: How to put a caret in a window Paul Sprangers <Paul@sprie.nl> - 2011-04-30 12:54 +0200
Re: How to put a caret in a window Rick Murray <heyrickmail-usenet@yahoo.co.uk> - 2011-04-30 13:52 +0200
Re: How to put a caret in a window cferris@freeRemoveuk.com.invalid - 2011-04-30 13:34 +0100
Re: How to put a caret in a window Rick Murray <heyrickmail-usenet@yahoo.co.uk> - 2011-04-30 15:39 +0200
Re: How to put a caret in a window Matthew Phillips <mnews@sinenomine.freeserve.co.uk> - 2011-04-28 08:20 +0100
Re: How to put a caret in a window pdm <pd.miller2@tiscali.co.uk> - 2011-04-28 02:16 -0700
Re: How to put a caret in a window Paul Sprangers <Paul@sprie.nl> - 2011-04-29 17:49 +0200
Re: How to put a caret in a window Rick Murray <heyrickmail-usenet@yahoo.co.uk> - 2011-04-30 00:05 +0200
csiph-web