Table Field Cells
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Livecode Opensource Backer
- Posts: 10098
- Joined: Fri Feb 19, 2010 10:17 am
Table Field Cells
1. I would like to FILL a particular cell of a table field red:
pseudocode:
set the backColor of cell 2,3 of field "tf" to red
and should like to know how this can be done.
2. I should like to set the height and width of cells in a table field (a bit like the way one can do that in a spread sheet).
pseudocode:
set the backColor of cell 2,3 of field "tf" to red
and should like to know how this can be done.
2. I should like to set the height and width of cells in a table field (a bit like the way one can do that in a spread sheet).
-
- Livecode Opensource Backer
- Posts: 10098
- Joined: Fri Feb 19, 2010 10:17 am
Re: Table Field Cells
Really?
The dictionary is no further help.
-
-
- Livecode Opensource Backer
- Posts: 10098
- Joined: Fri Feb 19, 2010 10:17 am
Re: Table Field Cells
Erm . . . columns, cells?
-
Please do NOT respond with anything to do with "Data Grids".
Re: Table Field Cells
Glossary <> keyword
Glossary <> property
etc.
So don't blame the dictionary!
Means we can only set the backcolor of the whole field, its lines and their ITEMS (itemdel = TAB)
in the field and this will obviously only work if there is already text in that "cell".
Does the trick but only if there is already text in that item.
and it will only "cover" background of the text not the whole ITEM.
In the end, the "table field" is just a simple text field with a script library.
If you want more, just use a ...
Glossary <> property
etc.
So don't blame the dictionary!

Means we can only set the backcolor of the whole field, its lines and their ITEMS (itemdel = TAB)
in the field and this will obviously only work if there is already text in that "cell".
Code: Select all
...
set the itemdel to TAB
set the backgroundcolor of item 2 of line 4 of fld 1 to "red"
...
and it will only "cover" background of the text not the whole ITEM.
In the end, the "table field" is just a simple text field with a script library.
If you want more, just use a ...

Re: Table Field Cells
Richmond.
All that Klaus said.
A table field is just a field, a single lone field, that has certain properties set to make it look and feel like it does. You can make one from a standard field if you take the time to do so. Anyway, that means that, unlike a dataGrid, which is a group of separate fields, each named by virtue of its place in the "grid", you cannot do what you wanted to.
Craig
All that Klaus said.
A table field is just a field, a single lone field, that has certain properties set to make it look and feel like it does. You can make one from a standard field if you take the time to do so. Anyway, that means that, unlike a dataGrid, which is a group of separate fields, each named by virtue of its place in the "grid", you cannot do what you wanted to.
Craig
Re: Table Field Cells
Richmond.
You can kludge this if you really are interested. A table field generates messages, for example, "mouseUp". Know that one of the gadgets of a table field is the creation of a "phantom" field that you can exploit. Try this in a new table field on a new card. Fill the table field with some simple text. These will be tab and return delimited, as I am sure you know. Now in the field script"
This is data for the phantom field. You can use this to perhaps create your own new colored field that can size itself and overlie where the phantom field was. just manage all those new fields and you are done. The phantom field, when generated, will always be the last field, regardless of all your shenanigans.
Craig
You can kludge this if you really are interested. A table field generates messages, for example, "mouseUp". Know that one of the gadgets of a table field is the creation of a "phantom" field that you can exploit. Try this in a new table field on a new card. Fill the table field with some simple text. These will be tab and return delimited, as I am sure you know. Now in the field script"
Code: Select all
on mouseUp
answer the name of last field & return & the rect of the last field
end mouseUp

Craig
Last edited by dunbarx on Thu Dec 16, 2021 4:17 pm, edited 1 time in total.
Re: Table Field Cells
Richmond.
Played around just for a minute. In that table field script;
So we now know that the "last" field changes rather quickly, eh? From phantom to the one you created.
Craig
Played around just for a minute. In that table field script;
Code: Select all
on mouseUp
put the rect of the last field into tRect
create field
set the rect of last field to tRect
set the backColor of last field to "yellow"
set the blendLevel of last field to 50
end mouseUp
Craig