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

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

Re: Lock a table field

Post by bn » Tue Oct 17, 2017 8:02 am

Hi Craig,

if you want to be drastic you could do

in LC 6.1.3

make a field, put

Code: Select all

button "revTable" of group "revLibraries" of card 1 of stack "revLibrary"
into the field

then make 2 buttons

Code: Select all

on mouseUp
   put field 2 into tName
   focus on nothing
   remove script of tName from front
end mouseUp
and

Code: Select all

on mouseUp
   put field 2 into tName
   insert script of tName into front
end mouseUp

In LC 6.7.11

make 2 buttons

Code: Select all

on mouseUp
   focus on nothing
   remove script of stack "revTableLibrary" from front
end mouseUp

Code: Select all

on mouseUp
   insert script of stack "revTableLibrary" into front
end mouseUp
Kind regards
Bernd

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9580
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:56 pm

Bernd.

"Drastic" is apt.

The ability to hack the IDE is one of the strengths of LC. Knowing how and where to do so teaches how that IDE is constructed. My favorite is from Thierry, where system globals can be filtered from view in the debugger. We all know about this, right?

Am I correct in assuming that issue was fixed in v8+?

Craig

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

Re: Lock a table field

Post by bogs » Tue Oct 17, 2017 2:48 pm

dunbarx wrote:
Tue Oct 17, 2017 1:56 pm
My favorite is from Thierry, where system globals can be filtered from view in the debugger. We all know about this, right?
I'm sorry Craig, I was late to class that day, link to the notes ? :|
Image

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

Re: Lock a table field

Post by dunbarx » Tue Oct 17, 2017 3:39 pm

Edit the script of stack "revDebugger". (or --"revDebuggerLibrary")

Search for the handler "function revDebuggerValidGlobalNames"

Replace it with:

Code: Select all

function revDebuggerValidGlobalNames
   local tGlobalsRaw
   put the globals into tGlobalsRaw
   
   replace comma with return in tGlobalsRaw
  
   filter tGlobalsRaw without "*(x86)"
    filter tGlobalsRaw without "$*"
     filter tGlobalsRaw without "grev*"
   replace return with comma in tGlobalsRaw
   
   return tGlobalsRaw
end revDebuggerValidGlobalNames
Craig

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

Re: Lock a table field

Post by jacque » Tue Oct 17, 2017 5:18 pm

dunbarx wrote:
Tue Oct 17, 2017 1:33 am

My table field is only used for display, and must not be accessible by the user.
Which is why I'm at a loss why you don't just create a field with gridlines for display. Table fields are intended to be editable. Why try to block its behavior when the only part you need is so easy to create? A plain datagrid would also do what you want, but for simple display even that seems like overkill.

BTW, the ability to filter out globals and other tweaks has been in the script editor for some time now.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

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

Re: Lock a table field

Post by bogs » Tue Oct 17, 2017 7:49 pm

Nice ! (Saving that one away for later) :mrgreen:
jacque wrote:
Tue Oct 17, 2017 5:18 pm
dunbarx wrote:
Tue Oct 17, 2017 1:33 am

My table field is only used for display, and must not be accessible by the user.
Which is why I'm at a loss why you don't just create a field with gridlines for display. Table fields are intended to be editable. Why try to block its behavior when the only part you need is so easy to create?
Yah, I'm curious myself, since I figure I must just be missing something. Is there something that the table provides you additionally that you need that would be too hard to create from a field? Cause otherwise, I also think the field is a lot easier to setup.
Image

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

Re: Lock a table field

Post by bn » Tue Oct 17, 2017 8:14 pm

In case anyone has looked at tinyDictionary (works from LC version 8.1 upwards)
The upper part displaying the search results is a simple field with some scripting on top. You can go a long way with a field to display tabular data without the hassles of the tableField. And no, it is not a DataGrid.

TableField at times gets left behind by the development of LC and has to be fixed.

http://quality.livecode.com/show_bug.cgi?id=15522
http://quality.livecode.com/show_bug.cgi?id=18984

Table Field is a odd object.

@Craig: the wonders of LC 8.x.x and up are only a download away...

Kind regards
Bernd

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

Re: Lock a table field

Post by jacque » Tue Oct 17, 2017 9:03 pm

@Craig: the wonders of LC 8.x.x and up are only a download away...
Don't push him. It took 10 years before he'd transition from HC to LC at all. :)

Craig, the longer you wait the harder it will be. New features are added all the time and you'll need to learn it all over again. Incremental adaptation is easier. You'll get used to the new visual appearance in a couple of weeks. I didn't like it either but I hardly notice it now.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

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

Re: Lock a table field

Post by bogs » Tue Oct 17, 2017 9:14 pm

jacque wrote:
Tue Oct 17, 2017 9:03 pm
@Craig: the wonders of LC 8.x.x and up are only a download away...
Don't push him. It took 10 years before he'd transition from HC to LC at all. :)
Only 10? :twisted:
And I agree with Jacque (to a point, as I am going backwards :shock: ), don't rush him, after all he couldn't possibly have gotten to 6.7.x before 3 years ago, give him some time to ease into it :twisted: :twisted:
Image

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

Re: Lock a table field

Post by dunbarx » Wed Oct 18, 2017 3:18 am

Well, because I have always just dragged out a table field and used it. A head start on the regular field; I never once took an ordinary field and set h and v gridlines. If I needed much more power, then a DG.

So when I did it this time, and wanted to deny user editing access, I went in and tried to do just that. With my personality, such as it is, I stubbornly tried to figure out how to make it work, eventually coming to the beginners pane. Again.

I am far more interested in why I cannot, never mind Bernd's IDE hack, figure out what coaxes a table field to create that phantom field. It was far more that effort than anything as mundane as doing it in another manner, however normal and straightforward.

When I simply stuck a graphic over the table field, the problem was solved, as far as that goes, and you know I like kludges. I still do not know how the table field works. and still want to. I will think about changing fields, even though I will not be able to understand the distinction between the properties of each. Maybe I will check "the properties" of each and see.

Now then. Ahem

OK, OK.

Jacque. I will start to migrate both myself and my current project to v8 tomorrow. Why? Because I am too often unable to help anyone anymore. Oh, and I do want to stay in your good graces. You once advised me to at least move to v7, if for nothing else than the newly expanded itemDel. After all, I once started a thread asking for much more of that property than just multi-char strings.

Bogs, you are not nearly as sweet as Jacque. But I do like your style.

Craig

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

Re: Lock a table field

Post by bogs » Wed Oct 18, 2017 3:32 am

I wonder a lot of the same things about the table field, I mean it looks like it is just the field templated with the grid lines set, but it obviously isn't that simple from the messages I was seeing.

Also, you and I seem a lot alike...
dunbarx wrote:
Wed Oct 18, 2017 3:18 am
With my personality, such as it is, I stubbornly tried to figure out how to make it work, eventually coming to the beginners pane. Again.
No one tilts at windmills like I often do (cough Mc cough). I wonder if we're related, although I wouldn't wish that on anyone :wink:
dunbarx wrote:
Wed Oct 18, 2017 3:18 am
Bogs, you are not nearly as sweet as Jacque. But I do like your style.
Danka for the smile, may have to shrink my signature in some places as it is getting quite full now :twisted:
Image

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

Re: Lock a table field

Post by jacque » Wed Oct 18, 2017 7:42 pm

dunbarx wrote:
Wed Oct 18, 2017 3:18 am
I will start to migrate both myself and my current project to v8 tomorrow. Why? Because I am too often unable to help anyone anymore. Oh, and I do want to stay in your good graces. You once advised me to at least move to v7, if for nothing else than the newly expanded itemDel.
We will hold your hand, don't worry. :) While I certainly agree that stark black icons are a bit offputting at first, the convenience of eliminating the popup menu in the inspector and elsewhere is a timesaver. And if you want to remain comfortable with the older interface, ignore the Project Browser for now and use the old App Browser instead. That has moved to the Plugins menu now, look for "revApplicationOverview". Once you get familiar with the newer interface you can tinker with the Project Browser and see how you like it. I heard from someone that it didn't work reliably until the latest v9 release though.

I'd suggest jumping right to 8.1.6. Visually and feature-wise it is similar to version 7 but a whole lot of bugs have been fixed and it is more stable. Version 7 was the first release after the big rewrite and had problems that have since been resolved.

There are so many new features you can explore, I think you'll be hooked after a short time.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

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

Re: Lock a table field

Post by jacque » Wed Oct 18, 2017 8:10 pm

BTW, to make a table out of a regular field (without the mysterious "table field" behavior) just do this:

Drag-place an editable field.
In the Table pane of the inspector, set hGrid and vGrid to true.
Set some tabstops.

That's it. Now you can fill the grid with tab-delimited text and set any normal field properties you want, including locktext, autohilite, etc. so it isn't editable.

Alternately (and easier): select your existing table field, go to the Table pane in the inspector, and turn off "Basic table field". It will become what I just described and is not editable.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

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

Re: Lock a table field

Post by bogs » Wed Oct 18, 2017 8:46 pm

jacque wrote:
Wed Oct 18, 2017 8:10 pm
Alternately (and easier): select your existing table field, go to the Table pane in the inspector, and turn off "Basic table field". It will become what I just described and is not editable.
That is far easier, and (for me) completely unexpected.
Image

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

Re: Lock a table field

Post by dunbarx » Wed Oct 18, 2017 9:35 pm

@Jacque. I have done that sort of thing before. But thanks for thinking about me. I made a regular field into a table field with H and V gridlines, and set lockText. At least I was able to delete a grc from the stack.

Again, I was just trying to ferret whatever sort of message that made that ghost field pop up.

So you don't know either, eh? I started a thread in the "Talking LC" pane. Will wait to see what turns up.

Craig

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”