[REBOL] Re: entering, storing and retrieving data in an array
From: meta:dimensional at: 21-Apr-2001 13:17
Thanks for your quick feedback, Jeff!
[jeff--rebol--net] wrote:
> Howdy, Jamie:
>
> Below is an example of ONE way to do that. The editing of
> entries can be handled by supplying action blocks for each
> item inside the LIST layout. Lemme know if that doesn't
> make sense and I'll post an example of that later.
Just FYI I'm a complete REBOL newbie. I think in English and not
C++. I'm looking to create the most human-readable code possible. I
wrote the docs for HyperSense on the NeXT and have written fairly
sophisticated apps with CanDo on the Amiga, which may give you a
hint of where I'm coming from. I'm hoping I can write english-like
scripts with REBOL to get useful things done across multiple
platforms quickly.
I've looked for answers in the various documents available from
rebol.com and tried to deconstruct script examples. I've learned a
bit but haven't gotten a handle on adding and subtracting data from
arrays.
I really appreciate your example and am trying to figure it out. So
far I can identify what happens in each part of the script but I'm
not yet completely understanding how it is happening. It looks
clever, though and the comments help.
For my first very simple app, there are some differences. Distilling
it to the basics:
I want to be able to click within the list area to hilight one
record. Is there a REBOL list style that does that?
I want separate entry fields for each bit of data in the record.
When I click on a record in the list I want the entry fields to show
the data for the selected record so they can be edited.
I want a button for adding a new record.
I want a button for saving the database to a file. It could load the
file automatically when the REBOL script is started.
I shouldn't have mentioned sorting yet, until I get a handle on this
very basic database handling. Any further hints or dead simple
examples most appreciated.
Here's my first whack:
REBOL [Title: "CD List"]
CDName: "CD Name"
Song: "Song Name"
Style: "Music Style"
CD: make object! [CDName Song Style]
view layout [
backdrop effect [gradient 60.0.150 60.10.60]
across
Button "Add Song"
Button "Remove Song"
Button "Save Songs"
below
across space 85x0
vh4 "CD" vh4 "Song" vh4 "Style"
below
space 3x3
list 380x65 [
origin 0
across
text 110
text 115
text 110
] data [
[:CDName :Song :Style]
]
below
across
field 120 :CDName
field 120 :Song
field 120 :Style
]
This shows the basic interface I want. I don't yet have an array
setup to store multiple records (the CD object is intended for that)
or any wiring for the buttons to add a record (Add Song), remove the
selected record (Remove Song) and save the entire database to a file
(Save Songs). I'm looking for hints on how to do this in the most
easily understandable English-like way (not necessarily the most
programmer-elegant way).
Curiosity: The variables I use, CDName, Song and Style, are picked
up by the fields but not the list.
The "list" face currently does not allow selecting of a record.
Hope I'm using the REBOL jargon correctly. Again, I'm very new to
REBOL but am really excited by what REBOL might allow me to do. This
first project is just to get my feet wet.
Thanks for any and all comments! :^)
Cheers,
-Jamie