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

how to save text in area to file

 [1/4] from: slok00::yahoo::com at: 23-Dec-2001 5:58


How can I save the text that a user keys into a area on a panel? In Panel 1, I have an area for user to key in text and a button "Save". How can I do it such that when the button "Save" is pressed, the text in the area will be saved to a pre-define text file. My code is as follows... ======================== REBOL [ Title: "Save to File" ] filename: %index.html main: layout [ vh2 "Subpanel Examples" guide pad 20 button "Panel 1" [panels/pane: panel1 show panels] button "Panel 2" [panels/pane: panel2 show panels] button "Quit" [quit] return box 2x240 maroon return panels: box 420x240 ] panel1: layout [ origin 8x8 h2 "Panel 1" button "Save" [alert "File saved."] area wrap ] panel2: layout [ origin 8x8 h2 "Panel 2" across txt "X:" slider 150x16 return txt "Y:" slider 150x16 return check [panel2/color: maroon show panel2] txt "Don't click this" return check [panel2/color: silver show panel2] txt "Click this" return ] panel1/offset: 0x0 panel2/offset: 0x0 panels/pane: panel1 center-face main view main ====================================== Thanks Yek Soon

 [2/4] from: sunandadh:aol at: 22-Dec-2001 17:39


Hi Yek Soon,
> How can I save the text that a user keys into a area on a panel? > > In Panel 1, I have an area for user to key in text and a button "Save". > How can I do it such that when the button "Save" is pressed, the text in > the area will be saved > to a pre-define text file.
Give the input field a name (e.g. User-Input), add a Write of User-Input/text to the Save button action facet: panel1: layout [ origin 8x8 h2 "Panel 1" button "Save" [write FileName User-Input/Text alert "File saved."] User-Input: area wrap ] Sunanda.

 [3/4] from: slok00:y:ahoo at: 23-Dec-2001 8:13


neat!! this is my first attempt working with View and it is very impressive so far. thanks. YekSoon At 05:39 PM 12/22/2001 -0500, you wrote:

 [4/4] from: arolls:idatam:au at: 24-Dec-2001 15:26


A note about panel sizing: You can define the main layout after the two panels. Then you can calculate the size of the box to be used as the panel switching area, like this: main: layout [ ... panels: box (max panel1/size panel2/size) ] Now, if you change the size of your panels, your main layout will resize automatically. Anton.