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

Text Area scroll.

 [1/9] from: bga::bug-br::org::br at: 8-Dec-2003 18:30

Hello. By know I learned how to use scroll bars in text areas to scroll the text inside it (vertically and horizontally). Now I need the scroll bars to auto-move to represent the current position being displayed in the text view when I use the cursor keys to move around the text. I also need to know how to scroll the text area to a specific text position (like scroll to top and scroll to bottom). Any help will be apreciated. -Bruno

 [2/9] from: carlos:lorenz:bol at: 9-Dec-2003 10:24

Bruno, I remember last time I asked here just the same and unfortunately I got only one reply from the list that didn't solve the problem at all. I still need to get the path to get this this "auto-move" you mentioned so in case you have a clue write me pls um abrašo Carlos Lorenz Em Seg 08 Dez 2003 18:30, Bruno G. Albuquerque escreveu:

 [3/9] from: didec:tiscali at: 9-Dec-2003 15:33

Re: Text Area scroll. I have one example at home. I post it this evening. DideC

 [4/9] from: didier:cadieu:freesbee at: 9-Dec-2003 23:41

Re: Text Area scroll. Here is a demo It demonstrate the adjustment of the scroller when you edit the area. More works is needed for, in example, adjusting the scroller when you change the text in the area by programing. DideC
> Hello. > By know I learned how to use scroll bars in text areas to scroll the text
<<quoted lines omitted: 5>>
> Any help will be apreciated. > -Bruno
REBOL [ title: "Demo of area with scrollers" author: "Didier Cadieu (DideC)" date: 8-dec-2003 version 1.0.0 purpose: { Illustrate an area with 2 scrollers following the cursors. } ] para-scroll: func [ {move a slider according scroll position in a text field} tf {text face} sf {slider face} /redrag {also redrag the slider} /local tmp t ] [ if none? tf/para [exit] tmp: min 1x1 tf/size - 0x30 - size-text tf t: either sf/size/x > sf/size/y [1][2] sf/data: max 0 min 1 tf/para/scroll/:t / tmp/:t if redrag [sf/redrag min 1 tf/size/:t / max 1 pick size-text tf t] show sf ] tx: {1. Introduction to VID With REBOL/View it's easy and quick to create your own user interfaces. The purpose of this tutorial is to teach you the basic concepts or REBOL/View interfaces in about 20 minutes. VID is REBOL's Visual Interface Dialect. A dialect is an extension of the REBOL language that makes it easier to express or describe information, actions, or interfaces. VID is a dialect that provides a powerful method of describing user interfaces. VID is simple to learn and provides a smooth learning curve from basic user interfaces to sophisticated distributed computing applications. 1.1. Creating VID Interfaces VID interfaces are written in plain text. You can use any text editor to create and edit your VID script. Save your script as a text file, and run it with REBOL/View. } view layout [ origin 8x8 across vh3 "Area scroll demo" return text "Edit the text in this area :" return space 0x0 a: area 200x100 tx with [ link-to: none ; store the linked scrollers feel: make feel [ engage: func [face act event /local tmp] [ switch act [ down [ either not-equal? face system/view/focal-face [ focus face system/view/caret: offset-to-caret face event/offset ] [ system/view/highlight-start: system/view/highlight-end: none system/view/caret: offset-to-caret face event/offset ] show face ] over [ if not-equal? system/view/caret offset-to-caret face event/offset [ if not system/view/highlight-start [system/view/highlight-start: system/view/caret] system/view/highlight-end: system/view/caret: offset-to-caret face event/offset show face ] ] key [ ctx-text/edit-text face event get in face 'action ;**** Here is the modif to the feel object if block? face/link-to [ foreach tmp face/link-to [para-scroll/redrag face tmp] ] ] ] ] ] ] sv: scroller 16x100 [scroll-para a face] return sh: scroller 200x16 [scroll-para a face] return do [ ; store the linked scroller and init the scroller. a/link-to: reduce [sv sh] sv/redrag min 1 a/size/y / max 1 second size-text a sh/redrag min 1 a/size/x / max 1 first size-text a ] ]

 [5/9] from: philb:upnaway at: 10-Dec-2003 11:07

Hi Bruno/Carlos, Here is another text-area scroll demo .... rebol [ Title: "Area with scroller" Author: "Phhil Bevan" Date: 10-Dec-2003 Version 0.0.1 ] pos-scroll: func [tx sl /local tsize ts-max tmp] [ tsize: size-text tx either tsize/y <= tx/size/y [sl/redrag 1 sl/data: 0] [ sl/redrag tx/size/y / tsize/y ts-max: tsize/y - tx/size/y tmp: min 1 (- tx/para/scroll/y / ts-max) if all [sl/data = 1 tmp = 1] [tmp: 0.999] sl/data: tmp ] show sl ] lv-lay: layout [ space 0 across tx: area 400x200 feel [ engage: func [face action event] [ ctx-text/edit/engage face action event if all [event/type = 'key] [pos-scroll tx sl] ] ] sl: scroller 16x200 [scroll-para tx sl] ] pos-scroll tx sl ; set original size view lv-lay ---------------------------------- Cheers Phil

 [6/9] from: g:santilli:tiscalinet:it at: 10-Dec-2003 17:26

Hi Carlos, On Tuesday, December 9, 2003, 1:24:50 PM, you wrote: CL> I remember last time I asked here just the same CL> and unfortunately I got only one reply from the list CL> that didn't solve the problem at all. So everyone forgot about the EVOScript? ;-) Regards, Gabriele. -- Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer Amiga Group Italia sez. L'Aquila --- SOON: REBOL [ Title: "Evolving Script" Date: 25-Nov-2002/21:38:29+1:00 Name: none Version: 1.31.0 File: %evoscript.r Home: none Author: "Gabriele Santilli" Owner: none Rights: none Needs: [view 1.2.8] Tabs: none Usage: none Purpose: "To make the definitive quine!" Comment: "This can be addictive. You have been warned." History: [not yet implemented] Language: "English" Type: 'Script Content: true Layout: [ Do [trebuchet: [name: "Trebuchet MS" size: 14]] Style Button Btn font trebuchet font-size 16 bold -1x28 Banner center 600 font trebuchet font-size 38 bold yellow "The REBOL evolving script" Text right 600 font trebuchet font-size 16 "by Gabriele Santilli" Pad -10 Text right 600 font trebuchet italic "(original idea by Baron R.K. Von Wolfsheild)" Text 600 font trebuchet {Maybe I'm just crazy, but this is so much fun! It is amazing to see how easy I can be amazed by these short things... I wonder if any other language could do this in so few lines of code, and with this readability...} Across a: Area para [scroll: either value? 'remember-scroll [remember-scroll] [0x0]] font trebuchet 583x300 system/script/header/content feel [ engage': :engage last-scroll: none engage: func [face action event] [ engage' face action event if all [event/type = 'key face/para/scroll/y <> last-scroll] [ last-scroll: face/para/scroll/y rescroll ] ] ] Pad -8 s: Scroller 17x300 [ tsize: size-text a a/para/scroll/y: 280 - tsize/y * face/data show a ] do [rescroll] Return Button "Update Layout" 255.200.50 [ attempt [ attempt [ set reduce [in system/script 'header 'content] load/header/next a/text system/script/header/date: now system/script/header/version: system/script/header/version + 0.1.0 system/script/header/content: join "REBOL " [ find mold make system/script/header [content: true] "[" content ] ] remember-scroll: a/para/scroll lay2: system/words/layout system/script/header/layout lay/pane: lay2/pane lay/size: lay2/size show lay lay/text: system/script/header/title lay/changes: 'text show lay ] ] Button "Copy Script" [ write clipboard:// system/script/header/content ] Button "Save Script" 50.240.100 [ write system/script/header/file system/script/header/content do system/script/header/file "This is a bug in VIEW..." lay/feel: system/view/window-feel ] Button "Send to [giesse--rebol--it]" [ send/subject [giesse--rebol--it] system/script/header/content join "[EVOScript] " system/script/header/title ] Return Button "Pretty-print" [ pretty-print ] ] ] pretty-print: does [ attempt [ set reduce [ in system/script 'header 'content ] load/header/next a/text a/text: system/script/header/content: join "REBOL " [ find mold make system/script/header [ content: true ] "[" mold/only/all load content ] show a ] ] if exists? %clean-script.r [ do %clean-script.r pretty-print: does [ a/text: system/script/header/content: detab clean-script/spacey a/text show a ] ] rescroll: func [ /only ] [ tsize: size-text a if not only [ s/redrag min 1 a/size/y - 15 / tsize/y ] s/data: min 1 max 0 a/para/scroll/y / ( a/size/y - 15 - tsize/y ) show s ] system/view/window-feel/detect: func [ face event ] [ if event/type = 'scroll-line [ a/para/scroll/y: event/offset/y * -15 + a/para/scroll/y show a rescroll/only ] event ] view lay: layout system/script/header/layout

 [7/9] from: carlos:lorenz:bol at: 10-Dec-2003 15:19

Phil, Am I supposed to initiate words tx and ls first? Here I got an error Carlos Em Qua 10 Dez 2003 01:07, [philb--upnaway--com] escreveu:

 [8/9] from: antonr:iinet:au at: 11-Dec-2003 13:28

Use a newer View beta. I think you are using View 1.2.1 to test this ? It requires scroller style, which is only available in view betas newer than 1.2.1 Anton.

 [9/9] from: carlos:lorenz:bol at: 11-Dec-2003 8:58

Anton, hmmmm this seems to be the trouble thanks Carlos Em Qui 11 Dez 2003 00:28, you wrote:

  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted