popup of menu (functionality not correct implemented...)
mb.ur at harbourhost.co.uk
Tue Nov 1 15:23:26 CST 2005
Although you have given up, you might want to consider this, which seems
to work in a simple test stack.
The flimsy part of this is that you need to know the height of a
menuitem in your popup, and I don't know a way to get this
programmatically. I did a screenshot and measured it at 17 pixels on XP
The offset of the popup topleft sets the last selection under the mouse
when the menu pops up, and I find that highlights it.
put max(field "num",1) into tn
popup btn "testpop" at mouseh()-8,(mousev()-8-((tn-1)*17))
--script of popup button "testpop"
put the menuhistory of me into field "num"
## My test stack has a field "num" which holds the
## last menuhistory of btn "testpop"
## just for testing purposes of course
Ton Kuypers wrote:
> Not working either... I give up, will probably switch to another kind
> of menu...
> Thanks anyway!
> On 1-nov-05, at 18:25, David Burgun wrote:
>> Just one more!
>> Try this:
>> select line fGetMenuItem(fld "TestField") of the text of me
>> About 1000 to 1 odds on it working tho!
>> All the Best
>>> Unless I misunderstood what you ment, it doesn't work...
>>> I have a button on the card of type "pop up" named "TestMenu"
>>> This button has got 10 lines of text, which creates a menu of 10 items.
>>> I have one field on the card named "Test"
>>> The button contains the following code:
>>> on mouseDown
>>> select line fGetMenuItem(fld "TestField") of me
>>> end mouseDown
>>> ON menupick vChoice
>>> put vChoice into fld "TestField"
>>> set the menuHistory of me to fGetMenuItem(fld "TestField")
>>> END menupick
>>> FUNCTION fGetMenuItem vMenuItemName
>>> put the text of button "TestMenu" into vMenuText
>>> put lineOffset(vMenuItemName,vMenuText) into vMenuItem
>>> return vMenuItem
>>> END fGetMenuItem
>>> and the result: The menu just pops up with item 1 underneath the
>>> cursor :-(
>>> Any more suggestions?
>>> On 1-nov-05, at 18:03, David Burgun wrote:
>>> Have you tried:
>>> select line GetMeniItem("theMenuString") of me
>>> This may work.
>>> All the Best
More information about the use-livecode