Data Grid or Table Field and suggestions

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

no1g8tor96
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 46
Joined: Fri Aug 02, 2013 12:14 am

Data Grid or Table Field and suggestions

Post by no1g8tor96 » Wed Aug 01, 2018 2:55 pm

I have a friend that needs me to build him a Baccarat Program that displays a gird with the hands dealt like at the casino table? I need to have red and blue circles placed under each other as in the picture? Do I use a Data Grid or Table Field. The results are being pulled from a text file so data handling is not the issue. I just have not done graphics like this and need to line them up based on the number of Banker or Player dealt.


Thank you in advance..
Attachments
1-14.jpg

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

Re: Data Grid or Table Field and suggestions

Post by dunbarx » Wed Aug 01, 2018 3:10 pm

Hi.

i would definitely use a table field, with its "opaque" set to "false" along with such gadgets as borders, scrollbars and gridLines. Set the itemDel to tab, and place a single character in each "cell", with the imageSource of that character set to a colored circle. The table field will keep orderly columns, and you can manage the "stack" of circles in each column simply by managing the field text.

Craig Newman

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

Re: Data Grid or Table Field and suggestions

Post by dunbarx » Wed Aug 01, 2018 3:14 pm

Hi again.

It just occurred to me that you should not set all those properties until you have built the table field itself. You do not want it disappearing on you before it is populated.

Craig

no1g8tor96
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 46
Joined: Fri Aug 02, 2013 12:14 am

Re: Data Grid or Table Field and suggestions

Post by no1g8tor96 » Wed Aug 01, 2018 3:58 pm

Craig

Thanks so much. Were on the same page as this is what I was thinking. To take the question a little further...

How to I tell it to place the Char or circle at Line 6 Tab 20? I have never used more than 3 "columns" in my programing so I was just using Tab in my code but did not need more than three?

In the past I would just use Put tab & tab & "char" into line X of Field TalbleField. How do I specify a specific location?

Thanks so much for the help. I an not new to this just not an expert either.

Klaus
Posts: 13820
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Data Grid or Table Field and suggestions

Post by Klaus » Wed Aug 01, 2018 4:16 pm

Hi user with an unspeakable name,

you can simply:

Code: Select all

...
set itemdel to TAB 
## short for itemdelimiter

put "11" into item 20 of line 6 of fld "your field here..."
...
Even if the field is empty, LC will add all neccessary empty lines and TABs.


Best

Klaus

no1g8tor96
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 46
Joined: Fri Aug 02, 2013 12:14 am

Re: Data Grid or Table Field and suggestions

Post by no1g8tor96 » Wed Aug 01, 2018 4:39 pm

lol.. Sorry Klaus that I did not sign my post. Im Mike.

Thank you both for the help. Livecode people are the best and I appreciate all of you.

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

Re: Data Grid or Table Field and suggestions

Post by dunbarx » Wed Aug 01, 2018 4:52 pm

What we both said.

A table field is specially constructed to be tab and return delimited. So you can think of it as an Excel-like spreadsheet. Setting the itemDel allows you to place data in specific "cells" under script control, something not available in Excel proper. There are not really any "cells", it is only that the field is formatted to act like there are. Otherwise, it is just a field with special properties, sort of like a pulldown is a button with special properties.

By hiding the field, and only showing its contents, you can simulate an array of those circles by simply managing the overall text of the field. So if you wanted to add a circle to the bottom of, say, column 2, you could:

Code: Select all

on mouseUp
   set the itemDel to tab
   
   put the text of fld "yourTableField" into temp
   put getColumn(temp,2) into nextLine
   put "X" into item 2 of line nextLine of fld "yourTableField"
end mouseUp

function getColumn temp,tColumn
      set the itemDel to tab

      repeat with y = 1 to the number of lines of temp
         if item tColumn of line y of temp = "" then return y
      end repeat
end getColumn
I just used a "2" here as an example.

Craig

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

Re: Data Grid or Table Field and suggestions

Post by bogs » Wed Aug 01, 2018 11:05 pm

Hi user with an unspeakable name,
Not really a contribution on my part since it looks like Klaus and Craig pretty much went how I would anyway, Mike, but just curious if I had your unpronounceable name right in my mind when I read no1g8tor96 as "no one gator nine-six" ?
Image

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

Re: Data Grid or Table Field and suggestions

Post by dunbarx » Thu Aug 02, 2018 3:09 am

Has to be:

#1gator96

Craig

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

Re: Data Grid or Table Field and suggestions

Post by bogs » Thu Aug 02, 2018 1:32 pm

I think your right Craig, yours is much better.
Image

Klaus
Posts: 13820
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Data Grid or Table Field and suggestions

Post by Klaus » Thu Aug 02, 2018 1:45 pm

bogs wrote:
Thu Aug 02, 2018 1:32 pm
I think your right Craig, yours is much better.
Craigs right is much better? :shock:

Sorry, I hate it when someone tries to assasinate his native language... :D

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

Re: Data Grid or Table Field and suggestions

Post by bogs » Thu Aug 02, 2018 2:49 pm

Klaus wrote:
Thu Aug 02, 2018 1:45 pm
Sorry, I hate it when someone tries to assasinate his native language... :D
Language is constantly evolving thing my friend, it thrives when assasinated :wink:

Otherwise, I'd have to ask you to pass me the 'bok', which we wouldn't be able to do any light reading in.
Image

Klaus
Posts: 13820
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Data Grid or Table Field and suggestions

Post by Klaus » Thu Aug 02, 2018 3:12 pm

bogs wrote:
Thu Aug 02, 2018 2:49 pm
Language is constantly evolving thing my friend, it thrives when assasinated :wink:
Yes, maybe, but in the moment: your <> you are/you're 8)
bogs wrote:
Thu Aug 02, 2018 2:49 pm
Otherwise, I'd have to ask you to pass me the 'bok', which we wouldn't be able to do any light reading in.
Sorry, don't get this?

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

Re: Data Grid or Table Field and suggestions

Post by bogs » Thu Aug 02, 2018 4:27 pm

'Bok' is the original parent word that 'book' came from, as well as 'bark' (tree bark), if you went far enough down the language evolutionary ladder.
Image

Klaus
Posts: 13820
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Data Grid or Table Field and suggestions

Post by Klaus » Thu Aug 02, 2018 4:49 pm

Well, "bok" was the part that I actually "got". :D

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”