Change button label by pressing the command key

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Fjord
Posts: 132
Joined: Sat Dec 06, 2008 6:18 pm
Location: France

Re: Change button label by pressing the command key

Post by Fjord » Sat Jul 23, 2022 3:03 pm

@RCozens: not a bad idea, of course, except for the fact that I have a MacBook Pro, so no multi-button mouse. :( but maybe I could tune some system pref to simulate a multi-button mouse? BTW, how do you use your software on a portable Mac?
--
François

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9454
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Change button label by pressing the command key

Post by richmond62 » Sat Jul 23, 2022 4:39 pm

I have a MacBook Pro, so no multi-button mouse.
I assume you mean that you only have a trackpad on your MacBook Pro.

You could, of course, pop round the corner and for a few bob pick up a 3 button mouse.

---------------

How to right-click on a Mac trackpad

The trackpad on your Apple laptop: MacBook Air or MacBook Pro
can perform all the functions you usually do with a mouse, including the right click.

To be able to right-click on a MacBook, you need to enable the secondary click function in System Preferences.

To enable right click on your MacBook trackpad:

1. Open System Preferences

2. Choose Trackpad
-
tPad.jpg
-
3. Select the box next to Secondary click:
-
tPad2.jpg
-
4. Click on the triangle to get at the drop down menu and choose:

Click with two fingers: This allows you to right-click by slightly tapping your touchpad with 2 fingers

Click in the bottom right corner: This allows you to right-click by clicking in the bottom right corner of your touchpad

Click in bottom left corner: This allows you to right-click by clicking in the bottom left corner of your touchpad
-
tPad3.jpg

RCozens
Posts: 138
Joined: Thu Aug 05, 2021 6:42 am
Location: Manchester, CA USA

Re: Change button label by pressing the command key

Post by RCozens » Sat Jul 23, 2022 5:31 pm

Fjord wrote:
Sat Jul 23, 2022 3:03 pm
@RCozens: not a bad idea, of course, except for the fact that I have a MacBook Pro, so no multi-button mouse. :( but maybe I could tune some system pref to simulate a multi-button mouse? BTW, how do you use your software on a portable Mac?
My idiocy! I wrote that (and this) message on an HP laptop with a track pad....and a three-button wireless mouse I added because I was having difficulty adjusting to the pad.

Still, if it results in one-hand actions, as opposed to pressing a mouse button or pad with one hand and a keyboard key with the other, I think it is preferable.

Thanks for calling this to my attention.
Rob Cozens dba Serendipity Software Company
Manchester, CA USA

Each new generation gives more attention to the man-made world...
and less attention to the world that made man.

bobcole
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 136
Joined: Tue Feb 23, 2010 10:53 pm
Location: Saint Louis, Missouri USA

Re: Change button label by pressing the command key

Post by bobcole » Mon Jul 25, 2022 2:56 am

I couldn't find the "Use F1…" in System Prefs > Keyboard > Shortcuts.
See: System Prefs > Keyboard > Keyboard (not Shortcuts)

I don't think this is helpful, though.
FYI,
Bob

MacOs 12.5
LC 9.6.8

stam
Posts: 2755
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Change button label by pressing the command key

Post by stam » Wed Jul 27, 2022 2:32 am

Fjord wrote:
Sat Jun 04, 2022 5:50 pm
All I was thinking of in my original post was, having two variants of the same script in the same btn, one to act on a single cd, one to act on all cds. Basically, I can have 2 different btns; I only wanted to save space on the cd.
Others have given advice on how to implement this - but as Richard says this has an impact on the cognitive load demanded by the end-user. Then there is the theoretical issue with using with using the on idle handler or a 'send in time' command to check of the commandKey is down.

If the purpose of this is to reduce the number of buttons maybe consider an alternative approach? Instead of relying on modifier keys and using the on idle handler to change the label of the button and subsequent action, why not give a visual cue on mouseEnter that shows other options?
I imagine this would require a group and some group-wide code for resizing and re-labelling the various bits and to handle mouse actions etc, but once created can be adapted to any button and offer more than one alternative.

For example you could show a smaller button that when clicked on changes the main button to give an alternative, or shows a popup menu if there are > 1 options. A mockup for a version with 1 alternative:
example.jpg
(button 'segments' shown were created with the free widget customRect2 - https://github.com/Hoerwi/openXTalk-Widget-CustomRect2)

The above is just a mockup of what it could be but you get the idea - no need to use idle to check for commandKey and more importantly no one needs to remember how to trigger an alternative function as the there is a visual cue. I'll admit i've not had to do anything like this as we're really talking desktop environments here and space isn't really an issue, but maybe this alternative approach may be useful?

HTH
Stam

Post Reply

Return to “Talking LiveCode”