Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Cursor

From: hijim:pronet at: 1-Jul-2001 14:31

Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit I have two questions. First, is there a way to use the function keys and/or the alt-keys in the manner of key #"^p" [write clipboard:// <P> ] Second, when using a text area in REBOL/View, is there a word that keeps track of the cursor position? I would like to use it to skip to that position and insert a string such as "<P>". I think I know how to do this if I can access the cursor position in the file.(A related question would be: I'm working on an editor that will insert html tags at the cursor position when I use a hotkey. As it stands now, I can use some of the control keys to copy to the clipboard. I can then insert the tags with ctrl-v. It works, but it's not very elegant. I'll attach the script for the editor. Don't try the slider. It doesn't work. I just put it in to see if I could figure out how to make it work using a couple of example scripts. I haven't been successful yet. Any help appreciated, Jim -- Attached file included as plaintext by Listar -- -- File: Html.r rebol [Title: "Clip and Paste Editor"] a-file: "" foc: does [focus text-file] html-end: does [append a-file { <image src = "line.gif"> <P> </blockquote> </body> </html> }] reb-source: [{REBOL [ Title: "" File: Date:} now/date { Author: "Jim Clatfelter" Purpose: [] ] view/layout [ ] } ] reb: reform reb-source view layout [ backdrop silver across space 10 text "CONTROL KEYS:" font [space: 1x0] bold text "P=<P> B=<BR> N=&nbsp L=<LI> K=<PRE></PRE>" font [space: 1x0] bold text "D=Date" font [space: 1x0] red bold space 0 return text-file: area 700x350 a-file ivory white font-name font-fixed s1: slider 16x350 [ probe s1/data text-file/para/origin/y: sl/data - 1 * (negate size/y) - size/y + 2 show text-file ] return button 70 "Open" [ file-path: request-file/title/keep "Open File" "Open" if file-path <> none [ a-file: read/string to-file file-path text-file/text: a-file file-path size: size-text text-file ; for slider? text-file/para/origin: 4x4 ; for slider? show text-file top-flag: true focus text-file ] ] button 70 "Save" #"^s" [ file-path: request-file/title/keep "Save File" "Save" if file-path <> none [ write first file-path text-file/text] ] button 70 "Print" [write %//prn append a-file #"^L"] button 70 "Quit" #"^q" [unview/all] key #"^p" [write clipboard:// "<P>"] key #"^b" [write clipboard:// "<BR>"] key #"^n" [write clipboard:// " &nbsp; "] key #"^l" [write clipboard:// "<LI>"] key #"^k" [write clipboard:// "<PRE></PRE>"] key #"^D" [write clipboard:// to-string now/date] button 70 "REBOL" [insert a-file reb foc] button 70 "HTML" [insert a-file { <html> <head> <title> TITLE </title> </head> <body><blockquote> <h1> </h1> <image src = "line.gif"> <P> } html-end foc] ]