Page 1 of 1
Non-existent lines
Posted: Sun Dec 31, 2017 5:50 am
by dunbarx
Make a new field, lock it ,load the first three lines, say, with text and then in a handler somewhere:
Code: Select all
on mouseUp
answer word 2 of the clickLine
end mouseUp
If you click where, say, line 6 should be, you will not get a "6", rather you will get empty. This is because there is no sixth line, even though one has clicked where that line by all rights ought to be. And would indeed be if text extended down that far.
Now there are ways to derive that "6", of course, using other properties such as the clickV, the top of the field and the textHeight of the field. Whatever.
I understand the nature of a LC field that is empty below its existing text. Those "lines" do not yet exist.
In other words, would an "effective" clickLine be of interest to anyone? Is it worth suggesting?
Craig Newman
Re: Non-existent lines
Posted: Sun Dec 31, 2017 6:01 am
by bogs
Um, I must be somewhat dense at the moment, but I'm not sure I follow where the benefit would be to this.
You have 3 lines of text.
You know there is no text below that.
You want to have something that doesn't exist return something other than empty?
Oh dear, I've gone cross eyed again

Re: Non-existent lines
Posted: Sun Dec 31, 2017 6:51 am
by FourthWorld
dunbarx wrote: ↑Sun Dec 31, 2017 5:50 am
In other words, would an "effective" clickLine be of interest to anyone? Is it worth suggesting?
`The question they'll ask is: what is the use case that requires it?
Re: Non-existent lines
Posted: Sun Dec 31, 2017 10:05 am
by richmond62
Cannot think of any reason for that.
Re: Non-existent lines
Posted: Sun Dec 31, 2017 5:24 pm
by tomBTG
I can't imagine needing to know the position of non-existent lines. But I can image an easy solution for you: just add to the field's text the number of RETURNS needed to fill up the field. Then your code will report those line numbers.
HTH,
Tom B.
Re: Non-existent lines
Posted: Sun Dec 31, 2017 5:37 pm
by Klaus
Hi Craig,
something like this will give you the "virtual" clickline, script of an EMPTY "default" and locked scrolling field:
Code: Select all
on mouseUp
put the mouseV into tY
put the effective textheight of me into tTH
put tY - the top of me + the topmargin of me into tCurrentLine
answer "You clicked the virtual line:" && round(tCurrentLine/tTH)
end mouseUp
May need some adjustment, but works as exspected so far
Best
Klaus
Re: Non-existent lines
Posted: Sun Dec 31, 2017 5:54 pm
by Klaus
P.S.:
And I really don't care WHY you want to know this, since this is no "philosophy today" forum!

Re: Non-existent lines
Posted: Sun Dec 31, 2017 6:08 pm
by jacque
I'm curious though, since in 30 years I've never needed to know that.
Re: Non-existent lines
Posted: Sun Dec 31, 2017 6:28 pm
by dunbarx
Hmmm.
@ Klaus. Certainly. I mentioned properties that would do what your offering did. Thank you. We think alike.
@ You other mooks... (Not you, Jacque)
Say you wanted to insert a line of text into a "virtual" (thanks again, Klaus) line a bit below the "real" lines of a field. One can always:
Code: Select all
put "foo" into line 12 of fld "fieldWithOnlyThreeLinesInIt"
and LC will happily "create" the 12th line and load it with our beloved "foo".
So LC knows where line 12 needs to be. One might say it knows where line 12 actually is, even though it does not yet exist. But the point I was trying to make is that a
mouseClick on that, er, line, just don't have no zest appeal.
And therefore might it be useful to be able to access what LC already knows:
Code: Select all
on mouseUp
get word 2 of the effective clickLine
put "foo" into line it of fld "fieldWithOnlyThreeLinesInIt"
end mouseUpp
Click, in my dreams, on line 12 of that field.
And if that is useful, we no longer need the ordinary clickLine function; simply enhance it to this one.
Craig
Re: Non-existent lines
Posted: Sun Dec 31, 2017 6:30 pm
by richmond62
"
mook" ?
coining new words for the new year?
Love and Kisses, Richmond.

Re: Non-existent lines
Posted: Sun Dec 31, 2017 9:09 pm
by bogs
Proud card carrying 'mook' for 50 years, and counting

Happy New Years (eve/day) on clickLine virtualInfinity!
Re: Non-existent lines
Posted: Sun Dec 31, 2017 9:30 pm
by jacque
dunbarx wrote: ↑Sun Dec 31, 2017 6:28 pm
and LC will happily "create" the 12th line and load it with our beloved "foo".
So LC knows where line 12 needs to be.
I'm not sure about that. I'd guess that LC is just adding enough carriage returns to create 12 lines and then inserting content. We could do that too in script.
Re: Non-existent lines
Posted: Sun Dec 31, 2017 11:24 pm
by [-hh]
Craig,
what makes you think you know "the" line number for that click?
A fixed lineHeight, a non-wrapped field, a black foreColor on a white background, a visible vscrollbar?
@ALL: Have a nice end of 2017!
H.
Re: Non-existent lines
Posted: Mon Jan 01, 2018 12:25 am
by dunbarx
Hermann.
I usually work with fixed lineHeights and textSizes, but you make a point.
I assume an unwrapped field, but you make a point.
Scrollbars can be dealt with, using the "scroll" function, just as we all have mentioned with script gadgetry that does the work I am talking about. But you make a point
Black foreColors? White backgrounds? Oh yes, it is already new years where you are. Have another schnapps on me.
I'd guess that LC is just adding enough carriage returns to create 12
Jacque.I would think so as well. Much more straightForward than taking account of all those other properties and doing all that figuring.
So no traction. OK.
Craig
Re: Non-existent lines
Posted: Mon Jan 01, 2018 1:08 am
by [-hh]
If that is all fixed then you could translate every clickloc to a non-existent pixel of a non-existent char x of the non-existent line y of your (non-existent?) field, and back.

)
Happy new year Craig. Hopefully we have once again a year with extraordinary ideas by you (from 2017 only the current one is funny, TMHO).