Hi Ged,
I have a Scratchpad.r where i start developing. Thats the blank screen or the
form.
"In VB I start with a blank form, dropping controls and
then writing the event handlers."
my vb-blank-area (text-area with slider, quit-button):
view layout[
buttin #"^q" "quit" [quit]
slider 16x450 [scroll-para ta face]
area 600x450
]
starts with hotkey from my editor. error: console, a quick "q" in the console
quits and i am back in editor.
"In Java I start with an object model. I identify my
objects with methods and properties and then start
composing the relative classes."
Not so necessary in rebol imho, because most of the usefull classes are
inbuild and very flexible.
"In Perl or Ruby I start with the input stream, usually
a file, and start heading for the output stream."
me too. using 'save/all and 'load/all. Very usefull with rebol, because data
is easy to structure (hierarchy of blocks), search and (!) to create by hand
for debugging.
my blank data-page:
words: [files names something] ;persistent to load/save
data-file: %scratchpad-data.txt
save-data: does[save/all data-file reduce words]
;loading once at atart, so no func
set words any[
attempt[load/all data-file] ; catchs errors, like "does not exist"
reduce[[%a %b] ["the a file" "the b file] #a-something]
]
to reset data-file i usually put a single "[" in, so the load fails, default
values are used.
So a blank page with gui and load/save is:
;;;;;;;;;;;;;;;;
words: [files names something] ;persistent to load/save
data-file: %scratchpad-data.txt
save-data: does[save/all reduce words]
;loading once at atart, so no func
set words any[
attempt[load/all data-file] ; catchs errors, "does not exist" etc.
reduce[[%a %b] ["the a file" "the b file] #a-something]
]
view layout[
buttin #"^q" "quit" [save-data quit]
slider 16x450 [scroll-para ta face]
area 600x450
]
;;;;;;;;;;;;;; hacked a bit straightforward, have now a basic file-commenter
used a lot "probe something" and "?? variable.
usefull too: keep variables in global context while debugging.
quick to look in.
be carefull with "attempt[load someting]". it hides all errors.
so it hides wrong filenames too. while debugging, you can set "attempt: :do"
so attempt will break on errors.
You can do "area/text: %file.r". but the filename is converted to string.
will not be found in the initial file-block.
so use "find files TO-STRING area/text"
once file is stored, it will not look for new files. try to fix that.
hints:
"union files read %./" appends, deletes doubles and keeps old order of first
argument.
"insert/dup" with the difference of two "length?" can be used to add "none"s
to the comments-field.
REBOL [Title: "Scratchpad - for developing"]
words: [files comments] ;persistent to load/save
data-file: %scratchpad-data.txt
save-data: does [save/all data-file reduce words]
;loading once at start, so no func
set words any [
attempt [load/all data-file] ; catchs errors, like "does not exist"
reduce [
f: sort read %./ ;files
head insert/dup copy [] none probe length? f ;a none-comment/file
]
]
view layout [
button #"^q" "quit" [save-data quit]
tl-files: text-list data files [
tf-file/text: first face/picked
index: index? find files tf-file/text
ta-comment/text: pick comments index
show [tf-file ta-comment]
]
return
tf-file: info
ta-comment: area [
index: index? find files to-file tf-file/text
change at comments index copy ta-comment/text
save-data
]
]
]
;-Volker
Am Mittwoch, 5. November 2003 10:49 schrieb Ged Byrne:
> I've read the recent 'losing the case' thread with
> interest.
>
> Personally, I've just come to the end of my honeymoon
> with Rebol.
>
> I've been throwing to gether 5 line scripts that do
> what pages of Java or VB do in 5 pages. I've stopped
> saying 'Wow,' and I'm starting to ask 'How.'
>
> The problem is that, given a blank piece of screen,
> where do I begin when devising my own code to solve my
> own problems. What is the starting point.
>
> Different languages have their own starting points.
> In VB I start with a blank form, dropping controls and
> then writing the event handlers.
>
> In Java I start with an object model. I identify my
> objects with methods and properties and then start
> composing the relative classes.
>
> In Perl or Ruby I start with the input stream, usually
> a file, and start heading for the output stream.
>
> What is the starting point with Rebol? Given a
> problem and an empty .r file how do I start growing my
> problem? With a form to enter the data? With a set
> of objects? With a set of functions? By defining a
> dialect?
>
> There seem to be so many approaches, but no single
> method affords itself?
>
> I can see there are some guys here who really know
> their Rebol - what approach do you take to a new Rebol
> project?
>
> Ged Byrne.
>
> ________________________________________________________________________
> Want to chat instantly with your online friends? Get the FREE Yahoo!
> Messenger http://mail.messenger.yahoo.co.uk
--
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.