[ALLY] Redrawn Out
[1/6] from: mike::myers::cybarite::com at: 5-Jan-2001 17:25
Redrawn Out
I am trying to bind some interacters especially txt display values to an object that
I used to collect the user input
user-input: make object! [
first-name: none
last-name: none
date-of-birth: none ; and so on
]
so when I get these from the interacters on input, I can hold them and use them in the
application flow.
At the end of the data collection, I want to display the values in a verfication screen.
Each field can be moved and refreshed individually. The old View document suggests that
the right way to do this is to fire the redraw function e.g.
return txt "First Name"
tab txt with [
feel: make feel [
redraw: func [face [object!] action [word!] offset [pair!]][
text: user-input/first-name]
]
]
But after doing a few of these, the tedium and amount of keying makes me think this is
not what was intended given that all I want to do is pass one value to the definition
(here "user-input/first-name").
I can create a style that will look at the texts following the txt definition and use
that.
Did anyone work their way through this and come out the other side with something else?
Am I missing something in the /View architecture?
[2/6] from: carl:pacific at: 6-Jan-2001 9:24
Hi Mike,
I don't like thinking about how old those docs are, or in fact how old view
is compared
to what we run these days in Link.
If I understand correctly, you want to display the object field in a window.
Yes, this
is very easy to do in View:
view layout [
across
h2 "User Input:"
return
txt 80 "First Name"
txt 160 user-input/first-name
return
txt 80 "Last Name"
txt 160 user-input/last-name
return
...
]
Here's a tip that you will want to remember: If the field is a number,
date, time, or
any non-string, put a FORM in front of it.
txt 80 "Age"
txt 40 form user-input/age
That converts it to a string, allowing it to be shown.
Other suggestions:
You may want to show the fields within boxes:
txt 80 "First Name"
txt 160 user-input/first-name black silver
The first color is the text, the second is the text box. Helps it stand
out.
Since most of your txt fields will have the same settings, you can make a
style to cut down on typing:
style tx txt 80
style tr txt 160 black silver
tx "User-Input"
tr user-input/first-name
return
Now you change that first style to something like:
style tx txt 80 right
And that will right-justify your field labels. Some people think that looks
better.
Have fun,
-Carl
----- Original Message -----
From: <[mike--myers--cybarite--com]>
To: <[ally-list--rebol--com]>
Sent: Friday, January 05, 2001 2:25 PM
Subject: [ALLY] Redrawn Out
> Redrawn Out
>
> I am trying to bind some interacters especially txt display values to an
object that I used to collect the user input
> user-input: make object! [
> first-name: none
> last-name: none
> date-of-birth: none ; and so on
> ]
>
> so when I get these from the interacters on input, I can hold them and use
them in the application flow.
> At the end of the data collection, I want to display the values in a
verfication screen.
> Each field can be moved and refreshed individually. The old View document
suggests that the right way to do this is to fire the redraw function e.g.
> return txt "First Name"
> tab txt with [
<<quoted lines omitted: 4>>
> ]
> But after doing a few of these, the tedium and amount of keying makes me
think this is not what was intended given that all I want to do is pass one
value to the definition (here "user-input/first-name").
[3/6] from: mike:myers:cybarite at: 7-Jan-2001 9:05
1/6/01 9:24:03 AM, "Carl Sassenrath" <[carl--pacific--net]> wrote:
>Hi Mike,
>I don't like thinking about how old those docs are, or in fact how old view
<<quoted lines omitted: 15>>
> ...
>]
Hi Carl,
Thanks for taking this time to respond.
My question is not on the display basics. I think the basics are there in the easyvid.r
examples. And fortunately, I am
past that level now. And I think the use of styles is one of the key leverage points
in View. Super job!
My question is avoiding the work to refresh values on the view-able portion.
Here is the reference from the old View documentation:
The redraw function is called immediately before a face is displayed. This allows a face
to dynamically alter any of its facets prior to being displayed. This
is how screen interacters (buttons, choices, etc.) reflect their current state to the
user. For example, a button might be displayed as either up or down
depending on the state of a variable that has been set. The redraw variable should be
set to none if no function is needed. This speeds up the interface
by not calling needless functions.
If I hold values in memory in an object or store them to a database or change them in
other faces, then when
I want to display them, I want the current / correct value to be displayed.
If I understand correctly ... which is not a given ... because layout is a layout tool,
then the user interface is defined once.
Changing the value held in the model (the object) does not change the values in the view.
The /View examples that I have seen have been using a "Passive Model" as noted in the
Model-View-Controller notes that I reference.
See : http://burks.bton.ac.uk/burks/language/smaltalk/mvc.htm
Without some /View support, I would have to know before viewing a face that I have to
refresh the display values in that view
from those held in the model. Aside from the tedious error prone nature of this, it
seems fundamentally flawed as an approach.
I concluded that this is not what was intended in the /View architecture. And the old
/View documentation seemed to support this
as noted in the clip from the redraw section of the View html documentation.
The MVC documentation refers to an approach called DependentFields which, as far as I
know, does not have a parallel in /View.
My question then with this background is whether REBOL/View or REBOL/Link provides a
parallel to this DependentFields approach.
If not is it planned or is there a workable solution to implement aside from the custom
style approach that I proposed i.e.
bound-Faces: stylize [
bound-txt: txt with [
append feel/redraw [texts/1] ; I haven't tried this yet .... it is trying to use
the first text argument to the interacter as code.
]
Then I coud use :
view layout [across
tab txt "First Name: " bound-txt "text: myObject/name-first"
return tab txt "Last Name: " bound-txt "text: myObject/name-last"
] ; when these displays are re-drawn they will always display the value held in assigned
object values.
but this is not an "A" grade solution.
[mike--myers--cybarite--com]
[4/6] from: mike:myers:cybarite at: 7-Jan-2001 9:05
>>Carl S wrote:
>> Hi Mike, I don't like thinking about how old those docs are, or in fact how old view
>> is compared to what we run these days in Link.
ouch! I am running /View that expires 27-Jan-2001/13:39:03-8:00
Do we need to get more frequent refreshs?
And there is not much explanation on the REBOL.com site about Link.
I know you like a challenge so ..... can you enlighten me?
[mike--myers--cybarite--com]
[5/6] from: g:santilli:tiscalinet:it at: 7-Jan-2001 18:05
Hello Mike!
On 07-Gen-01, you wrote:
MM> If I understand correctly ... which is not a given ...
MM> because layout is a layout tool, then the user interface is
MM> defined once. Changing the value held in the model (the
MM> object) does not change the values in the view.
If you define your layout as:
view layout [
across
h2 "User Input:"
return
txt 80 "First Name"
fname-face: txt 160 user-input/first-name
return
txt 80 "Last Name"
lname-face: txt 160 user-input/last-name
return
; etc
]
Then you can update it with:
fname-face/text: new-first-name
lname-face/text: new-last-name
show [fname-face lname-face]
Notice the use of the SHOW native.
HTH,
Gabriele.
--
Gabriele Santilli <[giesse--writeme--com]> - Amigan - REBOL programmer
Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/
[6/6] from: carl:pacific at: 7-Jan-2001 22:02
Ah, ok Mike... sorry for the intro stuff. Did not know what level you were
at. I'm not quite sure what you need... so let me know if this is it:
The "connection" between a model and a view is done one of two ways in View:
name the face (assign its object to a variable) or handle with it within the
pane list for its super-face. The former is easier, you provide a variable
set immediately before the face definition:
first-name: fld
Then, later you reference first-name with:
first-name/text: "new value"
show first-name
WRT Smalltalk MVC, I need to refresh my knowledge of dependent-fields...
been too long (1981-1986), although I still hear Dan Ingalls words about MVC
dependencies echoing in my head (he and most of the Smalltalk crew were in
my group at Apple). But, memory fades....
And, just to mention it, VID is only one of many styles of GUI dialects that
can be put onto REBOL. A dynamic model is possible... (so get busy coding!)
-Carl
----- Original Message -----
From: Mike Myers <[mike--myers--cybarite--com]>
To: <[ally-list--rebol--com]>
Sent: Sunday, January 07, 2001 6:05 AM
Subject: [ALLY] Re: Redrawn Out
> 1/6/01 9:24:03 AM, "Carl Sassenrath" <[carl--pacific--net]> wrote:
>
> >Hi Mike,
> >
> >I don't like thinking about how old those docs are, or in fact how old
view
> >is compared
> >to what we run these days in Link.
> >
> >If I understand correctly, you want to display the object field in a
window.
> >Yes, this
> >is very easy to do in View:
<<quoted lines omitted: 14>>
> Thanks for taking this time to respond.
> My question is not on the display basics. I think the basics are there in
the easyvid.r examples. And fortunately, I am
> past that level now. And I think the use of styles is one of the key
leverage points in View. Super job!
> My question is avoiding the work to refresh values on the view-able
portion.
> Here is the reference from the old View documentation:
>
> "The redraw function is called immediately before a face is displayed.
This allows a face to dynamically alter any of its facets prior to being
displayed. This
> is how screen interacters (buttons, choices, etc.) reflect their current
state to the user. For example, a button might be displayed as either up or
down
> depending on the state of a variable that has been set. The redraw
variable should be set to none if no function is needed. This speeds up the
interface
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted