Table Fun
HyperChris at aol.com
HyperChris at aol.com
Tue Jul 1 11:11:01 EDT 2003
I decided to finally cut the chord with HC and get with Revolution. I started
to bang out my little project and saw this nifty little Table option in the
Inspector. Oh boy...I have always wanted this! I played with it for 20 minutes,
went through the documentation for 30 minutes, dowloaded the 45MB revlist
archive and then played with it for 3 hours. Such is the life of a wannabe
programmer. Anyways, I was right there with Graham and Jane as they discussed these
tables in the list and in response I came up with a stack that explores this
critter.
If you want the stack it is at ...
http://www.christophercomputers.com/rev.html
Here are the notes which may suffice ...
The 'cREVTable' custom property set.
I first set out to use the cREVTable values as a means of keeping people from
going off the edge of the table and causing it to scroll right or down.
To discover that set and the values associated with it. I downloaded
MetaCard's demo opened up this same stack and double-clicked on the field with the
pointer tool. That gave me the Field Properties and then I clicked the Extras tab
and clicked the Custom Properties button. In that window I could select the
cREVTable set and then see all these things I have listed here.
Now some of these are very useful (currentXcell and currentYcell) and some of
these are superfluous (bottomFieldLoc and topFieldLoc) as they match the
object parameters and others simply don't work. For instance, you would think that
currentCell would be the x,y cell location but instead it always says '3,2'
Note that tCell also says this. Go figure! Some the others are strange, too,
such as the mouseLoc and cellEdit.
They have a serious scrolling problem.
Notice how I made this table 3.5 colums wide? That is so you can click on the
3rd column without causing it to scroll over. You will see this behaviour if
you click on the fourth column. So for my application, I will draw it
oversized like this but I will throw some sort of graphic on top of the fourth column
to keep out unwanted clicks. Same problem at the bottom by the way. Very
annoying but you can get around it.
The target function is tweaked when the table is the target.
You do NOT get back 'field"table1" ' or something like that. Instead you get
'revCell-3,6' no matter which table you picked and no matter what the name of
the table was. So if you need to differentiate between two tables then you
will probably have to do something with clickLoc and calc it out. The
silver-lining here is that after the revCell part are the x,y cell coordinates and you
do at least know that it was a table !
Tables don't get messages.
That's right I said it ... string me up. You click on a table or do anything
like that and you can forget a nice field script to trap and check the data.
You will need to put in the card script which brings me to the next "challenge"
RawKeyData baby!
The only means I have so far to control this puppy is to parse keystrokes. In
the card script you can see that I hard coded my table size (xLimit and
yLimit) and then trapped for arrows and tabs and other such things to deal with the
scroll. This would also be the place to prevent unwanted keystrokes. For
example, I trapped for the [enter] key which allows one to put multiple lines into
a cell. This is NOT the place to validate data only to trap keys.
Data Validation
This is tricky so pay attention. If you trap keys then you are ahead of the
data being "entered". If you look at the card script you will see that the
'showCustomSetValues' are being called '20 milliseconds' after the keystroke has
been passed. This is the point at which you would check cellValue and make any
changes. So what if you want to change the data now. Well ... I'm not sure I
see any betterway than to grab the field data and make the change like you
normally would. Bummer huh.
Other things
I played with getting to the end of my matrix and using the 'click' command
to wrap around and go to the first cell of the next row. However, I crashed
Rev several times with that and gve up.
Don't even think of trying to align the text within the cells. It will kill
your table and that actually is in the documentation.
The cell formatting featue does appear to work although the inspector
settings are a tad obtuse at first.
Every time I go to the Table pane in the inspector it turns my scroll bars
back on. argh.
I have not tried this as a runtime application yet. Geez. I hope it works.
Dear Rev Team
You guys are great. Great program. Great company. This will be a great
feature with just a tad more work and some documentation!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.runrev.com/pipermail/use-livecode/attachments/20030701/29724e13/attachment.htm>
More information about the use-livecode
mailing list