Popup Button bug??
Craig Newman
craig at starfirelighting.com
Mon Jan 27 15:27:32 EST 2025
Bob.
What are you trying to accomplish that the native buttons do not do for you? The popUp command, to me, is simply a tool to invoke a display of resident menuItems that do not necessarily have to live at the button location itself, and that button not even needing to be visible.
Are you adding a lot of additional gadgetry?
Craig
> On Jan 27, 2025, at 2:01 PM, Bob Sneidar via use-livecode <use-livecode at lists.runrev.com> wrote:
>
> Interesting, the dictionary didn’t mention mouseUp. But some kind of mouse up or down handler has to be what makes the call.
>
> It turns out that rolling your own blocking popup “menu” is not very straightforward. Here is what I came up with:
>
> on popupMenu pMenu, pItems, pLocation
> -- anything less than 3 lines and the scrollbar does not display correctly
> if the number of lines of pItems >3 and \
> the last char pItems is cr then \
> delete last char of pItems
>
> set the text of pMenu to pItems
> set the height of pMenu to \
> min(the formattedHeight of pMenu, 178) — for me 178 is 10 lines of formattedText YMMV
> set the width of pMenu to the formattedWidth of pMenu
> set the topLeft of pMenu to pLocation
> show pMenu
> focus on pMenu
> set the hilitedLine of pMenu to empty -- because focus will auto-select line 1
> wait until the visible of pMenu is false with messages
> end popupMenu
>
>
> — in the script of a Scrolling List Field
> local lParentCard
>
> on selectionChanged
> put getParentCard(the long id of me) into lParentCard
> put the hilitedLine of me into tLine
> put line tLine of the text of me into tItem
> set the currentLocation of lParentCard to tItem — or whatever you want to do with tItem
> hide me
> end selectionChanged
>
> on escapeKey
> selectionChanged
> end escapeKey
>
> on focusOut
> selectionChanged
> end focusOut
>
> FUNCTION getParentCard pObjectID
> put offset("card id", pObjectID) into tStartChar
> put char tStartChar to -1 of pObjectID into tCardID
> return tCardID
> END getParentCard
>
> Bob S
>
>> On Jan 27, 2025, at 9:39 AM, Craig Newman via use-livecode <use-livecode at lists.runrev.com> wrote:
>>
>> Bob.
>>
>> It works just fine in a mouseUp handler as well. I just did it.
>>
>> Craig
>>
>>> On Jan 27, 2025, at 12:31 PM, Bob Sneidar via use-livecode <use-livecode at lists.runrev.com> wrote:
>>>
>>> Understood. That is why I wrote, I assure everyone there *IS* a button called “mnuLocations”. As I posted later, this command can only be used in a mouseDown handler. I think I knew this many, many years ago, but I forgot.
>>>
>>> Bob S
>>>
>>>
>>>> On Jan 27, 2025, at 9:28 AM, Craig Newman via use-livecode <use-livecode at lists.runrev.com> wrote:
>>>>
>>>> Bob .
>>>>
>>>> “popup” is not a command that creates a button. It only works with an existing button, opening its contents at a location of your choice. That button can be hidden, but its menu will appear anyway.
>>>>
>>>> Craig
>>>>
>>>>> On Jan 27, 2025, at 12:17 PM, Bob Sneidar via use-livecode <use-livecode at lists.runrev.com> wrote:
>>>>>
>>>>> Hi all.
>>>>>
>>>>> I have the command:
>>>>> popup pMenuButton at pLocation
>>>>>
>>>>> pMenuButton contains:
>>>>> button “mnuLocations"
>>>>>
>>>>> pLocation contains:
>>>>> 55,303
>>>>>
>>>>> I am getting the error:
>>>>> stack "moduleCardBehavior": execution error at line 360 (subwindow: can't find stack or button), char 1
>>>>>
>>>>> I assure everyone there *IS* a button called “mnuLocations”. What in the name of all <fill in the blank> is going on here??
>>>>>
>>>>> Bob S
>>>>>
>>>>> _______________________________________________
>>>>> use-livecode mailing list
>>>>> use-livecode at lists.runrev.com
>>>>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>>
>>>>
>>>> _______________________________________________
>>>> use-livecode mailing list
>>>> use-livecode at lists.runrev.com
>>>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list