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

World: r3wp

[View] discuss view related issues

DideC
8-Nov-2005
[3145]
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
[3151x2]
I threw the code out. It's been replaced by the standard LIST function 
in layout
it was way too memory hungry and the code was about 800 lines. it 
also took about 25 lines to initialize one list.
Geomol
9-Nov-2005
[3153x2]
That's the spirit! Only use the past to learn from. If use've made 
bad decisions, change them the second you realize, they're wrong. 
Cut the crap and throw out the garbage.
We're real rebels! ;-)
Or as Carl put it in the "Tech News" group on the 19-Sep: 

I say: Push forward and ignore the noise, recruit newbies, use the 
great ideas, dump the rest.
Anton
9-Nov-2005
[3155]
Gosh. Was the old code an attempt at direct pane programming ? Is 
the standard LIST performing ok ?
Henrik
9-Nov-2005
[3156x3]
The standard list has a few problems, notably in that you are forced 
to update the entire listview, when you want to refresh a single 
entry. That makes it slow for mouseovers.


The old code was much faster at scrolling and doing mouse overs as 
I could have full control over which part of the list I wanted to 
show, but everything was done manually, but it was not direct pane 
programming.
but the standard list is very elegantly done and allows you to have 
a simple iteration function. It's a bit too simple, but then again 
I can't find proper docs on doing LIST with SUPPLY
(but I seem to be using the word 'but' a lot)
james_nak
10-Nov-2005
[3159]
All, FYI, I found out my "save" problem was not setting my words 
to "[]" before a load. SAving was working...the viewing was not! 
When will I remember that little thing about Rebol.
Henrik
11-Nov-2005
[3160]
I'm trying to make a button behave like a text field, but I can't 
make it work.


view layout [b: button "Hello" with [flags: [field input return text]]]

what's missing?
Volker
11-Nov-2005
[3161]
the right feel?
Henrik
11-Nov-2005
[3162]
could be...
Geomol
11-Nov-2005
[3163]
Try:
layout [f: field "Hello"]
probe f/feel
Henrik
11-Nov-2005
[3164]
volker, geomol, thanks! it was correct
Graham
14-Nov-2005
[3165x2]
I've been playing around with Frank's paint.r in the library.  I 
implemented a free hand draw tool but found that a simple line or 
circle takes about 32k of draw instructions :(
I wonder if there's a more efficient way to do this than combining 
lots of line draws together?
Ashley
14-Nov-2005
[3167]
It's a simple problem of polling frequency. Try changing the code 
so that a new point is not placed unless it is more than (say) 4x4 
away from the previous point.
Anton
14-Nov-2005
[3168x3]
I see. I noticed also that the DRAW function adds
	PEN pen-col FILL-PEN fill-col LINE start offset
for every new point, when what is necessary is only new offsets.
I suggest to add an OLD-TYPE variable, and put something like this 
in the DRAW function:
	either all [type = 'free-hand type <> old-type][
		; add all the initialising stuff (PEN FILL-PEN, LINE start)
	][
		; otherwise compose in nothing
	]
So when you change from circle to free-hand, DRAW adds the initialising 
draw commands, but after that, just adds an offset.

Ooops, I should have checked for type = old-type so we can add the 
single offset. Anyway, you get the idea. Just move that condition 
inside the either true block.
Henrik
15-Nov-2005
[3171]
hmm... how do I set the default entry in a CHOICE at layout time? 
I wanted to do something like this:

view layout [choice "1" "2" "3" with [data: next face/data]]
RobertDumond
15-Nov-2005
[3172x4]
hallo, alls... i have a question regarding view events...  i am testing 
using the following code, which creates two text fields, one of which 
only accepts numerical input...
view/new layout [
    the-field: field feel [
        engage: func [face action event] [
        	if action = 'key [
			if all [ greater? (to-integer event/key) 47
				 lesser? (to-integer event/key) 58 ] [
				 append face/text event/key 
				 show face 
			]
		]    
        ]
    ]
    new-field: field
]
focus the-field
do-events
first question, is how can i get the first text field to accept mouse 
click events?  how then do i get it to recognize the tab key to switch 
focus to the next field?
also, can i update the position of the text curser in the number 
field so that it is the current position being typed at? (bad wording, 
i know... )
Henrik
15-Nov-2005
[3176]
robert, what happens in the above code is that you replace the original 
feel functions with one ENGAGE function. that's why you loose normal 
field functionality
RobertDumond
15-Nov-2005
[3177]
is there an alternate way i should be doing this?
Henrik
15-Nov-2005
[3178x4]
you need to copy in the original feel from a generic field face into 
your new field along and then add your code to its existing engage 
function
it's a bit of a hassle...
try:

probe get in new-field/feel 'engage

that's the original code
that's the code you need to alter...
RobertDumond
15-Nov-2005
[3182]
thank you, i will try that
Henrik
15-Nov-2005
[3183x2]
you can copy it out into a separate function, which could be called 
ENGAGE-FUNC and make you alterations.


then you can initialize a normal field with a new ENGAGE function 
in your layout:

the-field: field with [feel/engage: :engage-func]
this will leave the remaining feel functions untouched
Geomol
15-Nov-2005
[3185x3]
Henrik, your choice problem. I think, you have to redefine choice. 
The problem is in the multi/text function. You can do it at layout 
time this way:

view layout/size [choice "1" "2" "3" with [multi/text: func [face 
blk] [if pick blk 1 [face/texts: copy blk]] text: "2"]] 400x400
It's better to make your own choice with your own multi/text function.
using styles for example.
Henrik
15-Nov-2005
[3188]
thanks, I'll give it a try...
Volker
15-Nov-2005
[3189]
http://polly.rebol.it/test/test/extend-engage.r
Graham
15-Nov-2005
[3190x3]
I want to save my draw commands to a text database field.
is this the only way

form compress mold data  ?
the question really is, is there a native way to compress blocks 
as a string value ( for saving into a text field )
Volker
15-Nov-2005
[3193]
by molding them
Graham
15-Nov-2005
[3194]
does molding save space though?