Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.acorn.programmer > #299
| Date | 2011-05-14 00:58 +0100 |
|---|---|
| From | Rik Griffin <rik.griffin@btinternet.com> |
| Newsgroups | comp.sys.acorn.programmer |
| Subject | Re: Toolbox Mouse position |
| Message-ID | <79a2fad251.rik@iyonix.hell> (permalink) |
| References | <a9bd1414-f078-4e4c-af3b-2d7a3ee84705@e13g2000vbo.googlegroups.com> <88a93ecb-a883-48c6-abd2-76ab95f20cc7@cu4g2000vbb.googlegroups.com> |
| Organization | None |
In message <88a93ecb-a883-48c6-abd2-76ab95f20cc7@cu4g2000vbb.googlegroups.com>
Mister Ron <mrronman@googlemail.com> wrote:
>
> Thanks guys for the info.
> I tried Martin's method then Rik's.
> I'm now saving the position of the click in the click event. Then in
> the menu_click event find the ComponentId.
>
> However some of my displayfields are greyed out and
> window_wimp_to_toolbox seem to return -1 for these icons.
Hmm, yes, I just tested it in ResTest and greyed out gadgets return an icon
number of -1 in the mouse click event. I never knew that, or probably I did
and I've forgotten it :)
By the way, I was wrong originally, you don't need to set your window's
background to button type 3 to see Menu clicks, it seems they are always
returned.
> I'm now trying to calculate the window position again so I can work
> out which icon i'm over with the following:
>
> /* Find window Y coords */
> WimpGetWindowInfoBlock block;
> block.window_handle = mouse_click_position.window_handle;
> e=wimp_get_window_info( &block ); if(e) raise_error(e);
>
> This doesn't seem to error but crashes later with an ** unrecoverable
> error in run time system : free failed
>
> Does this look right or is there a better method to use.
Wimp_GetWindowInfo returns a block for the window AND all the icons in it.
So it'll overrun the end of the WimpGetWindowInfoBlock. You can stop the
icon information being written to your block by setting bit 1 of r0.
But if all you want is the window position, it'd be simpler to use
wimp_get_window_state which uses a WimpGetWindowStateBlock, which just
basically gives you the position of the window and its flags.
--
Rik Griffin
Back to comp.sys.acorn.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Toolbox Mouse position Mister Ron <mrronman@googlemail.com> - 2011-05-10 13:50 -0700
Re: Toolbox Mouse position Alan <alan_baa@hotmail.com> - 2011-05-11 04:36 -0700
Re: Toolbox Mouse position Mister Ron <mrronman@googlemail.com> - 2011-05-11 13:15 -0700
Re: Toolbox Mouse position Martin Wuerthner <spamtrap@mw-software.com> - 2011-05-11 22:59 +0200
Re: Toolbox Mouse position Rik Griffin <nospam@denbridgemarine.com> - 2011-05-12 10:14 +0100
Re: Toolbox Mouse position Mister Ron <mrronman@googlemail.com> - 2011-05-13 13:28 -0700
Re: Toolbox Mouse position Rik Griffin <rik.griffin@btinternet.com> - 2011-05-14 00:58 +0100
Re: Toolbox Mouse position Tank <webmaster@tankstage.co.uk> - 2011-05-14 07:44 +0100
csiph-web