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

World: r3wp

[View] discuss view related issues

Ryan
15-Jan-2005
[252x2]
it does do some code interpetation, but just for generating a manifest 
for function libraries.
halfway there.
eFishAnt
15-Jan-2005
[254]
cool. Thanks for the ideas, I am going to go back and bang on it 
for the rest of the night...
Ryan
15-Jan-2005
[255]
same here, cya!
Terry
16-Jan-2005
[256]
Is there someway to do this.. 

X: [btn: "test" [print "test"]]

view layout [ X ]
Sunanda
16-Jan-2005
[257]
View layout X should work
(You probably don't want the colon on btn)
Terry
16-Jan-2005
[258]
>> x: [btn "quit"[]]
== [btn "quit" []]
>> view layout [x]
Unknown word or style: x
>>
Sunanda
16-Jan-2005
[259]
view layout x    -- x is already a block/.....No need to put in in 
another one.
Terry
16-Jan-2005
[260]
ok, but how can i form the X code and use it within a layout?
Sunanda
16-Jan-2005
[261]
I tend to dio something like:
 x: copy []
append x 'btn append x "quit"
Compose is useful here too for more complex layout building.
Terry
16-Jan-2005
[262x2]
That still doesnt get my bit of view code into the layout.
unless you're building the layout.. but I'm looking to add a word 
that represents some bit of view code.
Sunanda
16-Jan-2005
[264]
It's trickier if you've already usd layout to convert the dialect 
to VID objects -- then you need to read up on make-face and similar 
functions.
Pre build, just do things like:
x: [button "hi" [print "hello"]]
y: [button "bye" [print "goodbye"]]
z: []
append z y
append z x
view layout z
>>
Graham
16-Jan-2005
[265]
>> x: [ btn "quit" [] ]
== [btn "quit" []]
>> view layout do [ x ]
Terry
16-Jan-2005
[266]
I"m not just doing X, i might do Y and Z as well.
Graham
16-Jan-2005
[267]
but you didn't say that ...
Sunanda
16-Jan-2005
[268]
Terry, you probably need a lot of Composes in that case.

The Vid dialect has ti survive the Do's, so you may need to use more 
lit-words  {'button rather than button)
Terry
16-Jan-2005
[269]
this works

>> x: [quit]
== [quit]
>> view layout [btn x]
Sunanda
16-Jan-2005
[270]
You said you might need to Do it firstL
Try
 x: [quit]
 do x
to see the problem here if you do need to use do first.
Terry
16-Jan-2005
[271]
Hmm, i was just wondering if there is a way to use  'words to represent 
some vid code, be it a button, area... whatever.
Sunanda
16-Jan-2005
[272]
Yes -- but you need to append, compose or mold it to make it the 
right series of characters for Layout to understand.
Volker
16-Jan-2005
[273x2]
depends on what you are doing you can use panel:
 view layout[ panel x panel y .. ]
another way is to use styles. if you want a customized button.
Vincent
16-Jan-2005
[275]
just view layout compose [(x) (y) (z)]
Chris
16-Jan-2005
[276x4]
eFish -- note that Romano has a patch for the ctx-text object: http://www.rebol.it/~romano/#sect2.2.
 You could explore that too...
Terry, I'd suggest either 'compose or 'stylize (or 'stylize/master).
; You could set up a function or two to simplify this code:
my-styles: []
append my-styles stylize [x: btn "Quit" [quit]]
append my-styles stylize [y: btn "Print" [print 'foo]]
view layout [styles my-styles x y]
; For example -- to accumulate styles:
add-styles: func ['val spec /new /local blk][
   blk: [] if new [clear blk]
   append blk stylize head insert spec to-set-word val
]
; Usage:
my-styles: add-styles x [btn "Quit" [quit]]
Gregg
16-Jan-2005
[280]
Here's what I use for simple timers in layouts:

stylize/master [
    timer: sensor 1x1 rate 0:0:1 feel [
        engage: func [face action event] [
            if action = 'time [do-face face none]
        ]
    ]
]
eFishAnt
16-Jan-2005
[281]
aha, Chris thanks!  what I was looking for!
Ryan
16-Jan-2005
[282]
exactly what I needed to complete the undo code for my editor! Thanks 
Chris!
Terry
17-Jan-2005
[283]
Styles are the way to go.  I'm adding °styles° to the °7° system.. 
idea is to have a large collection of panes, buttons, fonts etc... 
all nicely categorized and available at anytime.  If you have some 
styles (or other code), drop it into the °7° group and I'll add it 
to the library.
james_nak
20-Jan-2005
[284]
Hello, I have an app that calls another app with a "do %..." The 
problem is that when I want to exit from the first app after closing 
the second, I am left at a command line as if I called the app from. 
Any one know how to do a double exit?
Sunanda
20-Jan-2005
[285]
Tried quit ?
james_nak
20-Jan-2005
[286]
Yes, I'm sorry, I use "quit."
Sunanda
20-Jan-2005
[287]
Hmmm, that should work....the 2nd app hasn't redefined quit has it?

(I often redefine it like this quit: :halt so I *can* get to a console 
when a large application quits)
james_nak
20-Jan-2005
[288x2]
Ah!! That was it. Sunanda, good thinking. Now I have to figure out 
how to keep it from quitting the 2nd app but that fixed that. Thanks!
Got it working fine. Thanks Sunanda.
Romano
21-Jan-2005
[290]
Chris, why don't you use stylize/styles?
Chris
21-Jan-2005
[291x3]
It didn't occur to me when composing the sample; though I assume 
you mean within the 'add-styles function?
; For example -- to accumulate styles:
add-styles: func ['val spec /new /local blk][
   blk: [] if new [clear blk]
   stylize/styles head insert spec to-set-word val blk
]
; Usage:
my-styles: add-styles x [btn "Quit" [quit]]
Hmm, that doesn't work -- I'd need to think about it...
Romano
21-Jan-2005
[294x2]
perhaps i do not understand what you want to do, but if the goal 
is building a growing set of styles, i think that this is the standard 
way:
x: stylize/styles [a: field] []
x: stylize/styles [b: field] x
view layout [styles x a "style a" b "style b"]
the first command could also be a more simple:
x: stylize [a: field]
Chris
21-Jan-2005
[296]
The idea is to take a word! and a block! and set the word! to a style 
created using the block! -- accumulating as desired.  I've implemented 
it as a wrapper for stylize...
Romano
21-Jan-2005
[297x2]
it is what stylize/styles already does, no?
only the word must be a set-word already in the block
Chris
21-Jan-2005
[299]
Yep.  That's what my function does -- puts the word in the block 
and uses stylize.
Romano
21-Jan-2005
[300]
ah, ok!
DideC
25-Jan-2005
[301]
Does one know what is the used of the 'text flag ?