Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.acorn.programmer > #256

Re: How to put a caret in a window

From Paul Sprangers <Paul@sprie.nl>
Subject Re: How to put a caret in a window
Newsgroups comp.sys.acorn.programmer
Date 2011-04-29 17:49 +0200
Message-ID <51cb982b94Paul@sprie.nl> (permalink)
References (4 earlier) <8a105eca51.Matthew@sinenomine.freeserve.co.uk> <51ca78d47ePaul@sprie.nl> <31d0a1ca51.Matthew@sinenomine.freeserve.co.uk> <51caa8d5c0Paul@sprie.nl> <7fbce5ca51.Matthew@sinenomine.freeserve.co.uk>
Organization None

Show all headers | View raw


Dear Matthew,

When I was reading your advice on how to calculate the place of the caret
when clicking in a string ...

> 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.

... I realised that I still don't understand the ins and outs (entries and
exits) of the Font_ScanString call.

When I subtract the x screen co-ordinate from the x mouse click, the result
is a number roughly between 100 and 400. Even if I convert that value to
millipoints (which multiplies it by 400, indeed), I still have a value that
is far, far less than the value of &7FFFFFFF that I originally had to pass
through R3, in order to get something returned in cx%.

Therefore, I was expecting that cx% would be 0 again, after passing a
calculated millipoints value, roughly between 40,000 and 160,000 through
R3. And so it appeared to be.

Apparently, I don't understand something (many things). Could you once
again try to explain it to me?

The relevant code, that I have so far is:

DEF PROCwindowclick(mx%,my%,button%)
CASE button% OF
   WHEN 1,4
      block%!0=window%
      SYS "Wimp_GetWindowInfo",,block%
      windowx%=block%!4-block%!16
      ox%=mx%-windowx%
      SYS "Font_Converttopoints",,ox% TO ,ox%
      PROCcaret(ox%,maxy%,LENstring$)
      PROCredraw(window%)
ENDCASE
ENDPROC

DEF PROCcaret(x%,y%,len%)
SYS "Font_ScanString",iconfont%,string$,(1<<7)+(1<<17),x%,y%,,,len% TO
,,,cx%,,,,l%
SYS "Font_ConverttoOS",,cx% TO ,cx%
SYS "Wimp_SetCaretPosition",window%,-1,cx%+10,-44,40,-1
ENDPROC

(maxy% in PROCcaret is previously set to &3FFFFFFF.)

Kind regards,
Paul Sprangers

Back to comp.sys.acorn.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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