My Notepad Style Project

Eric Chatonet eric.chatonet at sosmartsoftware.com
Fri Aug 1 06:20:22 EDT 2008


Bonjour Heather,

Glad to help you :-)
Your handler is perfect.

About inserting or replacing text have a look at selectedField,  
selectedChunk and selectedText functions in the docs.
When you will master that you might think about implementing drag and  
drop text into your "Edit" field:
Then you will have something more powerful than Note Pad :-)

Le 1 août 08 à 12:14, H Baric a écrit :

> Hi Eric, thanks for your help, it works perfectly :)
>
> Well, this is what I ended up using (in the stack script)
> Can you see if there is any problem writing it like this?
> I'm still VERY new to scripting :D:
>
> on commandKeyDown pKey
>
>    if pKey = "v" then
>
>       if the clipboard is "text" then
>
>       put the clipboardData[text] into field "Edit"
>
>       end if
>
>    else pass commandKeyDown
>
> end commandKeyDown
>
>
> Yes, and er now to work out how to  handle the replacing etc. Ack.  
> So many
> things to think about isn't there hehe... :D
>
> Heather
>
> ----- Original Message -----
> From: "Eric Chatonet" <eric.chatonet at sosmartsoftware.com>
> To: "How to use Revolution" <use-revolution at lists.runrev.com>
> Sent: Friday, August 01, 2008 6:47 PM
> Subject: Re: My Notepad Style Project
>
>
> Bonjour Heather,
>
> Welcome to the list :-)
>
> First you have to check the clipboard contents to accept text only:
> if the clipboard is "text" then...
> Then use the clipboardData["text"] that is unformatted text:
> put the clipboardData["text"] into fld < Edit field>
>
> To handle the paste shortcut:
>
> on commandKeyDown pKey
>    if pKey = "v" then...
>    else pass commandKeyDown
> end commandKeyDown
>
> You can use the pasteKey message also but it will work in a
> standalone only.
> Last but not least, you'll have to struggle with the selectedChunk to
> paste at the right place or replace some selected text.
> Good luck :-)
>
> Le 1 août 08 à 10:27, H Baric a écrit :
>
>> 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


Best regards from Paris,
Eric Chatonet.
----------------------------------------------------------------
Plugins and tutorials for Revolution: http://www.sosmartsoftware.com/
Email: eric.chatonet at sosmartsoftware.com/
----------------------------------------------------------------





More information about the use-livecode mailing list