Act on clicking a disabled field
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 8
- Joined: Sat Jan 15, 2011 5:32 pm
Act on clicking a disabled field
This has been driving me mad for a couple of hours.
I have a gride made up of fields and I'd like to change the field background colour when it's clicked. The field is disabled but not locked.
I've tried a mouse up handler and I can't even get an alert to trigger when I click the field.
On mouseUp
//the clickField()
answer "test"
//set the backgroundColor of field "Warnings" to "red"
//if the clickField is field "w1t1" then answer "test"
End mouseUP
I have a gride made up of fields and I'd like to change the field background colour when it's clicked. The field is disabled but not locked.
I've tried a mouse up handler and I can't even get an alert to trigger when I click the field.
On mouseUp
//the clickField()
answer "test"
//set the backgroundColor of field "Warnings" to "red"
//if the clickField is field "w1t1" then answer "test"
End mouseUP
Re: Act on clicking a disabled field
A disabled field is exactly that, disabled so clicks won't register. There are a couple ways around this (probably more.)
First you can put an object behind the field, sized to match field size and put the mouseup handler there. Since the field is disabled, the click will pass through to the underlying object just fine.
You can put the mouseup at the card level, same deal but then you'd have to check mouse loc and figure out which field etc was clicked.
Next option, set the field to locked, manually change colors so that it appears disabled, but isn't really. On click, do whatever you wish to the background color of the field. Since it is locked, no insertion point will show, so it might as well be disabled.
First you can put an object behind the field, sized to match field size and put the mouseup handler there. Since the field is disabled, the click will pass through to the underlying object just fine.
You can put the mouseup at the card level, same deal but then you'd have to check mouse loc and figure out which field etc was clicked.
Next option, set the field to locked, manually change colors so that it appears disabled, but isn't really. On click, do whatever you wish to the background color of the field. Since it is locked, no insertion point will show, so it might as well be disabled.
-
- Posts: 8
- Joined: Sat Jan 15, 2011 5:32 pm
Re: Act on clicking a disabled field
Thanks Sturgis, I couldn't get it to work when it was enabled but I've just discovered I need to tick the list behaviour properties. Now that's working your reply is very helpful as it will tackle the next challenge. I like your last option the best for my needs, to lock the field. Thanks again 

-
- Posts: 8
- Joined: Sat Jan 15, 2011 5:32 pm
Re: Act on clicking a disabled field
Doh, looks like I can refresh my field contents now with automatic data due to them being locked. Is there way to unlock a field using code?
Then I could build it into my refresh function to unlock them all, refresh and lock them afterwards again.
Then I could build it into my refresh function to unlock them all, refresh and lock them afterwards again.
Re: Act on clicking a disabled field
You should be able to update the contents of a locked field using code.
put "my new text" into field "whateverfield" works whether the field is locked or not.
(or "set the text of field "whateverfield" to "whatever text")
If you need the user to be able to type into the field you can:
set the locktext of field "whateverfield" to false
If you have it set as a list field, you can't edit it directly (I don't believe)
If you have more info on what you're trying to accomplish, it will make it easier to find a good solution.
put "my new text" into field "whateverfield" works whether the field is locked or not.
(or "set the text of field "whateverfield" to "whatever text")
If you need the user to be able to type into the field you can:
set the locktext of field "whateverfield" to false
If you have it set as a list field, you can't edit it directly (I don't believe)
If you have more info on what you're trying to accomplish, it will make it easier to find a good solution.
-
- Posts: 8
- Joined: Sat Jan 15, 2011 5:32 pm
Re: Act on clicking a disabled field
Thanks again, know it should work helped me look elsewhere. I've commenting stuff out and putting breakpoints in, I found I'd accidentally renamed my first field so my code couldn't write data to it (then failed on all after that too).
All sorted
All sorted
