Table field is crazy

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
undelouest
Posts: 9
Joined: Sun Oct 05, 2008 2:22 pm

Table field is crazy

Post by undelouest » Sun Oct 05, 2008 3:22 pm

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 ?

bonbon
Posts: 62
Joined: Thu Jul 17, 2008 11:48 pm

Post by bonbon » Sun Oct 05, 2008 5:15 pm

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

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Sun Oct 05, 2008 10:19 pm

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
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

bonbon
Posts: 62
Joined: Thu Jul 17, 2008 11:48 pm

Post by bonbon » Mon Oct 06, 2008 4:20 pm

Thanks Mark - that's going into my "handy hints" doc.

undelouest
Posts: 9
Joined: Sun Oct 05, 2008 2:22 pm

Post by undelouest » Mon Oct 06, 2008 6:44 pm

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

Post Reply