Page 1 of 1

Table field is crazy

Posted: Sun Oct 05, 2008 3:22 pm
by undelouest
Hi !
Table field works the wrong side :

On a card I put 1 table field and 1 button
the script of the button :

on mouseUp
if the label of me is "Change price" then
set the locktext of fld "price" to false
answer "Write new data and click on Register"
set the label of me to "Register"
else
set the label of me to "Change price"
set the locktext of fld "price" to true
end if
end mouseUp

This script do not works well

on mouseUp
if the label of me is "Change price" then
set the locktext of fld "price" to true
answer "Write new data and click on Register"
set the label of me to "Register"
else
set the label of me to "Change price"
set the locktext of fld "price" to false
end if
end mouseUp

this script works but only if I don't click on the field
If I click on the field or change data I must repeat twice the job
Normal ?

Posted: Sun Oct 05, 2008 5:15 pm
by bonbon
I'm a newcomer, so apologies if this isn't what you wanted ...

I think the problem is that "locktext" works with an ordinay scrolling field, but not with a table field.

If you check the table's "disabled" property (in Basic properties), and change "locktext" to "disabled" in your first piece of code, it should work.

Pete

Posted: Sun Oct 05, 2008 10:19 pm
by Mark
Hi undelouest and bonbon,

You might want to use this:

Code: Select all

set the cRevTable["cellEdit"] of fld 1 to false

set the cRevTable["cellEdit"] of fld 1 to true
You should never set the lockText of a table field to false. This can cause unexpected results.

Best,

Mark

Posted: Mon Oct 06, 2008 4:20 pm
by bonbon
Thanks Mark - that's going into my "handy hints" doc.

Posted: Mon Oct 06, 2008 6:44 pm
by undelouest
Thanks for your speed answer

I tried the script : it works --- but exactly like the first one :
-to unlock the cells I must write set the cRevTable["cellEdit"] of fld 1 to true
-To lock the cells I must click twice the button
ja