Lock a table 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: Klaus, FourthWorld, heatherlaine, kevinmiller

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

Lock a table field

Post by dunbarx » Fri Oct 13, 2017 7:01 pm

Beginners again...

Anyone know how to to do this? A table field already has lockText set, and clearing "traversalOn" does nothing. Trapping every message that is passed with a mouseClick does nothing. The field stays editable.

I can always overlay a clear opaque graphic with blendLevel set to 100, but that is a kluge.

I love kluges, but isn't there a more grown-up way?

Craig Newman

bogs
Posts: 3561
Joined: Sat Feb 25, 2017 10:45 pm

Re: Lock a table field

Post by bogs » Fri Oct 13, 2017 7:59 pm

I am sure there is, but I personally bought the "kludge-o-matic" yesterday from a Ron Popiel commercial, and it is the BEST !

Oh, you wanted a real answer :oops:

Well, I'm not sure if this still works, but you could try setting the cantSelect on it.
Image

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

Re: Lock a table field

Post by dunbarx » Fri Oct 13, 2017 10:07 pm

Bogs.
but you could try setting the cantSelect on it.
Very logical supposition.

Nope. You cannot select the field, but you can still edit it. Odd...

Right now I have a transparent grc overlying it. (Doesn't) work just fine.

Craig

bogs
Posts: 3561
Joined: Sat Feb 25, 2017 10:45 pm

Re: Lock a table field

Post by bogs » Fri Oct 13, 2017 10:48 pm

I know I've come across fields in dialogs in the old Mc ide where you can't select....ANYTHING, hahah. I was going to suggest the cantModify setting, but then you would not be able to select anything in that stack where it is set.

Perhaps making it part of a group (possibly of one) would work, and then set the groups property?? Other than that, rock on Ron Popiels kludge-o-matic :)
Image

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5043
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Lock a table field

Post by jacque » Sat Oct 14, 2017 5:58 pm

I haven't looked at the table field in ages, but if it's still like the original it is creating a temporary field when you click in a cell that allows typing. When the data entry is done, the content of the temp field is placed in the cell and the overlay field is deleted.

That means no properties of the table field are relevant during text entry. The actual table field itself is just a field with tabstops and gridlines, which you could easily use instead.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

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

Re: Lock a table field

Post by dunbarx » Mon Oct 16, 2017 5:14 am

Jacque.

Yes, actually you and I worked on this years ago. I called the "extra" field a "ghost" field. Entirely different from a DG, where the various fields really do exist.

But there must be a message generated that creates that overlying control from the table field "target".l. I just cannot find it to trap it.

My workaround of overlaying a grc works just fine. I am just interested in how that thing gets its instructions to build itself.

Craig

bogs
Posts: 3561
Joined: Sat Feb 25, 2017 10:45 pm

Re: Lock a table field

Post by bogs » Mon Oct 16, 2017 6:37 am

dunbarx wrote:
Mon Oct 16, 2017 5:14 am
But there must be a message generated that creates that overlying control from the table field "target".l. I just cannot find it to trap it.
You don't mean this, do you? openField/exitField...
Image
Image

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

Re: Lock a table field

Post by dunbarx » Mon Oct 16, 2017 4:06 pm

Bogs.

Short answer is: "Nope"

My thinking was that I would place empty handlers in the field script that would trap whatever message generates the "ghost" field, as per the post with Jacque just above. I have tried everything, but that field pops up anyway, ready for text entry.

Either I am not understanding how a table field does that, or am missing the message. I would have thought that trapping all possible mouse actions, up, down, enter, whatever, would prevent the field from "knowing" that something was happening. Perhaps the generation of the field happens before user messages,

Nope.

Craig

bogs
Posts: 3561
Joined: Sat Feb 25, 2017 10:45 pm

Re: Lock a table field

Post by bogs » Mon Oct 16, 2017 7:13 pm

Curious if you tried 'pass mouseDown/mouseUp' instead of empty. Just leaving it blank still lets the message through, right?
Image

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

Re: Lock a table field

Post by dunbarx » Mon Oct 16, 2017 7:49 pm

Bogs.

Do you mean this?

Code: Select all

on mouseDown
   pass mouseDown
end mouseDown
One may as well leave the script empty, no?

Craig

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3279
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Lock a table field

Post by bn » Mon Oct 16, 2017 8:01 pm

Hi Craig,

you could try on a tableField which happens to be field 3 in my case

Code: Select all

   -- revIDESetTableProperty pObject, pProperty, pValue
   -- in revIDELibrary
   put the long ID of field 3 into tObject
   put "cellEdit" into tProperty
   put "false" into tValue
   revIDESetTableProperty tObject, tProperty, tValue
or

Code: Select all

   -- revIDESetTableProperty pObject, pProperty, pValue
   -- in revIDELibrary
   put the long ID of field 3 into tObject
   put "cellEdit" into tProperty
   put "true" into tValue
   revIDESetTableProperty tObject, tProperty, tValue
The handler is in revIDELibrary

Then you can fiddle with traversalOn etc

Kind regards
Bernd

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

Re: Lock a table field

Post by dunbarx » Mon Oct 16, 2017 8:17 pm

Bernd.

Thanks, but I do not see the handler "revIDESetTableProperty" if I:

Code: Select all

edit the script of stack "revIDELibrary"
Possibly because I am in v.6.7?

Anyway, it sounds like a good candidate. But more to my current interest, there must be action going on in a table field before user messages are sent, right? And it is these actions that create and locate the "ghost' field.

Craig

bogs
Posts: 3561
Joined: Sat Feb 25, 2017 10:45 pm

Re: Lock a table field

Post by bogs » Mon Oct 16, 2017 9:23 pm

Short answer: go with a manually created table from a field object.

Much longer answer -
Well, I *think* I have an answer for you, I just don't think it is an answer your going to like too much. I re-read the thread from the top, what I am getting is that you want a table with fields(cells) that aren't clickable. When I got to Jacque's post, this kinda jumped out at me, probably because I was poking around in Mc3 which doesn't have datagrids or even basic table fields pre-made -
jacque wrote:
Sat Oct 14, 2017 5:58 pm
The actual table field itself is just a field with tabstops and gridlines, which you could easily use instead.
Huh, why not says I ? and so I did. I took a regular field, and made it a table field manually. Below that, I placed a pre-made table field. I unchecked the focusable (transversal) on both. The top manually made table will not accept the mouse click, it does still pass through on the bottom pre-made table.
Image
Image

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

Re: Lock a table field

Post by dunbarx » Tue Oct 17, 2017 1:33 am

Bogs.

All nice kludges.

Mine was simpler, and more kludgy; I mentioned that I just placed an opaque grc rectangle, blended 100%, over the table field. This blocks everything, the old-fashioned way

The fact that the blocking grc is transparent is both useful and peculiar. There was a thread years ago about adding a property to controls that would allow mouse actions to penetrate them. So that if one had two buttons with the same rect, the lower one could receive messages if the upper one had its "permeable" set to "true". Never happened. though.

My table field is only used for display, and must not be accessible by the user.

Craig

bogs
Posts: 3561
Joined: Sat Feb 25, 2017 10:45 pm

Re: Lock a table field

Post by bogs » Tue Oct 17, 2017 4:53 am

dunbarx wrote:
Tue Oct 17, 2017 1:33 am
Bogs.
All nice kludges.

Mine was simpler, and more kludgy; I mentioned that I just placed an opaque grc rectangle, blended 100%, over the table field. This blocks everything, the old-fashioned way
...
My table field is only used for display, and must not be accessible by the user.

Craig
I *did* say I love the kludge-o-matic right? :D

On my last one, I don't think that it is actually a kludge per se, and it fills your requirements, for 2 reasons.
  • Not a kludge since it is a table, and as Jacque pointed out, tables are made from fields to begin with. I changed only the parts of the field required to make it adding grid lines and tab stops.
  • It isn't accessible from the users perspective, without the addition of other objects.
As much time as I've been spending in the Mc IDE lately, I've really developed an appreciation of the work that has gone into things following it, the only way to make a table in it is using a field, and generally speaking I think it is simpler to start with even in the Lc IDEs.

Something changed in the basic table field object that makes it not just a field turned into a table, when running the message watcher I see all kinds of events not turning up in the manually created one.
Image

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”