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

Getting selection positions from area

 [1/4] from: greg::schofield::iinet::net::au at: 30-Sep-2007 12:34


I am foxed again. Thanks to Anton and Carl, I have a GUI working as far as loading things. On one side an Area that maps the empty returns in an Ara that displays the text itself. The idea is to select parts of the "map" and then manipulate the text in the other area. But how do I get selection positions from an GUI Area field? (Start position and End Position is all that is needed at this stage). I do not need an associated event with selection, but that could be useful later on. I think I have exhausted the documentation, but no-dount there is something somewhere on this. Any help would be welcome. Greg Schofield Perth Australia

 [2/4] from: gregg::pointillistic::com at: 30-Sep-2007 10:04


Hi Greg, gsina> But how do I get selection positions from an GUI Area field? system/view/highlight-start and system/view/highlight-end are what you're after I think. view layout [ area [ print [copy/part system/view/highlight-start system/view/highlight-end] ] ] VID documentation, on internals like this that you sometimes need to know about, are one of REBOL's weakest areas. -- Gregg

 [3/4] from: greg::schofield::iinet::net::au at: 1-Oct-2007 17:03


Hi and thanks Gregg, After a little fiddling I got the code you sent working, and am very happy with the results. A get a fair amount of funnies, I have no error checking at all. While the thing might, in my hands, never be good enough for public release, I can see myself using it fairly soon. In processing large amounts of text I want to create a number of different mechanisms, based on the type of text being processed, rather than a bloated program trying to be everything for all possiblities. What I am trying to do is nothing complex, anyone processing text on a scale knows before hand the type of text it is, my idea is simply you pick the one that best fits and end up with well marked-up (TEI) XML that can be used to generate PDF or voiceXML. Thanks again from a newbie. This is a very helpful and friendly community. Greg Schofield Perth Australia --- Message Received --- From: Gregg Irwin <gregg-pointillistic.com> To: greg.schofield-iinet.net.au <rebolist-rebol.com> Reply-To: rebolist-rebol.com Date: Sun, 30 Sep 2007 10:04:14 -0600 Subject: [REBOL] Re: Getting selection positions from area Hi Greg, gsina> But how do I get selection positions from an GUI Area field? system/view/highlight-start and system/view/highlight-end are what you're after I think. view layout [ area [ print [copy/part system/view/highlight-start system/view/highlight-end] ] ] VID documentation, on internals like this that you sometimes need to know about, are one of REBOL's weakest areas. -- Gregg

 [4/4] from: anton::wilddsl::net::au at: 2-Oct-2007 18:27


Hi Greg, It's necessary to make some custom AREA styles which will interact with each other. The Map AREA is needed for positioning the Text AREA. Edits of the text in the Text area require the Map area to be updated. It's necessary to modify/replace the FEEL/ENGAGE function in each new area style. The default feel is: print mold svv/vid-styles/area/feel Check out CTX-TEXT: print mold first ctx-text Then check out EDIT-TEXT, referred to in the area feel: print mold get in ctx-text 'edit-text Here's a possibly helpful first experiment: full-text: "I spoke^/she spoke^/we spoke together." derive-map: func [full-text /local map-text][ map-text: copy "" parse/all full-text [some [thru newline (append map-text "-")]] return map-text ] view layout [ across map-area: area 100 (derive-map full-text) font-name (font-fixed) feel [ engage: func [face action event][ ; call the default engage svv/vid-styles/area/feel/engage face action event print "update the text-area here" ; <-- ] ] text-area: area (full-text) feel [ engage: func [face action event][ ; call the default engage svv/vid-styles/area/feel/engage face action event print "update map-area here" ; <-- if necessary, eg. ; the key changed number of newlines or moved vertical scroll position ] ] ] Regards, Anton.