My Notepad Style Project
H Baric
hbaric at gmail.com
Sat Aug 2 10:12:11 EDT 2008
Hi Jan,
Thanks for the one-liner, one to remember!
I tried to drag drop text into my field from other sources before trying
your script, and it works! So would I still need to use it and why? In a
standalone will it still work without the script?
Thanks for your advice!
Heather
----- Original Message -----
From: "Jan Schenkel" <janschenkel at yahoo.com>
To: "How to use Revolution" <use-revolution at lists.runrev.com>
Sent: Friday, August 01, 2008 9:43 PM
Subject: Re: My Notepad Style Project
--- H Baric <hbaric at gmail.com> wrote:
> Hi all, this is my first post. Hope it works!
>
> I'm making a very simple Text File Editor, based
> pretty much exactly on Window's Notepad, for the
> sake of learning.
>
> I've been trying to find a way to set the Edit field
> to non-formatted text when copying and pasting text
> from web-pages and other applications for example.
>
> What would be the best way to ensure that the
> editing field cannot be formatted in any way (like
> Notepad and other basic text editors)?
>
> Is it possible? How (and where) would I script this?
> Thanks in advance :)
>
> Cheers,
> Heather
>
Hi Heather,
Welcome to the Revolution community - you'll be sure
to receive lots of help as you're getting to know the
product we all love.
The one-line solution to strip the style information
from a text field is:
put the text of field "MyField" into field "MyField"
Now, if you want this to happen whenever the user
pastes more text into a field or drags-and-drops from
another field or another application, you'd have a
script similar to this:
##
on pasteKey
send "StripStyles" to me in 0 milliseconds
pass pasteKey
end pasteKey
on dragDrop
send "StripStyles" to me in 0 milliseconds
pass dragDrop
end dragDrop
on StripStyles
-- save the current selection
put the selectedChunk of me into tSelectedChunk
-- strip the style information
put the text of me into me
-- restore the selection
select tSelectedChunk
end StripStyles
##
Hope this helped,
Jan Schenkel.
Quartam Reports & PDF Library for Revolution
<http://www.quartam.com>
=====
"As we grow older, we grow both wiser and more foolish at the same time."
(La Rochefoucauld)
_______________________________________________
use-revolution mailing list
use-revolution at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list