Page 1 of 3

Lock a table field

Posted: Fri Oct 13, 2017 7:01 pm
by dunbarx
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

Re: Lock a table field

Posted: Fri Oct 13, 2017 7:59 pm
by bogs
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.

Re: Lock a table field

Posted: Fri Oct 13, 2017 10:07 pm
by dunbarx
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

Re: Lock a table field

Posted: Fri Oct 13, 2017 10:48 pm
by bogs
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 :)

Re: Lock a table field

Posted: Sat Oct 14, 2017 5:58 pm
by jacque
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.

Re: Lock a table field

Posted: Mon Oct 16, 2017 5:14 am
by dunbarx
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

Re: Lock a table field

Posted: Mon Oct 16, 2017 6:37 am
by bogs
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

Re: Lock a table field

Posted: Mon Oct 16, 2017 4:06 pm
by dunbarx
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

Re: Lock a table field

Posted: Mon Oct 16, 2017 7:13 pm
by bogs
Curious if you tried 'pass mouseDown/mouseUp' instead of empty. Just leaving it blank still lets the message through, right?

Re: Lock a table field

Posted: Mon Oct 16, 2017 7:49 pm
by dunbarx
Bogs.

Do you mean this?

Code: Select all

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

Craig

Re: Lock a table field

Posted: Mon Oct 16, 2017 8:01 pm
by bn
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

Re: Lock a table field

Posted: Mon Oct 16, 2017 8:17 pm
by dunbarx
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

Re: Lock a table field

Posted: Mon Oct 16, 2017 9:23 pm
by bogs
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

Re: Lock a table field

Posted: Tue Oct 17, 2017 1:33 am
by dunbarx
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

Re: Lock a table field

Posted: Tue Oct 17, 2017 4:53 am
by bogs
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.