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

World: r3wp

[I'm new] Ask any question, and a helpful person will try to answer.

SteveT
12-Jan-2008
[962]
Perspectives of a newbie! By Steve Thornton (SteveT) 


In your first steps in using REBOL (If your like me) you'll go and 
have a look

at other peoples scripts - luckily the REBOL Viewtop is full of them. 


One thing that stumped me to begin with was that each developer differed

slightly in how they setup their 'Layout' or 'Views' this is because 
there is

a degree of flexibility that covers different situations. You can 
call a view 

and a layout all in one go, or you can make a layout seperately and 
then call 

it when executing the view. While I quickly understood this, I like 
to follow 

'best practice' when creating the initial framework of my application.


It would be a great help if a diagram was available showing where 
to place 

things. For example I went wrong by trying to place view options/effects 

inside the layout structure, When you look at some of the one/two 
line examples
it looks as if you can do that.

Steve
Brock
12-Jan-2008
[963x2]
Steve, another insightful post.  I'm far from an expert but have 
been around the Rebol world for a while, mostly in lurk mode.  The 
reason that I am aware of for generating a layout prior to calling 
a view, is so you can dynamically build the layout.  Then, once all 
of the logic has constructed your dynamic layout, you view the entire 
peice together.
Maybe the advanced developers here have other reasons for this as 
well.
SteveT
12-Jan-2008
[965x2]
Hi Brock,  yes I think it boils down to some devs using VID and some 
using Faces and some even using a mix of both objects. Which according 
to the guide theres nothing wrong with !! But it's confusing for 
the newbs lol
Sorry I meant the View system - not Faces!!! See confused already 
lol
Graham
12-Jan-2008
[967]
If you don't build the layout first, then you can't write functions 
that access the named widgets inside the layout.
SteveT
12-Jan-2008
[968x2]
Hi Graham, some dems say - main: layout [ .....   where other use 
main: make [...... would you usuall use make ??
sorry main: make layout [.....
Graham
12-Jan-2008
[970]
I don't think I've ever used "make layout"
SteveT
12-Jan-2008
[971x2]
I've not used it in the main screen of my app and it works fine, 
just wondered if theres a reason to use it?
Think they use it to 'make face' when using the view system directly
Michael
12-Jan-2008
[973x2]
Will, continuing from misplaced Tretbase thread...
Still not working...relations endure only so long as I don't end 
the engine's session.
Will
12-Jan-2008
[975]
Michael: notice the difference between mold and mold/all :
>> a: context [b: 1]

>> a/b
== 1

>> c: mold a

== "make object! [^/    b: 1^/]"

>> a: load c

== [make object! [
        b: 1
    ]
]

>> a/b
** Script Error: Invalid path value: b

** Near: a/b
>> a: do load c

>> a/b         
== 1

>> a: context [b: 1]
>> c: mold/all a
== "#[object! [^/    b: 1^/]]"
>> a: load c
>> a/b
== 1
>>
Michael
12-Jan-2008
[976]
So, if I understand, the difference between mold and mold/all comes 
down whether I want to use the variables locally or or globally. 
But, in any event I need to use mold to preserve the object as a 
retrievable file? Is that correct?
Will
12-Jan-2008
[977x2]
home% rebol
>> do http://www.hmkdesign.dk/rebol/relationsengine/relations.r

>> add-relation [a 1 b 2]

== true
>> get-relation [a 1 b]
== [2]

>> save/all %relations.data relations
>> quit


home% rebol 

>> do http://www.hmkdesign.dk/rebol/relationsengine/relations.r
>> relations: load %relations.data
>> get-relation [a 1 b]

== [2]

>>
works!
read here for more info on the subject:
http://www.rebol.com/docs/changes.html#section-5.1
Michael
12-Jan-2008
[979]
Ah, OK, that works for me too. Perhaps it was the code I was using 
to "look" at the data--

look: does[
    foreach word next first relations[
        print rejoin [word ":" newline get in relations word]
    ]
]


I will read the section you recommend. Thanks for your patience and 
help.
Will
13-Jan-2008
[980]
this also is very good reading:
http://www.fm.tul.cz/~ladislav/rebol/contexts.html
Michael
13-Jan-2008
[981]
Thanks. I was just about to say that I can see now that it was the 
code I was using to imput the relations en masse that was causing 
my "look" code to not work. Amazing how talking things out can put 
things into perspective. Thanks again.
Will
13-Jan-2008
[982]
have fun 8) me going to zzz..
Henrik
13-Jan-2008
[983]
SteveT, using faces directly with MAKE is a lower level approach 
than LAYOUT. What LAYOUT does, is produce a face object that consists 
of many subfaces from your layout description written in the VID 
dialect. Each one of these face objects have settings for size, offset, 
appearance, text content, etc, which are set as the layout description 
is parsed. Using MAKE FACE directly provides greater control, but 
is more cumbersome to use, because you have to set all these values 
manually and arrange the face tree manually. You can see the content 
of the base FACE object in the console with:

>> ? face


The FACE object is the only object ever used, so it's a good idea 
to get to know it. You can extend it with more values and VID does 
this, to create variants, modes and extra operations on a face, like 
SET-FACE, GET-FACE, etc.


The reason why many choose to skip VID for this, is that VID doesn't 
provide the level of control needed as some things can't be determined 
properly at layout time, such as interdependency of sizes or offsets 
between faces, which is why VID doesn't support easy resizing out 
of the box.


Oh and when you get to try VID3 in REBOL3, forget everything I said, 
because it's a whole different system. :-)
SteveT
13-Jan-2008
[984x2]
Hi Henrik, thanks for that explanation.
main: layout [
        vh2 "Subpanel Examples"
        guide
        pad 20
        button "Panel 1" [panels/pane: panel1  show panels]
        button "Panel 2" [panels/pane: panel2  show panels]
        button "Quit" [quit]
        return
        box 2x140 maroon
        return
        panels: box 220x140 coal
    ]


Hi all, what does guide do above - I can't find it in the Dictionary
Henrik
13-Jan-2008
[986]
guide = "remember this cursor position"
SteveT
13-Jan-2008
[987]
Thanks again  Henrik
Henrik
13-Jan-2008
[988x2]
this means here, that it will affect how far to the left 'return 
will put the layout cursor
you can also use it like this:


view layout [button "hello" here: guide button "test" at here btn 
"boo!"]
SteveT
13-Jan-2008
[990]
Right so when you do return it will be kind of indented - Is it me 
or is guide not in the docs ???
Henrik
13-Jan-2008
[991]
it should be in the docs. which page are you reading?
SteveT
13-Jan-2008
[992]
I'm looking at the REBOL Dictionary
Henrik
13-Jan-2008
[993x3]
http://www.rebol.com/docs/view-system.html<--- for low level View, 
by the way
The dictionary doesn't contain dialected words, unfortunately
http://www.rebol.com/docs/easy-vid.html<-- this is an older, but 
fairly useful doc.
SteveT
13-Jan-2008
[996x2]
Yep - I read the View-System manual last night
what are dialected words ?
Henrik
13-Jan-2008
[998x3]
any words in a dialect
so you won't find BUTTON or GUIDE in the regular manual as they belong 
in the VID domain.
this is one of the major gripes about VID: I don't think there is 
one complete reference. Much of the information is either too old 
or dug up by probing inside SYSTEM/VIEW/VID to see what words are 
available in there.
SteveT
13-Jan-2008
[1001]
Oh! right and VID could be replaced by rebGUI or whatever
Henrik
13-Jan-2008
[1002]
yes, or your own dialect.
SteveT
13-Jan-2008
[1003]
Pennies dropped !! Thanks Henrik
Henrik
13-Jan-2008
[1004]
let me ask, do you know what a dialect is? If you know, then I think 
you know what I mean with language domains.
SteveT
13-Jan-2008
[1005x2]
Only form the context I've read in the introductory docs
from
Henrik
13-Jan-2008
[1007x2]
ok
Fun fact: VID was developed by Carl in about a week. It shows. :-)
SteveT
13-Jan-2008
[1009x2]
It may have it's faults! but when you've developed things with abstraction 
in mind your on the right footing to fix whatevers wrong
Your list-view for example - in hind-site you say it's big and bulk 
and could be done better - but the Grids and Tables that Microsoft 
and Java dish out can't come near to matching what yours provides 
out-of the-box
Henrik
13-Jan-2008
[1011]
I'm just glad that we'll be able to get rid of all the flaws with 
VID3. Tha's why I'm motivated for still teaching it.