link text chunk
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 73
- Joined: Sat Apr 08, 2006 6:51 pm
link text chunk
How do I refer to a group of words that constitute link text in a field? In a field that has link text as well words in other styles how would I say something like if the third chunk of link text in fld myField contains "website" then
In nova fert animus mutatas dicere formas corpora.
Re: link text chunk
Dear Preston,
What exactly does "chunk" mean in your "the third chunk"?
Mark
What exactly does "chunk" mean in your "the third chunk"?
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
-
- Posts: 73
- Joined: Sat Apr 08, 2006 6:51 pm
Re: link text chunk
Good question! As I understand it, words are chunks but what do you call a group of words that has been made into a single object by "link"? For example, how would you put the number of group text items into msg? Can you get the number of links in a field?Mark wrote:Dear Preston,
What exactly does "chunk" mean in your "the third chunk"?
Mark
In nova fert animus mutatas dicere formas corpora.
Re: link text chunk
Preston,
In xtalk, a chunk is a reference to a text in a field by means of the form:
char|word|line x to y of fld "Z"
for example:
char 1 to 2 of fld "Bla"
word 1 to -1 of fld "Bla"
line x to (x+1) of fld "Bla"
If you want to retrieve the text itself, you might want to use functions such as the clickText, the clickChunk, the mouseText, the selectedLine etc. Just look around in the documentation. There are very many of this type of functions.
Best regards,
Mark
In xtalk, a chunk is a reference to a text in a field by means of the form:
char|word|line x to y of fld "Z"
for example:
char 1 to 2 of fld "Bla"
word 1 to -1 of fld "Bla"
line x to (x+1) of fld "Bla"
If you want to retrieve the text itself, you might want to use functions such as the clickText, the clickChunk, the mouseText, the selectedLine etc. Just look around in the documentation. There are very many of this type of functions.
Best regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
-
- Posts: 73
- Joined: Sat Apr 08, 2006 6:51 pm
Re: link text chunk
I can refer to individual words with "word 5 of fld myField" how do I refer to the fifth piece of link text, i.e. the entire phrase, not the individual words in it?Mark wrote:Preston,
In xtalk, a chunk is a reference to a text in a field by means of the form:
char|word|line x to y of fld "Z"
for example:
char 1 to 2 of fld "Bla"
word 1 to -1 of fld "Bla"
line x to (x+1) of fld "Bla"
If you want to retrieve the text itself, you might want to use functions such as the clickText, the clickChunk, the mouseText, the selectedLine etc. Just look around in the documentation. There are very many of this type of functions.
Best regards,
Mark
In nova fert animus mutatas dicere formas corpora.
Re: link text chunk
Preston,
Of course, you can refer to single characters and words the usual way. What is "piece"?
It is still not entirely clear to me what you want to do. Just detecting linked text might be a little complicated. A possibility might be to check the style of every word in a field to see whether that style is "link", but I don't think that's what you want.
Have you read everything about "link" and related subjects in the dictionary already?
Kind regards,
Mark
Of course, you can refer to single characters and words the usual way. What is "piece"?
It is still not entirely clear to me what you want to do. Just detecting linked text might be a little complicated. A possibility might be to check the style of every word in a field to see whether that style is "link", but I don't think that's what you want.
Have you read everything about "link" and related subjects in the dictionary already?
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
-
- Posts: 73
- Joined: Sat Apr 08, 2006 6:51 pm
Re: link text chunk
Thankk you for your patience and understanding. Yes, I have read the dictionary and the user's guide. Here's what I am trying to do:
The user clicks on a Latin word in a field of text. We get the clickText and match it up with a translating English word and show them to the user. Some times the word is part of a phrase that needs additional explaining. In that case, the phrase is joined up using "link" and matched to the additional information. All of this is working fine.
The problem comes in trying to find discrepancies between the linked words as clickText and the matching phrase in the dictionary because if there is a single char or space that doesn't match in the phrase that is clicked the search returns empty. To debug the issue I need to loop through all the words and phrases in the Latin passage. I've been able to do that for words using
for i = 1 to the number of words in fld LatinText
I understand I could also loop using chars or lines instead of words
My question: how do I loop through using link text groups? It is no good for me to go through the link text item word by word because many times a word in the link text item is used outside of that linked phrase and has a different meaning. Using the textStyle of the words doesn't seem to work because often there are two linked text groups in sequence so all the words in both groups have the style link but aren't all in the same group.
Perhaps if I could explain my problem more clearly I could figure out what I am looking for. How would you iterate through a field with regular words and group text groups in it, pick out just the link phrases a copy them into another field?
The user clicks on a Latin word in a field of text. We get the clickText and match it up with a translating English word and show them to the user. Some times the word is part of a phrase that needs additional explaining. In that case, the phrase is joined up using "link" and matched to the additional information. All of this is working fine.
The problem comes in trying to find discrepancies between the linked words as clickText and the matching phrase in the dictionary because if there is a single char or space that doesn't match in the phrase that is clicked the search returns empty. To debug the issue I need to loop through all the words and phrases in the Latin passage. I've been able to do that for words using
for i = 1 to the number of words in fld LatinText
I understand I could also loop using chars or lines instead of words
My question: how do I loop through using link text groups? It is no good for me to go through the link text item word by word because many times a word in the link text item is used outside of that linked phrase and has a different meaning. Using the textStyle of the words doesn't seem to work because often there are two linked text groups in sequence so all the words in both groups have the style link but aren't all in the same group.
Perhaps if I could explain my problem more clearly I could figure out what I am looking for. How would you iterate through a field with regular words and group text groups in it, pick out just the link phrases a copy them into another field?
In nova fert animus mutatas dicere formas corpora.
Re: link text chunk
Hi Preston,
First of all, there is the linkClicked message. As you have read the documentation about this message, you already know that the linkClicked message has a parameter containing either the linked text or the linkText of the linked text. This should be sufficient for you.
If you really want to use a loop, you can continue the loop until you encounter a character or word that has a different textStyle:
Best regards,
Mark
First of all, there is the linkClicked message. As you have read the documentation about this message, you already know that the linkClicked message has a parameter containing either the linked text or the linkText of the linked text. This should be sufficient for you.
If you really want to use a loop, you can continue the loop until you encounter a character or word that has a different textStyle:
Code: Select all
if not (the textStyle of char x of fld "ABC" contains "link") then
exit repeat
else
Best regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode