r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[View] discuss view related issues

Graham
7-Nov-2005
[3102]
what is a money field ??
Louis
7-Nov-2005
[3103]
Holds money ( for example $1.00), not a string.
Graham
7-Nov-2005
[3104]
fields only hold text strings.  so, you are doing it already.
Louis
7-Nov-2005
[3105]
Ok. Thanks! I had forgotten that.
Graham
7-Nov-2005
[3106]
Thank Socrates :)
Louis
7-Nov-2005
[3107x6]
Socrates wasn't a very good rebol programmer and could not have helped. 
Besides, he is dead and you are alive. At least I hope you're still 
alive since I still need more help.
refresh: func [/local amount total][ ;Anton's function
    total: 0
    foreach face out/pane [
        if face/style = 'monfld [ ; only money fields
            amount: any [attempt [to-money face/text] $0.00]
            if any [
                amount <> $0.00
                not empty? face/text
            ][
                face/text: form amount
            ]
            total: total + amount
        ]
    ]
    total-debits/text: form total
    show out ; updates all sub-faces at once
]
Hold on, more code to come.
style monfld field [refresh] 80x24
        style monfld2 field [refresh2] 80x24

        D0-amount: monfld 
        C0-amount: monfld2
the refresh2 function is just like refresh except 'monfld is replaced 
by 'monfld2
Now, how can D0-amount be copied into C0-amount automatically?
ICarii
7-Nov-2005
[3113x2]
you can use the feel / engage events to detect key presses and call 
an update function..
or do you mean at init?
Louis
7-Nov-2005
[3115x2]
I mean that upon manually enter a dollar amount into the D0-amount 
field I want the same amount automatically entered into the C0-amount 
field.
enter = entering
ICarii
7-Nov-2005
[3117x2]
use the feel/engage: func [f a e][if a = 'key [ ....]]
most people wait for the enter key then call an update to set the 
value in appropriate fields
Graham
7-Nov-2005
[3119x2]
I wouldn't use the style and just stick the function in the action 
block and do the copy there.
makes it too complicated, and then you don't remember what's going 
on.
ICarii
7-Nov-2005
[3121x2]
D0-amount: monfld feel [engage: func [f a e][if a = 'key [if e/key 
= #"^M" [Co-amount/text: f/text ....
i reall y should avoid shorthand :(
Graham
7-Nov-2005
[3123]
But James, most people tab out of a field :)
ICarii
7-Nov-2005
[3124x2]
lol
rebol/view is my refuge from the evils of Oracle and SQL Server development 
:)
Graham
7-Nov-2005
[3126x2]
what's the freebie oracle like?
Louis, I would add a refinement to the refresh function, which refers 
to a face.  And on that refinement, copy the data to the other face.
ICarii
7-Nov-2005
[3128]
dunno.. use 10g Enterprise at work... now if only view had some fast 
professional looking widgets to act as a front end.. :(
Louis
7-Nov-2005
[3129]
Graham, this sentence can have two meanings: "I wouldn't use the 
style and just stick the function in the action block and do the 
copy there." Would you please reword it?
Graham
7-Nov-2005
[3130x4]
perhaps that won't work.
Anyway, I don't use styles myself ... too lazy.
Anyway, ICarii's solution doesn't catch tabs ( you can add that ), 
and also clicking to get out of the field.
now that we have rebcode, are we going to see your editor reborn?
Louis
7-Nov-2005
[3134]
I think styles are necessary in this case.  I have two colums of 
field (a debit column and a credit column). As data is entered into 
a column it has to be added to a total field at the bottom.
Graham
7-Nov-2005
[3135]
Was it Terakahi or flounder or something...s
Louis
7-Nov-2005
[3136x2]
ICarii and Graham, I need an example. I don't know much about view.
ICarii, please replace "...." with the rest of what you had in mind.
DideC
8-Nov-2005
[3138x2]
As Graham Point out, its not good to use 'style facet because you 
can have several faces of the same style.

What you want is to "link" style together : this is the role of the 
'related facet.
You usually use it with check/radio/toggle to group them.
To specifie a group, you use the 'of keyword in VID :

 View layout [radio of 'one radio of 'one radio of 'two radio of 'two 
 radio of 'two]
So just change your refesh function to test the face/related facet 
instead of style.

This way you can have some fileds in the 'debit group and others 
in the 'credit group
Louis
8-Nov-2005
[3140]
DideC, thanks. I'll do some studying and see if I can figure out 
what you mean. Problem is that I haven't been getting to do much 
programming during this past year, and I have forgotten much of what 
litte I knew.  :>(
james_nak
8-Nov-2005
[3141]
When scaling an image, other than using the "effect: [aspect]", are 
there other controls for the anti-aliasing?
Henrik
8-Nov-2005
[3142]
AA scaling currently only works with DRAW, afaik
james_nak
8-Nov-2005
[3143]
Thanks. Now I need to check out Draw.
DideC
8-Nov-2005
[3144x2]
Louis: an example of what I say. I hope its what you need:
refresh: has [amount credit debit][
    debit: credit: 0
    foreach face out/pane [
        if find [credit debit] face/related [ ; only money fields
            amount: any [attempt [to-money face/text] $0.00]

            if any [amount <> $0.00  not empty? face/text] [face/text: form amount]
            if face/related = 'credit [credit: credit + amount]
            if face/related = 'debit [debit: debit + amount]
        ]
    ]
    total-debits/text: form debit
    total-credits/text: form credit
    show out
]

view out: layout [
	style c-field field [refresh] of 'credit
	style d-field c-field of 'debit
	style lab text 200 bold
	across
	lab "Credit" lab "Debit" return
	c-field d-field return
	c-field d-field return
	c-field d-field return
	lab "Total credit" lab "Total debit" return
	total-credits: field total-debits: field
]
james_nak
8-Nov-2005
[3146]
Henrik, the answer was to use Draw as it really accomplishes what 
I originally wanted.
 Thanks.
Louis
8-Nov-2005
[3147]
DideC, many many thanks.  I try that and let you know how it works. 
 It may be a day or so, however, as I am traveling in a motorhome, 
and don't always have internet access.  Again thanks!
james_nak
9-Nov-2005
[3148]
Has anyone run into a problem with "save" as in save/png where it 
sometimes doesn't want to overwrite a file? THe old file contents 
(in this case an image) is still there.
Geomol
9-Nov-2005
[3149]
James, I sometime have problems with cache, I think. Try closing 
your rebol window and then look at the saved file. Sometime I reboot 
my machine to be 100% sure. At most times, I have no problem, so 
I haven't investigated it.
Anton
9-Nov-2005
[3150]
Henrik, can you show us the code (or a cut down demo) of your list 
?
Henrik
9-Nov-2005
[3151]
I threw the code out. It's been replaced by the standard LIST function 
in layout