Disabling choices in Scrolling List Field?

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
trenatos
Posts: 189
Joined: Wed Jul 03, 2013 6:46 am
Contact:

Disabling choices in Scrolling List Field?

Post by trenatos »

Is it possible to disable (Grey out) fields in a scrolling list field?

The idea is to use it as a sort of menu selection where you will have to complete an objective before you're allowed to advance, but it would be nice to be able to see where you are, and the titles of what's coming up in the list.

I know how to get the result of the currently clicked choice, but no idea how to disable or grey out specific choices.
Marcus
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10501
Joined: Wed May 06, 2009 2:28 pm

Re: Disabling choices in Scrolling List Field?

Post by dunbarx »

Hi.

set the foreColor of line 3 of fld 1 to "gray"

I suppose you can keep a list, or test the forecolor directly, and disallow any user action in those lines that have that property set.

Craig Newman
trenatos
Posts: 189
Joined: Wed Jul 03, 2013 6:46 am
Contact:

Re: Disabling choices in Scrolling List Field?

Post by trenatos »

If I can't actually disable it, just set color, I'll probably just keep a list with approved/not-approved that is checked before displaying the group.
Marcus
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10501
Joined: Wed May 06, 2009 2:28 pm

Re: Disabling choices in Scrolling List Field?

Post by dunbarx »

You can disable certain lines in a field. In LC, you can do just about anything.

You just have to trap the pertinent messages that are sent when the user clicks in the field, determine if the lines clicked on are grayed out or not, and divert or squash those messages. Do you need help with that?

Craig Newman
trenatos
Posts: 189
Joined: Wed Jul 03, 2013 6:46 am
Contact:

Re: Disabling choices in Scrolling List Field?

Post by trenatos »

No I'm good, I was trying to figure out if there was a way to actually disable the input (Greyed out, the user not able to click it at all)
Marcus
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10501
Joined: Wed May 06, 2009 2:28 pm

Re: Disabling choices in Scrolling List Field?

Post by dunbarx »

Glad you are moving forward.

But when you say that you want the user "not to be able to click at all,do you mean that the cursor would revert to the pointer if it was over a grayed-out line? This can be done.

Craig
trenatos
Posts: 189
Joined: Wed Jul 03, 2013 6:46 am
Contact:

Re: Disabling choices in Scrolling List Field?

Post by trenatos »

I understand how I can simply check the line and see if the option is "available" and so on, I was just trying to figure out if there was a simple command in the style of set disabled to true on option XYZ
Instead of having to do all the other work.
Marcus
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10501
Joined: Wed May 06, 2009 2:28 pm

Re: Disabling choices in Scrolling List Field?

Post by dunbarx »

I see.

There is no built-in style to do that with a list field.

And my post about the cursor made no sense, since a list field is by definition locked, and the pointer persists in any case.

Just to be silly, you could change the cursor to nothing if it hovers over a grayed-out line. That will make your disconcerted users scurry away from the forbidden lines in a hurry.

Craig
trenatos
Posts: 189
Joined: Wed Jul 03, 2013 6:46 am
Contact:

Re: Disabling choices in Scrolling List Field?

Post by trenatos »

What I think I'll do is look over a list of states on startup and set the colors accordingly, when the user clicks on a list-item it checks the list again to see they should have access or not, and simply not change the current group if they don't.
Marcus
Post Reply