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
-
ajperks
- Posts: 105
- Joined: Sat Sep 06, 2014 3:38 pm
Post
by ajperks » Wed Oct 24, 2018 10:45 am
I am trying to take a specific paragraph from a field filled with paragraphs delimited with DelimiterCode. The correct paragraph number is selected and the paragraph transfers if using normal text.
I must be doing something wrong when I introduce the HTMLTEXT with the '
the item PostItem of''
Can anyone put me straight on this problem?
Code: Select all
Global DelimiterCode,
on mouseUp
Local PostItem
set the itemDelimiter to DelimiterCode
Put the number of items of char 1 to word 2 of the clickchunk of me into PostItem --Gets the position of clicked paragraph
Answer PostItem --This shows the correct paragraph was clicked by returning the number of its position in text
--The following line will not put anything into Fld "CopyOfPost" If I remove 'the item PostItem of' then whole field is copied.
set the htmltext of Fld "CopyOfPost" of card id 1169 to the item PostItem of the htmltext of fld "PostList"
--Remove line if empty
if line 1 of Fld "CopyOfPost" of card id 1169 is empty then delete line 1 of Fld "CopyOfPost" of card id 1169
--set the htmltext of fld "CopyOfPost" of card id 1169 to the text of fld "CopyOfPost" of card id 1169
go to card id 1169
end mouseUp
-
[-hh]
- VIP Livecode Opensource Backer

- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
Post
by [-hh] » Wed Oct 24, 2018 11:03 am
What is the error reported by LiveCode?
And what is the delimiterCode? Is it also delimiting the htmltext?
[And delete the comma at the end of the first line of your script and the "the" before "item PostItem".]
shiftLock happens
-
ajperks
- Posts: 105
- Joined: Sat Sep 06, 2014 3:38 pm
Post
by ajperks » Wed Oct 24, 2018 11:58 am
There is no error message. The text simply does not appear in the Fld "CopyOfPost as I commented, above the offending line.
The delimiter code has no bearing on the problem, because as I explained, it transfers the whole field if the item … is left out of the line. I just want the clicked paragraph.
-
dunbarx
- VIP Livecode Opensource Backer

- Posts: 10323
- Joined: Wed May 06, 2009 2:28 pm
Post
by dunbarx » Wed Oct 24, 2018 1:53 pm
Does "postItem" contain an integer when the handler runs? You will have to set a breakpoint at that line to see.
Craig Newman
-
[-hh]
- VIP Livecode Opensource Backer

- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
Post
by [-hh] » Wed Oct 24, 2018 1:58 pm
Instead of
the item PostItem of the htmltext of fld "PostList"
try (don't use "the item"!!):
item postItem of (the htmltext of fld "PostList")
If this doesn't work then try
item 1 of (the htmltext of fld "PostList")
If this works then the delimiter is the problem.
shiftLock happens
-
ajperks
- Posts: 105
- Joined: Sat Sep 06, 2014 3:38 pm
Post
by ajperks » Wed Oct 24, 2018 2:14 pm
Hi Craig,
Yes, the PostItem is the correct integer for the clicked item. I used Answer PostItem to see it.
I have tried the () but this didn't change the empty result.
the item 1 of (the htmltext of fld "PostList" ) just copied the whole of the source fld of many paragraphs. This was an unwanted and unexpected result.
I double checked the Answer PostItem result and for the 4th paragraph of 5 it showed 4. This was the correct number of the clicked paragraph.
Something is very odd here.
-
ajperks
- Posts: 105
- Joined: Sat Sep 06, 2014 3:38 pm
Post
by ajperks » Wed Oct 24, 2018 2:26 pm
I have changed the delimiter to TAB with set itemdelimiter to TAB
I edited the text in the field to remove each of the old delimiters from the degree circle to Tab
The clicked paragraph in Answer is the correct number 4 or whatever.
If I click the first paragraph the whole source text field is being transferred.
If I click 2 or 3 or 4 or 5th paragraph, nothing is transferred to the target.
-
[-hh]
- VIP Livecode Opensource Backer

- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
Post
by [-hh] » Wed Oct 24, 2018 3:05 pm
As I said, the delimiter is the problem.
Neither tab nor degree will be translated one-to-one to the htmltext:
Tab is translated to space and degree to "°".
If the delimiter is degree then insert the following (let the rest as it is)
set itemdelimiter to "°"
before your line
set the htmltext of Fld "CopyOfPost" of card id 1169 to item PostItem ...
shiftLock happens
-
jacque
- VIP Livecode Opensource Backer

- Posts: 7393
- Joined: Sat Apr 08, 2006 8:31 pm
-
Contact:
Post
by jacque » Wed Oct 24, 2018 4:35 pm
Actually, LC translates a tab to "	" but the idea is the same. The delimiters displayed as htmltext will not be the same as the readable text, they will be coded as a browser expects. For tabs, set the itemdelimiter to "	" and you should get the right results.
Also, there will be no blank lines in htmltext, an empty line will be represented by two paragraph tags:
<p>
<p>
The easiest way to see what's coming back is to put the htmltext of the field or a chunk of it into another field and see how it looks:
set the text of field "copy" to the htmltext of field "original"
HTML was developed for browsers and isn't the same as the text you see on the screen. It can represent virtually any language and layout scheme. Looking at the raw htmltext will help you see what's going on.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
-
ajperks
- Posts: 105
- Joined: Sat Sep 06, 2014 3:38 pm
Post
by ajperks » Wed Oct 24, 2018 8:23 pm
I would like to thank you all for your help on this issue. I tried various techniques which could be called workarounds and although they worked perfectly, the concept of paragraphs being clickable is flawed. Basically, if the user clicks white space in the paragraph, it returns zero for the clicked paragraph and that renders the whole idea of a user friendly interface in my app as poor.
I think I will revisit the original idea I had of a fixed number of individual fields in a group so they are scrollable. This will keep some aspects of the interface reliable. I doubt most users on social media scroll down through many posts at a time, so perhaps infinite scroll is less important/wonderful than it seems.
-
FourthWorld
- VIP Livecode Opensource Backer

- Posts: 10051
- Joined: Sat Apr 08, 2006 7:05 am
-
Contact:
Post
by FourthWorld » Wed Oct 24, 2018 8:39 pm
ajperks wrote: ↑Wed Oct 24, 2018 8:23 pm
I would like to thank you all for your help on this issue. I tried various techniques which could be called workarounds and although they worked perfectly, the concept of paragraphs being clickable is flawed. Basically, if the user clicks white space in the paragraph, it returns zero for the clicked paragraph and that renders the whole idea of a user friendly interface in my app as poor.
It could be accomplished by calculating the paragraph from the clickLoc, but seems you have a more flexible solution in mind:
I think I will revisit the original idea I had of a fixed number of individual fields in a group so they are scrollable. This will keep some aspects of the interface reliable.
The DataGrid is exactly that. You can also roll your own, but in many cases using the well-crafted DG will save a lot of time.
-
jiml
- Posts: 339
- Joined: Sat Dec 09, 2006 1:27 am
Post
by jiml » Thu Oct 25, 2018 11:15 pm
Is this what you want to do?
Code: Select all
on mouseUp
if the text of the clickline <> empty then
put the htmltext of the clickline into fld "copyOfPost" of card id 1169
go to card id 1169
end if
end mouseUp
Jim Lambert
-
ajperks
- Posts: 105
- Joined: Sat Sep 06, 2014 3:38 pm
Post
by ajperks » Fri Oct 26, 2018 12:14 pm
Thank you for the code advice.
However, I have gone back to the simple indirectly addressed column of 100 individual fields. It looks better and works perfectly.
Last night I got the bare-bones social media style app and the server element working perfectly. I expected the data and server structure to be the difficult part, but even without compiling or optimisation, it is instantaneous. It is worth further development, including small (mobile screen size) image data. I have no idea if this is what is done in the real world, but I can see a need for the main server software and several specialised ones running separately to speed up the data processing system, rather than putting it all in the one server program.
Any thoughts?
-
FourthWorld
- VIP Livecode Opensource Backer

- Posts: 10051
- Joined: Sat Apr 08, 2006 7:05 am
-
Contact:
Post
by FourthWorld » Fri Oct 26, 2018 6:09 pm
ajperks wrote: ↑Fri Oct 26, 2018 12:14 pm
...I can see a need for the main server software and several specialised ones running separately to speed up the data processing system, rather than putting it all in the one server program.
Any thoughts?
There are many ways to scale servers.
What is your current setup, and where is your most significant bottleneck?
-
ajperks
- Posts: 105
- Joined: Sat Sep 06, 2014 3:38 pm
Post
by ajperks » Mon Oct 29, 2018 9:36 am
There isn't a bottleneck yet. Still developing. Not written the part where masses of posts and comments are being sent and received. With that comes ways to see where the delays might be. Those routines might be more time consuming to write than the bare bones app itself.
Thanks for your interest.