Menu Mnemonics
Bob Sneidar
bobsneidar at iotecdigital.com
Fri Jan 5 17:40:15 EST 2024
A slightly better version:
on rawKeyUp pKey
-- put pKey
put getParentCard(the long id of the target) into tParentCard
put the editing of tParentCard into tEditMode
if tEditMode is empty then \
pass rawKeyUp
switch pKey
case 65307 -- esc
if the editing of tParentCard is among the items of "new,edit" and \
there is a button "btnCancel" of tParentCard then \
send mouseUp to button "btnCancel" of tParentCard in 15 milliseconds
break
case 65535 -- del
if the editing of tParentCard is "view" and \
there is a button "btnDelete" of tParentCard then \
send mouseUp to button "btnDelete" of tParentCard in 15 milliseconds
break
case 65293 -- return
if the editing of tParentCard is "view" and \
there is a button "btnEdit" of tParentCard then \
send mouseUp to button "btnEdit" of tParentCard in 15 milliseconds
break
case 65421 -- enter
if the editing of tParentCard is "view" and \
there is a button "btnEdit" of tParentCard then \
send mouseUp to button "btnEdit" of tParentCard in 15 milliseconds
break
end switch
pass rawKeyUp
end rawKeyUp
> On Jan 5, 2024, at 2:33 PM, Bob Sneidar <bobsneidar at iotecdigital.com> wrote:
>
> NVM. I decided to use rawKeyUp for this. I have done this in the past.
>
> on rawKeyUp pKey
> put pKey
> put getParentCard(the long id of the target) into tParentCard
> put the editing of tParentCard into tEditMode
>
> if tEditMode is empty then \
> pass rawKeyUp
>
> switch pKey
> case 65307 -- esc
> if the editing of tParentCard is among the items of "new,edit" then \
> send mouseUp to button "btnCancel" of tParentCard in 5 milliseconds
>
> break
> case 65535 -- del
> if the editing of tParentCard is "view" then \
> send mouseUp to button "btnDelete" of tParentCard in 15 milliseconds
>
> break
> case 65293 -- return
> if the editing of tParentCard is "view" then \
> send mouseUp to button "btnEdit" of tParentCard in 15 milliseconds
>
> break
> case 65421 -- enter
> if the editing of tParentCard is "view" then \
> send mouseUp to button "btnEdit" of tParentCard in 15 milliseconds
>
> break
> end switch
>
> pass rawKeyUp
> end rawKeyUp
>
> FYI the getParentCard function simply returns the long id of the card the target is on. The editing of a card is a custom property I set when entering one of 4 modes, New, Edit, View and Search.
>
> Bob S
>
>
>> On Jan 5, 2024, at 2:11 PM, Bob Sneidar via use-livecode <use-livecode at lists.runrev.com> wrote:
>>
>> Hi all.
>>
>> When creating menus, I can put an ampersand before any character in the menu item and that becomes the Command Key Equivalent on MacOS. But what if I want the Del key to trigger the Delete menu item? Is there a way to set the text for that? I tried doing it in the Menu Builder but no go.
>>
>> Bob S
>
More information about the use-livecode
mailing list