[REBOL] RFC: Forms generator / RAD dialect
From: robert:muench:robertmuench at: 20-Aug-2002 19:16
Hi, most applications share a few very basic concepts:
- You have a set of business objects
- You want to edit business objects
- You want to store / load business objects
- You want to reference business objects from other business objects
IMO this functionality is needed in 90% of all applications. At least
for thos applications handling some data stuff and that normal people
would implement using a RDBMS. Well, I don't want to use a RDBMS I want
to use Rebol. But I hate repetitive tasks, especially creating very
basic GUI forms. So why not use Rebol for this?
Thing like this shouldn't be written by hand:
lab "Company" company: fld return
lab "Contact" contact: fld return
lab "Title" titl: fld return
lab "Phone" dial work: fld return
lab "Email" [mailto email/text] email: fld return
lab "Web" [brws web/text] web: fld return
lab "Address" smail: ari 200x40 return
lab "Alt Phone" dial cphone: fld return
lab "Info" info: ari 200x72 return
lab "Notes" view-notes notes: ari 200x72 return
lab "URL 1" [brws url1/text] url1: fld return
lab "URL 2" [brws url2/text] url2: fld return
lab "Updated" updat: inf 200x20 return
Instead I'm thinking about a dialect to specify such a section. And one
nice side effect would be that the dialect can be written by users not
familiar with Rebol. How about this?
address!: [
; Name Text Type Action
company "" field
streams "" field [unfocus
update-list focus read-list]
description "" field
cln-id "Customer" field [read-only]
...
]
Now we need a GUI form generator that gets such an input block and
creates a layout block for us. The result should be something like this:
lab "Company" company: fld return
lab "Streams" streams: fld [update-list] return
lab "Description" description: fld return
lab "Customer" cln-id: info return
Did anybody started something like this already? What do you think?
Anyone interested in working on such a thing? IMO it would help us a lot
to have such a RAD dialect for classical database applications.
Here is a very basic prototype of the idea:
rad-styles: stylize [
lab: text 90x20 right bold middle font-size 11
btn: btn 64
tgl: btn 64
fld: field 200x20 font-size 11 middle edge [size: 1x1]
inf: info font-size 11 middle edge [size: 1x1]
ari: field wrap font-size 11 edge [size: 1x1] with [flags:
[field tabbed]]
]
project!: [
; Name Text Type Action
id
streams
description
cln-id
cln-prj-id
date-start
date-end
]
output: [
styles rad-styles
across
]
generator: [
some [
set field word! (
repend output ['lab to-string field to-set-word
field 'fld 'return]
)
]
]
parse project! generator
?? output
view layout output
Robert