Footnotes in scrolling text fields
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Footnotes in scrolling text fields
I cannot find this question in the forum. I am writing a ebook on law in which I cite sources (court cases, statutes, and attorney general opinions) for statements. Using linked superscripted consecutive numbers at the end of statements seems the method to use, as in a printed book, but the footnote numbers are linked text. It seems to me that a mouseEnter handler must be put into the script in the locked field containing the text. When the reader put the cursor over a superscripted, linked footnote number, I want a small field to pop up near it in which the source is stated, also in linked text, so that the user can click the text and open the actual source, a PDF file or a web page. Hoping I have not overlooked the solution, I thank you for your suggestions.
Monty
Monty
-
- VIP Livecode Opensource Backer
- Posts: 9655
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Footnotes in scrolling text fields
Hi.
Only a quick read on your post, but does the "mouseText" help you here?
Craig Newman
Only a quick read on your post, but does the "mouseText" help you here?
Craig Newman
Re: Footnotes in scrolling text fields
Hello Craig
Your suggestion to use the mouseText function seems to be the answer, but nothing happens when my mouse hovers over linked text in a locked field:
Of course, I want a field with the text of the footnote to appear, not a dialog box. Would the following be the correct script?:
Thank you for any further suggestions.
Monty
Your suggestion to use the mouseText function seems to be the answer, but nothing happens when my mouse hovers over linked text in a locked field:
Code: Select all
on mouseenter
if the style of mousetext is "group" then
answer "Daisy"
end if
end mouseenter
Code: Select all
if the style of mousetext is "group" then
put the mousetext into vFootnote -- mousetext should return the number of the footnote, I think
show fld vFootnote
end if
Thank you for any further suggestions.
Monty
Re: Footnotes in scrolling text fields
Hi Monty,
well "mouseenter" will NOT do what you want!
This message will get fired as soon as the mouse enters (sic!) the RECT of the field
and at that time it is unlikely that there is already TEXT under the mouse!
Use "mousemove" instead, that is being sent continuously while the mouse is moving over the field:
Best
Klaus
well "mouseenter" will NOT do what you want!
This message will get fired as soon as the mouse enters (sic!) the RECT of the field
and at that time it is unlikely that there is already TEXT under the mouse!
Use "mousemove" instead, that is being sent continuously while the mouse is moving over the field:
Code: Select all
on mousemove
if the style of THE mousetext = "group" then
put the mousetext into vFootnote -- mousetext should return the number of the footnote, I think
show fld vFootnote
end if
end mousemove
Klaus
Re: Footnotes in scrolling text fields
Hello Klaus,
Thank you for pointing out the error and the correct handler, but now I have another problem. After reading the dictionary entry for mouseMove and seeing its example, I revised my script for the field containing my body text with footnotes:
Sorry if I am overlooking the obvious, and I don't want you or any other experienced developer to do my work for me, but maybe the fix is obvious.
Monty
Thank you for pointing out the error and the correct handler, but now I have another problem. After reading the dictionary entry for mouseMove and seeing its example, I revised my script for the field containing my body text with footnotes:
Lets say my superscripted footnote number, which is styled as link, is "1". My hidden field representing the footnote is named "1". Upon hovering the mouse cursor over the footnote number, I get the dialog box and it returns "1" (yay! ), but after I close the dialog box I get an error ( ). The script editor says "no such object," meaning, I suppose, there is no field on the card that has the name "1". But there is a field on the cd named "1". I get the same result if I add "of this cd" to the line.on mouseMove
if the mouseChunk is not empty and "link" is among the items of the textStyle of the mouseChunk then
put the mousetext into vFootnote
answer vFootnote
show fld vFootnote
end if
end mouseMove
Sorry if I am overlooking the obvious, and I don't want you or any other experienced developer to do my work for me, but maybe the fix is obvious.
Monty
Re: Footnotes in scrolling text fields
Hi Monty,
1. do not use any ANSWER dialog in a MOUSEMOVE handler!
Bad idea, which might cause an ENDLESS loop if you have bad luck and
surely will produce strange results as oyu have experienced!
2. MOST important:
Do not use NUMBERS as names for Livecode objects, that will irritate the engine,
because the engine sees this as the NUMBER (layer) of the object and niot its name!
Add at least any character like "f1" or whatever!
...
put the mousetext into tFootNote
show fld ("f" & tFootNote)
...
Best
Klaus
1. do not use any ANSWER dialog in a MOUSEMOVE handler!
Bad idea, which might cause an ENDLESS loop if you have bad luck and
surely will produce strange results as oyu have experienced!
2. MOST important:
Do not use NUMBERS as names for Livecode objects, that will irritate the engine,
because the engine sees this as the NUMBER (layer) of the object and niot its name!
Add at least any character like "f1" or whatever!
...
put the mousetext into tFootNote
show fld ("f" & tFootNote)
...
Best
Klaus
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: Footnotes in scrolling text fields
Hi monty,
I tested your script and it works for me.
The script show the field named "2" when the mousetext = "2", but I think a number is not a good name for a control.
if you put "1" into a variable tMyName
If you call field tMyName you call the first fld not the field named "1"
To go further, we need some informations about your project.
For exemple:
Do you think have one field for each note ?
Best regards
Jean-Marc
I tested your script and it works for me.
The script show the field named "2" when the mousetext = "2", but I think a number is not a good name for a control.
if you put "1" into a variable tMyName
If you call field tMyName you call the first fld not the field named "1"
To go further, we need some informations about your project.
For exemple:
Do you think have one field for each note ?
Best regards
Jean-Marc
https://alternatic.ch
-
- VIP Livecode Opensource Backer
- Posts: 9655
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Footnotes in scrolling text fields
Here is some stuff to play with. Make a large field with some text. Make another small field named "footnote". Put this in the script of the large field:
Play with the first two lines in the "mouseMove" handler, just to see how they work. Now comment those two lines, and uncomment the last two lines, as well as with the other handlers. Now figure out a way to make that footnote field stay put if you want to click in it. Write back with how you did it.
Craig
Code: Select all
on mouseMove
put the mousetext
set the tooltip of me to the mouseText
--put the mouseText into fld "footNote"
--show fld "footnote" at item 1 of the mouseLoc + 50 & "," & item 2 of the mouseLoc + 20
end mouseMove
--on mouseLeave
hide fld "footNote"
end mouseLeave
--on mouseEnter
show fld "footnote"
end mouseEnter
Craig