Re: determining if cursor is in last line of a field

2013-09-19 Thread dunbarx
What Mark meant was that the formattedText reconfigures the displayed text as 
if it had hard returns in just the right places. His script uses the 
formattedText...


Anyone remember the "wordWrap" XFCN in HC? I never knew who wrote it.


Craig


-Original Message-
From: Dr. Hawkins 
To: How to use LiveCode 
Sent: Thu, Sep 19, 2013 11:19 am
Subject: Re: determining if cursor is in last line of a field


On Thu, Sep 19, 2013 at 1:08 AM, Mark Schonewille <
m.schonewi...@economy-x-talk.com> wrote:

> Probably, that won't do it. Try this:
>
>  put (number of lines of the formattedText of  \
>char 1 to (word 2 of the selectedChunk) of myTarget) is \
>(the number of lines of the formattedText of myTarget)
>  --> true|false
>

Now I'm confused:  does selectedLine() use hard cr's instead of the
displayed line in the field?  I had been assuming the latter due to the
lack of mention of cr in the dictionary page, as it gets mentioned in
others where it is used.

-- 
Dr. Richard E. Hawkins, Esq.
(702) 508-8462
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

 

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: determining if cursor is in last line of a field

2013-09-19 Thread Dr. Hawkins
On Thu, Sep 19, 2013 at 1:08 AM, Mark Schonewille <
m.schonewi...@economy-x-talk.com> wrote:

> Probably, that won't do it. Try this:
>
>  put (number of lines of the formattedText of  \
>char 1 to (word 2 of the selectedChunk) of myTarget) is \
>(the number of lines of the formattedText of myTarget)
>  --> true|false
>

Now I'm confused:  does selectedLine() use hard cr's instead of the
displayed line in the field?  I had been assuming the latter due to the
lack of mention of cr in the dictionary page, as it gets mentioned in
others where it is used.

-- 
Dr. Richard E. Hawkins, Esq.
(702) 508-8462
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: determining if cursor is in last line of a field

2013-09-19 Thread Mark Schonewille

Hi Richard,

The selectedLine counts the number of hard returns. Just try it.

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Use Color Converter to convert CMYK, RGB, RAL, XYZ, H.Lab and other 
colour spaces. http://www.color-converter.com


Buy my new book "Programming LiveCode for the Real Beginner" 
http://qery.us/3fi


Fill out this survey please
http://livecodebeginner.economy-x-talk.com/survey/

On 9/19/2013 17:18, Dr. Hawkins wrote:


Now I'm confused:  does selectedLine() use hard cr's instead of the
displayed line in the field?  I had been assuming the latter due to the
lack of mention of cr in the dictionary page, as it gets mentioned in
others where it is used.



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: determining if cursor is in last line of a field

2013-09-19 Thread Mark Schonewille

Hi Richard,

Probably, that won't do it. Try this:

 put (number of lines of the formattedText of  \
   char 1 to (word 2 of the selectedChunk) of myTarget) is \
   (the number of lines of the formattedText of myTarget)
 --> true|false

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Use Color Converter to convert CMYK, RGB, RAL, XYZ, H.Lab and other 
colour spaces. http://www.color-converter.com


Buy my new book "Programming LiveCode for the Real Beginner" 
http://qery.us/3fi


Fill out this survey please
http://livecodebeginner.economy-x-talk.com/survey/

On 9/18/2013 22:00, Dr. Hawkins wrote:

On Wed, Sep 18, 2013 at 9:02 AM, Mark Schonewille <
m.schonewi...@economy-x-talk.com> wrote:


put number of lines of the formattedText of  \
char 1 to (word 2 of the selectedChunk) of me



Ah.

Obvious now that you mention it :)

Thank you.

And to make me feel *really* sheepish:  I was already using the height of
the formattedText in the same routine . . .

so
the selectedLine is the number of lines of the formattedText of myTarget

should do it.





___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: determining if cursor is in last line of a field

2013-09-18 Thread Dr. Hawkins
On Wed, Sep 18, 2013 at 9:02 AM, Mark Schonewille <
m.schonewi...@economy-x-talk.com> wrote:

>put number of lines of the formattedText of  \
>char 1 to (word 2 of the selectedChunk) of me
>

Ah.

Obvious now that you mention it :)

Thank you.

And to make me feel *really* sheepish:  I was already using the height of
the formattedText in the same routine . . .

so
   the selectedLine is the number of lines of the formattedText of myTarget

should do it.



-- 
Dr. Richard E. Hawkins, Esq.
(702) 508-8462
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: determining if cursor is in last line of a field

2013-09-18 Thread Mark Schonewille

Hi Richard,

There are probably many ways to do this, Here's one:

   put number of lines of the formattedText of  \
   char 1 to (word 2 of the selectedChunk) of me


--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Use Color Converter to convert CMYK, RGB, RAL, XYZ, H.Lab and other 
colour spaces. http://www.color-converter.com


Buy my new book "Programming LiveCode for the Real Beginner" 
http://qery.us/3fi


Fill out this survey please
http://livecodebeginner.economy-x-talk.com/survey/

On 9/18/2013 17:43, Dr. Hawkins wrote:


If I have "my dog has fleas" in a field, the number of lines of this field
is always 1.

If the width of the field causes it to display as

my dog
has fleas

and the cursor is after "has", the selectedLine is 2.

But how do I determine that the number of lines, as formatted, in this
field is 2?

If someone hits a down arrow in the first line, I want to pass it to go to
the second line, but if they hit it in the second, I want to jump to
another field in another group.




___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: determining if cursor is in last line of a field

2013-09-18 Thread dunbarx
Try this:


answer the formattedText of fld "yourField"


It wraps unwrapped text with hard returns, and that will give the last line


Craig





-Original Message-
From: Dr. Hawkins 
To: How to use LiveCode 
Sent: Wed, Sep 18, 2013 11:23 am
Subject: determining if cursor is in last line of a field


If selectedLine() is 1, I am in the first line of a field.

I can't tell, though, what the last line is--"the number of lines" relies
on CR, not how the field is actually formatted.

I've looked for other "line" entries in the dictionary, but without any
luck.

-- 
Dr. Richard E. Hawkins, Esq.
(702) 508-8462
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

 
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: determining if cursor is in last line of a field

2013-09-18 Thread Dr. Hawkins
On Wed, Sep 18, 2013 at 8:34 AM, Peter M. Brigham  wrote:

> Not sure what you mean, "how the field is actually formatted." If you are
> talking about possibly having empty lines following the last text in the
> field, then
>the number of lines of (word 1 to -1 of fld "myField")
> would work. Compare this value with
>the number of lines of char 1 to (word 4 of the selectedchunk) of fld
> "myField"
>
> Maybe I don't understand the problem, though.
>

If I have "my dog has fleas" in a field, the number of lines of this field
is always 1.

If the width of the field causes it to display as

   my dog
   has fleas

and the cursor is after "has", the selectedLine is 2.

But how do I determine that the number of lines, as formatted, in this
field is 2?

If someone hits a down arrow in the first line, I want to pass it to go to
the second line, but if they hit it in the second, I want to jump to
another field in another group.


-- 
Dr. Richard E. Hawkins, Esq.
(702) 508-8462
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: determining if cursor is in last line of a field

2013-09-18 Thread Peter M. Brigham
On Sep 18, 2013, at 9:22 AM, Dr. Hawkins wrote:

> If selectedLine() is 1, I am in the first line of a field.
> 
> I can't tell, though, what the last line is--"the number of lines" relies
> on CR, not how the field is actually formatted.
> 
> I've looked for other "line" entries in the dictionary, but without any
> luck.

Not sure what you mean, "how the field is actually formatted." If you are 
talking about possibly having empty lines following the last text in the field, 
then
   the number of lines of (word 1 to -1 of fld "myField")
would work. Compare this value with
   the number of lines of char 1 to (word 4 of the selectedchunk) of fld 
"myField"

Maybe I don't understand the problem, though.

-- Peter

Peter M. Brigham
pmb...@gmail.com
http://home.comcast.net/~pmbrig


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


determining if cursor is in last line of a field

2013-09-18 Thread Dr. Hawkins
If selectedLine() is 1, I am in the first line of a field.

I can't tell, though, what the last line is--"the number of lines" relies
on CR, not how the field is actually formatted.

I've looked for other "line" entries in the dictionary, but without any
luck.

-- 
Dr. Richard E. Hawkins, Esq.
(702) 508-8462
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode