hiding 1st column of 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

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 931
Joined: Thu Nov 13, 2008 6:48 am
Location: London, UK

hiding 1st column of table field

Post by marksmithhfx » Sun Nov 20, 2022 5:09 pm

Hi, I am trying to hide the 1st column of a table field (I do have a workaround if this does not work).

I set the tab stops of the field to 0, 300, 525, 750, etc

However instead of hiding the first column I see a column of maybe 2-3 pixels wide at the left edge of the table. I checked the firstindent (it's 0) and LC says the table does not have a leftindent property. Anything else to try before I go to my plan B?

Thanks
Mark
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9857
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: hiding 1st column of table field

Post by FourthWorld » Sun Nov 20, 2022 6:16 pm

The indents affect paragraphs. For object margins try the leftMargin.

Let me know if that doesn't do it. I've done zero-width columns before, so I know there's a recipe somewhere. Hopefully my memory of that is all you'll need.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

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

Re: hiding 1st column of table field

Post by dunbarx » Sun Nov 20, 2022 6:17 pm

Hmmm.

I tried a bunch of things. The logical solution would be just as you described, setting the first tab to 0. Even tried "0,0..."

Setting to -1 was the worst of my experiments.

Is your plan B to overlay something over column 1?

Craig

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

Re: hiding 1st column of table field

Post by dunbarx » Sun Nov 20, 2022 6:31 pm

I believe, though others may actually know, that the table field itself has a lower limit to its tabStops.

@Richard. I tried setting the leftmargin to 0 but that only moved the text all the way to the left. It did not hide the first tab.

Craig

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

Re: hiding 1st column of table field

Post by dunbarx » Sun Nov 20, 2022 6:33 pm

AHA.

But if you set the tabStops to, say "0,50" (or ",50") AND the leftMargin is set to 0, the first tab is hidden.

Craig

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

Re: hiding 1st column of table field

Post by dunbarx » Sun Nov 20, 2022 6:36 pm

It turns out this is a technique, if such a one is ever needed. You can hide any number of the leading tabs. To hide, say, the first three tabs, set them to "0,0,0,50".

And we know that one can hide interior tabs in the usual way, for example "0,50,50,100" would hide tabs 1 and 3

Craig

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9857
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: hiding 1st column of table field

Post by FourthWorld » Sun Nov 20, 2022 9:51 pm

dunbarx wrote:
Sun Nov 20, 2022 6:33 pm
AHA.

But if you set the tabStops to, say "0,50" (or ",50") AND the leftMargin is set to 0, the first tab is hidden.
Thank you for clarifying. Yes, I'd intended to suggest leftMargin as a replacement for leftIndent, but not also as a replacement for tabstops. That zero-width column specifier in tabstops is the magic, the rest is just alignment.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 931
Joined: Thu Nov 13, 2008 6:48 am
Location: London, UK

Re: hiding 1st column of table field

Post by marksmithhfx » Mon Nov 21, 2022 1:34 pm

Thank you all. That was the formula (tabstop = 0 with leftMargin = <something small>). leftMargin = 0 did hide the first column (when tabstop was set to 0) but also cut off a few pixels of the first letter in the next column. I found a setting of leftMargin = 2 worked best (hiding the tab stop line, but allowing a pixel or two of breathing space for the first letter in the next column). Thanks so much for pointing me in the right direction. (it saved a lot of coding effort to implement plan B, which was not as simple as hiding a column).

Cheers,

PS for the curious, the first column showed row numbers (array indices) as a result of "combine array by return and tab". The row numbers were of little use to the end user but since the purpose of the app is re-ordering rows in an array, the row numbers were used in a "Reset" function if you wanted to throw away any changes (NOTED: there are other ways of doing this... exiting without saving is one option, for example). However with the row numbers sitting there it was easy to implement. The workaround was to combine array by return which loses the array indices / row numbers and then simply add a sequential row number column with values 1..N somewhere else less visible (column 8 for example). Hiding the first column meant no other adjustments to the code while the workaround had lots of steps. The upside of Plan B is it would have engaged me in trying to discover which of LC's many statements would fill a column with values 1..N the fastest. An exercise now left for a future date.
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9857
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: hiding 1st column of table field

Post by FourthWorld » Mon Nov 21, 2022 5:22 pm

Well done, Mark. Thank you for the confirmation, and the use case background. That sort of thing is very helpful to newcomers.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 931
Joined: Thu Nov 13, 2008 6:48 am
Location: London, UK

Re: hiding 1st column of table field

Post by marksmithhfx » Tue Nov 22, 2022 8:29 pm

FourthWorld wrote:
Mon Nov 21, 2022 5:22 pm
Well done, Mark. Thank you for the confirmation, and the use case background. That sort of thing is very helpful to newcomers.
Thanks Richard, however...

I ended up going with Plan B and here's why (a tale told in 3 stacks)

Mark
Attachments
Test Hide Column 1.livecode.zip
(1.45 KiB) Downloaded 64 times
Test Hide Column 2.livecode.zip
(1.42 KiB) Downloaded 68 times
Hide Column 1 Plan B.livecode.zip
(1.96 KiB) Downloaded 69 times
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

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

Re: hiding 1st column of table field

Post by dunbarx » Tue Nov 22, 2022 9:40 pm

Mark.

That is some kludge. I hate it, though I admire it.

So have we decided that no shenanigans we know of will hide column 1 yet still yield control of the text attributes of that field? I hoped that setting the textAlign property would help, but not nope.

Craig

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

Re: hiding 1st column of table field

Post by bn » Tue Nov 22, 2022 10:00 pm

Mark,

The only way I can think of is to

Code: Select all

set the padding of line 1 to -1 of field "myTable" to 3
You could play with the numbers.
But that also pads above and below the lines.

Kind regards
Bernd

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

Re: hiding 1st column of table field

Post by dunbarx » Tue Nov 22, 2022 10:56 pm

Bernd.

That does indeed help a little. The issue with padding is it works on all four "sides" at once, so that any value above 2 or so starts to make the cells themselves grow out of proportion.

You would think that with all the many properties available, some combination would allow the first column to be hidden and the look of the remaining parts seem normal. There may yet be some bunch of settings that will allow the OP not to have to cheat the way he does. :wink:

Craig

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

Re: hiding 1st column of table field

Post by bn » Tue Nov 22, 2022 11:02 pm

tabAlign can also be an option.

Code: Select all

set the tabAlign of field 1 to "left,center,right"
Kind regards
Bernd

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

Re: hiding 1st column of table field

Post by dunbarx » Tue Nov 22, 2022 11:33 pm

Bernd.

Getting there.

Mark.

Can you live with centered text? With this handful of settings, you would not have to pluck out the data in column 1. I personally would prefer anything rather than having to manage that.

Craig

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”