Checkboxes - stop users from interacting?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
stam
Posts: 2634
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Checkboxes - stop users from interacting?

Post by stam » Fri Apr 02, 2021 6:17 pm

Hi all,

I have some data i'd like to show in a data grid and summarise some of the ancillary data simply.
The data is ideally suited for checkboxes - i.e. just a binary display for each of the data points to be summarised.

As these are for display only, i don't want users to be able to tick/untick these.

if i set the checkbox's disabled to true, it takes on a truly disabled state which isn't ideal looks awful and is not the look i'm aiming for.

So the question is a) how can i change the disabled colours for said checkboxes, or if that's not possible b) how can i stop mouse actions from interacting with the checkbox without disabling it? (trapping mouseDown/Up doesn't seem to work...)

Or should i just not bother with checkboxes and make a composite of other elements?

Many thanks
Stam

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Checkboxes - stop users from interacting?

Post by Klaus » Fri Apr 02, 2021 6:44 pm

Hi Stam,

checkboxes like many other native controls are supplied by the iunderlying OS,
so not was to modify them.

I would just use two different SVG widgets which looks like an un-/checked checkbox.
e.g. SVGs named:
-> check
-> check empty


Best

Klaus

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9579
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Checkboxes - stop users from interacting?

Post by dunbarx » Fri Apr 02, 2021 9:05 pm

Stam. Do this in the button script:

Code: Select all

on mouseUp
   set the hilite of me to not the hilite of me
end mouseUp
The checkbox will not change its state if you click on it, but you can always set its hilite property by other means

Craig

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Checkboxes - stop users from interacting?

Post by Klaus » Fri Apr 02, 2021 9:33 pm

dunbarx wrote:
Fri Apr 02, 2021 9:05 pm
...
The checkbox will not change its state if you click on it,...
Au contraire, mon ami!

Your script will CHECK an unchecked checkbox and UNCHECK a checked checkbox!
Said Pavel Chekov. :D

EDIT:
AHHH, sorry, yes, it works if "autohilite" is CHECKED (sic!) for the button.
I tested with "autohilte" set to false.

kdjanz
Posts: 300
Joined: Fri Dec 09, 2011 12:12 pm
Location: Fort Saskatchewan, AB Canada

Re: Checkboxes - stop users from interacting?

Post by kdjanz » Fri Apr 02, 2021 10:39 pm

I agree with Klaus' suggestion of SVG widgets. You want them to look like data UI items and not confuse them with native controls for the system.
In the abstract, they could even be red or green coloured squares that show the on or off states.

If they look like something that they are used to clicking, then they will get clicked! And when they don't work like that, the user thinks they are broken.

My two cents -- although we no longer have pennies in Canada 8-)

Kelly

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

Re: Checkboxes - stop users from interacting?

Post by stam » Sat Apr 03, 2021 12:54 am

Thanks guys
dunbarx wrote:
Fri Apr 02, 2021 9:05 pm

Code: Select all

on mouseUp
   set the hilite of me to not the hilite of me
end mouseUp
Craig's suggestion certainly works - thank you!
I thought i may be missing something, that's certainly a functional workaround.

It's not an ideal interface but i'm using it for a prototype and will substitute down the line.
But in the process of trying to put something together quickly this had me stumped and i've spent much more time than i'd care to admit on this!

Thanks all
Stam

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9579
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Checkboxes - stop users from interacting?

Post by dunbarx » Sat Apr 03, 2021 1:50 am

Klaus,

Many ways to do this. If you clear "autoHilite", nothing happens anyway. My post overthinks this thing.

Craig

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

Re: Checkboxes - stop users from interacting?

Post by stam » Sat Apr 03, 2021 2:08 am

dunbarx wrote:
Sat Apr 03, 2021 1:50 am
Many ways to do this. If you clear "autoHilite", nothing happens anyway. My post overthinks this thing.
Ah that was what i was actually looking for!

The previous suggestion kinda worked, but a) it flickers slightly and b) doesn't cater for double clicks, so end up being more code that isn't really needed, whereas disabling autoHilite renders the checkbox visually inert, which is what i was looking...

thanks once again guys
Stam

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9579
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Checkboxes - stop users from interacting?

Post by dunbarx » Sat Apr 03, 2021 5:16 am

Klaus mentioned that gadgets like checkboxes are drawn and are managed by the underlying OS. And, at least on a Mac, a checkbox automatically changes its hilite when clicked. LC takes over right away, and resets the hilite to its previous state. But not quite invisibly.

Locking the screen just before the hilite reset in the above handler is no help; the OS does its job first anyway. I guess we are seeing the time lapse between that event and the LC reset. The hilite does not visually seem to quite finish, being a sort of barely visible phantom, but I bet that is just our eyes.

Craig

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”