Table field and listStyle

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

stam
Posts: 3072
Joined: Sun Jun 04, 2006 9:39 pm

Re: Table field and listStyle

Post by stam » Sun Nov 29, 2020 5:55 am

And more weirdness:

Every time i click into the field, it adds a line of code within the first <li>, below the text of the first list item. This is what happens when i click on 3 times in any line in the text -- it adds empty lines only below the first list item:

Code: Select all

<li>
<p>xxx</p>
<p>&#9;&#9; </p>
<p>&#9;&#9; </p>
<p>&#9;&#9;</p>	
</li>
And i don't know what html entity &#9; is meant to represent - i can't find reference to this online...

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10048
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Table field and listStyle

Post by FourthWorld » Sun Nov 29, 2020 7:07 am

&#9; is the character entity for tab.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

stam
Posts: 3072
Joined: Sun Jun 04, 2006 9:39 pm

Re: Table field and listStyle

Post by stam » Sun Nov 29, 2020 7:20 am

FourthWorld wrote:
Sun Nov 29, 2020 7:07 am
&#9; is the character entity for tab.
Thanks Richard - hardly ever use it as in normal html it collapses into a single space unless enclosed in a <pre></pre> block, so I blanked that completely; thanks for reminding me. I always use this as ascii 9 in code, should have realised...

The question still remains however why it keeps adding blank lines (well, with 2 tabs) under the first list item no matter where I click in the field... just weird...

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10048
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Table field and listStyle

Post by FourthWorld » Sun Nov 29, 2020 3:54 pm

Hard to say exactly what's happening with the blank lines without knowing exactly what's being typed there, but if it happens after typing a return maybe it's because the list tags already have returns inserted between since of the tags.

In short, I believe that once we fix the htmltext part of this the blank lines will go away with it.

I never use the table object myself, as there's another problem there with the metrics on Linux, where the editing field overlaps the right and bottom edges. I've been tempted to fix that, but I do rarely need spreadsheet behavior in my apps I just haven't had the time; last time I needed an editable grid it was for a small number of rows and columns and just easier to use fields.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

stam
Posts: 3072
Joined: Sun Jun 04, 2006 9:39 pm

Re: Table field and listStyle

Post by stam » Sun Nov 29, 2020 7:35 pm

No typing... happens when i just click in the field.

In the example above - populate the field with xxx/yyy/zzz and use listStyle to adorn the fields.
When I then click in this, not only does it covert to html, but every time i click in the field, it adds blank rows under the first item -- every click.

Hurts my brain to figure this out so i've jut quit and i'll wait until the html fix is in - for now have reverted to simple fields

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10048
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Table field and listStyle

Post by FourthWorld » Sun Nov 29, 2020 7:47 pm

Simple fields are usually all that's needed for working with list-style paragraphs, so you should be fine.

Does Excel offer list-style paragraphs?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

stam
Posts: 3072
Joined: Sun Jun 04, 2006 9:39 pm

Re: Table field and listStyle

Post by stam » Sun Nov 29, 2020 7:49 pm

FourthWorld wrote:
Sun Nov 29, 2020 7:47 pm
Simple fields are usually all that's needed for working with list-style paragraphs, so you should be fine.

Does Excel offer list-style paragraphs?
Sure - it will work. I've already implemented similar in other environments in older versions of this complex app.

In those versions i processed the text to add enumeration to each line which i know i can do in LC as well, was just hoping i wouldn't have to... (lazy, i know...)

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7391
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Table field and listStyle

Post by jacque » Sun Nov 29, 2020 10:08 pm

I was able to get rid of the htmltext by adjusting the isHTML() function with a blunt-edged hack. The real fix would be to change the paragraphTagRegex() function to return "true" for list fields but my regex isn't good enough to figure that out. At any rate, if you can get isHTML() to return true for list fields, the display is fixed.

But it goes much deeper than that. When you click a line in the (now fixed) text the temp field that is created always has a line number of 1. That's because there are no fixed line numbers and the <ol> tag will use 1 as the first list item. The table field scripts are more complex than I have time to track and fix.

However, if someone can provide regex to allow for lists, and you change your script to use specific numbers instead of auto-generated ones, then I think it will work. Here is the regex that needs to be updated to include list tags:

Code: Select all

private function paragraphTagRegex
  return "<p( [a-zA-Z0-9]+=" & quote & "[a-zA-Z0-9]+" & quote & ")*>"
end paragraphTagRegex
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply