popup of menu (functionality not correct implemented...)
Martin Baxter
mb.ur at harbourhost.co.uk
Tue Nov 1 16:23:26 EST 2005
Ton,
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
here.
The offset of the popup topleft sets the last selection under the mouse
when the menu pops up, and I find that highlights it.
--card script
on mousedown
put max(field "num",1) into tn
popup btn "testpop" at mouseh()-8,(mousev()-8-((tn-1)*17))
end mousedown
--script of popup button "testpop"
on menupick
put the menuhistory of me into field "num"
end menupick
## My test stack has a field "num" which holds the
## last menuhistory of btn "testpop"
## just for testing purposes of course
Martin Baxter
Ton Kuypers wrote:
> :-(
>
> Not working either... I give up, will probably switch to another kind
> of menu...
>
> Thanks anyway!
>
> Ton
>
> 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
>> Dave
>>
>>
>>> :-(
>>>
>>> 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?
>>>
>>> Ton
>>>
>>>
>>> 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
>>> Dave
>>>
>>> _______________________________________________
More information about the use-livecode
mailing list