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 <[email protected]> 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
>> <[email protected]> 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
>
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode