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


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

Finding location of current menu

Date 2020-01-30 23:43 +0000
From Matthew Phillips <spam2011m@yahoo.co.uk>
Newsgroups comp.sys.acorn.programmer
Subject Finding location of current menu
Message-ID <30e2ae3a58.Matthew@sinenomine.freeserve.co.uk> (permalink)

Show all headers | View raw


Menus are implemented as windows, but handled by the Wimp, as I understand
it.

In RiscOSM you can open a menu to view web pages relating to the item on the
map.  The software used to open the menu straight away, just showing the
links we could calculated direct from the map data.  A few versions ago we
enhanced it to look up the map item in Wikidata and obtain a wider range of
web links from there.  This came at a price: the menu does not open
immediately because the Wikidata API has to be called and return its results,
so we have a timeout (defaulting to five seconds) after which the basic links
appear and the Wikidata lookup is abandoned.

As a further enhancement, we're wanting the menu to open immediately, showing
the links derived direct from the map, and for the links from the Wikidata
lookup to be added once they have been fetched.  This will entail making the
menu longer, and therefore reopening it.

We know where we opened the menu initially, but the user might have dragged
the menu across the screen, so reopening it by giving explicit co-ordinates
might make it jump back to the original location.

The other option would be to use Wimp_CreateMenu passing 0 in R2 and R3, like
you do if you are reopening a menu after an Adjust click on one of the
items.  But that only works if you have not changed R1, the pointer to the
menu block.  When we add items to the menu, we sometimes have to move the
menu block because a larger block of memory has had to be allocated.  So
that's no good.

We were wondering if there is any way of finding the location of the current
menu so that we can open the lengthened menu in the right place.  I cannot
see a suitable SWI anywhere.

We came across Wimp_GetMenuState which refers to the window handle of the
menu in R2, but bizarrely that is as an input value, and I cannot see how you
are supposed to know the window handle of any menu!  The PRM explanation of
that call is quite unenlightening and it's hard to know how you are supposed
to use it with R0=1.  The RISC OS Select Wimp PRM does not say anything more.

That's rather irrelevant to our problem, but it does show that it seems to be
very difficult to get any information about the currently open menu, other
than the current tree state for menus you have opened.

Any ideas?  We're currently favouring reopening the lengthened menu where we
first opened it.

-- 
Matthew Phillips
Durham

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


Thread

Finding location of current menu Matthew Phillips <spam2011m@yahoo.co.uk> - 2020-01-30 23:43 +0000
  Re: Finding location of current menu druck <news@druck.org.uk> - 2020-01-31 08:10 +0000
  Re: Finding location of current menu news@sprow.co.uk - 2020-01-31 00:55 -0800
    Re: Finding location of current menu Matthew Phillips <spam2011m@yahoo.co.uk> - 2020-02-02 13:19 +0000
      Re: Finding location of current menu Alan Adams <alan@adamshome.org.uk> - 2020-02-02 20:12 +0000
  Re: Finding location of current menu Steve Fryatt <news@stevefryatt.org.uk> - 2020-01-31 22:45 +0000
    Re: Finding location of current menu Jean-Michel <jmc.bruck@orange.fr> - 2020-02-01 20:38 +0100
    Re: Finding location of current menu Matthew Phillips <spam2011m@yahoo.co.uk> - 2020-02-02 13:17 +0000
      Re: Finding location of current menu Terry Kelly <tk@cestriant.plus.com> - 2020-02-02 16:45 +0000
        Re: Finding location of current menu Steve Fryatt <news@stevefryatt.org.uk> - 2020-02-02 19:44 +0000
      Re: Finding location of current menu svrsig <chris@svrsig.org> - 2020-02-14 06:48 -0800
        Re: Finding location of current menu Matthew Phillips <spam2011m@yahoo.co.uk> - 2020-02-14 22:03 +0000
          Re: Finding location of current menu svrsig <chris@svrsig.org> - 2020-02-19 10:45 -0800

csiph-web