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

[REBOL] Re: Cursor

From: hijim:pronet at: 1-Jul-2001 19:34

Hi Volker, Thanks for the cursor information. I've used it to insert the html tags with buttons. I wonder if there's also a way to change the value of the caret so that when I insert 3 characters, I can also move the cursor ahead 3 characters. You can view the caret, but can you move it too? I get error messages if I try to use one of the green buttons when the text area is empty. I'll keep experimenting to see if I can get around that. Obviously, you can't insert anything if there's no text there to begin with! Maybe I need to check that text exists first. Any help here on how to make the button action conditional is welcome. Thanks again, Jim Script follows: (I hope this format doesn't break the lines in email.) rebol [Title: "HTML Tag Editor"] a-file: "" foc: does [focus text-file show 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 style but button 70x20 green / 2 font-name font-fixed space 0 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 pad 0x2 but "<P>" #"^p" [insert system/view/caret "<P>" show text-file] but "<BR>" #"^b" [insert system/view/caret "<BR>" show text-file] but "&nbsp" #"^n" [insert system/view/caret " &nbsp; " show text-file] but "<PRE>" #"^k" [insert system/view/caret "<PRE></PRE>" show text-file] but "<UL>" [insert system/view/caret {</UL> <LI> </UL>} show text-file] but "<OL>" [insert system/view/caret {</OL> <LI> </OL>} show text-file] but "<LI>" #"^l" [insert system/view/caret "<LI>" show text-file] but "Link" [insert system/view/caret {<a href=""> </a>} show text-file] but "Image" [insert system/view/caret {<image src = "" align="left" hspace=10>} show text-file] but "Date" #"^D" [insert system/view/caret to-string now/date show text-file] return pad 0x4 button 70 "Open" [ file-path: request-file/title/keep "Open File" "Open" if file-path <> none [ a-file: read/string to-file file-path system/view/focal-face 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] 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] ]