Layout
[1/14] from: obiwanbuz:yah:oo at: 20-Sep-2002 20:56
Hello,
I recently started with REBOL, and I try to use defined layout into layout. I read from
the VID documentation that it is possible, unless I miss-understood.
Please if any body can help I would be very happy.
cheers
Bertrand
[2/14] from: carl:cybercraft at: 21-Sep-2002 8:44
On 21-Sep-02, B-E-P wrote:
> Hello,
> I recently started with REBOL, and I try to use defined layout into
> layout. I read from the VID documentation that it is possible,
> unless I miss-understood. Please if any body can help I would be
> very happy.
Hi Bertrand,
I think this how-to would be the best answer to your question...
http://www.rebol.com/how-to/subpanels.html
If it's not what you're after, do ask again - you'll most certainly
get an answer. This is a very helpful list.
There's also "real" panels. Meaning, VID has a 'panel word, but I
know of no description of how it should be used. Yes, that's a
question for this very helpful list. (;
--
Carl Read
[3/14] from: obiwanbuz:y:ahoo at: 20-Sep-2002 22:44
Hello,
please forget that question, I found the answer in the How-to document.
Cheers
----- Original Message -----
From: "B-E-P" <[obiwanbuz--yahoo--fr]>
To: <[rebol-list--rebol--com]>
Sent: Friday, September 20, 2002 8:56 PM
Subject: [REBOL] Layout
> Hello,
>
> I recently started with REBOL, and I try to use defined layout into
layout. I read from the VID documentation that it is possible, unless I
miss-understood.
[4/14] from: obiwanbuz:yaho:o at: 20-Sep-2002 23:28
Thanks for your answer Carl,
I had a look to http://www.rebol.com/how-to/subpanels.html but it's only a
part of my answer.
In fact I want to dynamically add a text followed by a box to a panel for
each new entry to a Personal Information Manager. I was thinking that I
could define a layout with these faces, and insert it to my main panel.
Maybe there is a different way to do it, I don't know.
so please au-secours!!! :-)
Bertrand Pivaty
[5/14] from: gscottjones:mchsi at: 20-Sep-2002 17:18
From: "B-E-P"
> Thanks for your answer Carl,
> I had a look to
<<quoted lines omitted: 7>>
> Maybe there is a different way to do it, I don't know.
> so please au-secours!!! :-)
Hi, Bertrand,
I am not sure that I know exactly what you are looking for, but maybe it is
somewhere in this example.
data: ["Scott" "123 Main" "Carl" "456 Maple" "Bertrand" "789 Oak"]
lo-func: func [] [
layout [
origin 0x0
text data/1
area data/2
]
]
lo: layout [
origin 10x10
b: box 200x200
button "Previous" [
if not head? data [
data: skip data -2
b/pane: lo-func
show b
]
]
button "Next" [
if not tail? data: skip data 2 [
b/pane: lo-func
show b
]
]
do [b/pane: lo-func]
]
view lo
--Scott Jones
[6/14] from: obiwanbuz:y:ahoo at: 21-Sep-2002 10:01
First of all I want to congratulate this list as it works very well.
I had a look to Graham Chiu about radio button, and his answer and Scott are
very close to what I am looking for.
Scott I am happy with your answer, as I learnt more about View, but I don't
want to see items replacing the previous one, I would like it to be added as
a suplementary face into a layout.
To be more precise, say I want to implement an outliner, (you know like the
one in microsoft word), if I want to insert a sub-item, it has to be
displayed below its parent and shiftted to right.
That' s the point.
Cheers
Bertrand
[7/14] from: info:id-net:ch at: 21-Sep-2002 12:36
I wrote an article on Rebolfrance about dynamically creating a layout. You
could use it too, as I know you're a french guy, too.
[8/14] from: obiwanbuz:ya:hoo at: 21-Sep-2002 15:10
Thanks Philippe, it is a good article, this is more or less the the way I
tried to fix my problem.
But it is still not what I whant. May be I should ask the following
question:
Is it possible to add new face into a layout which is already displayed ?
The following lines (from Philippe Oehler) is a good example of dynamically
generating layout in one go, but it is done
before the block is actually transformed as a layout. I want to do it after
the block is drawn on the screen.
Is it possible ?
rebol []
fen: [backdrop 212.212.212]
for e 1 10 1 [append fen reduce compose/deep ['button (join "Hello " e)
[print (join "Salut " e)]]]
fen: layout fen
view fen
[9/14] from: gscottjones:mchsi at: 21-Sep-2002 8:30
From: "Bertrand"
> First of all I want to congratulate this list
> as it works very well. I had a look to
<<quoted lines omitted: 11>>
> it has to be displayed below its parent and
> shiftted to right. That' s the point.
Hi, Bertrand,
Unfortunately (or perhaps fortunately ;-), I am not familiar with Microsoft
Word, but I certainly understand the concept.
This is *not* pretty, but I believe that it demonstrates the concept of
adding to a layout after it has been laid out. Hopefully the concept show
through that one can add additional "subfaces" to the pane of a face. This
example shows a quick and dirty approach, but I am sure that you would want
to add better text management, do some refactoring and make it more generic.
svv: system/view/vid
data: [
"Scott" "123 Main"
"Carl" "456 Maple"
"Bertrand" "789 Oak"
]
lo-func: func [txt-str] [
new-pane: make select svv/vid-styles 'text [
text: txt-str
color: 142.128.110
size: 200x200
]
if not empty? b/pane [
pane-count: length? b/pane
new-pane/offset: b/pane/:pane-count/offset + 0x34
]
new-pane
]
lo: layout [
origin 10x10
b: box 200x200
button "Add Info" [
my-text: rejoin [data/1 "^/^-" data/2]
next-pane: lo-func my-text
append b/pane next-pane
show b
data: skip data 2
if tail? data [data: head data]
]
do [b/pane: copy []]
]
view lo
;##############
Please let me know how it works and if this is closer to that which you seek
and if you need further comments to explain the functionality.
--Scott Jones
[10/14] from: rotenca:telvia:it at: 21-Sep-2002 16:28
Hi,
> Is it possible to add new face into a layout which is already displayed ?
>
> The following lines (from Philippe Oehler) is a good example of dynamically
> generating layout in one go, but it is done
> before the block is actually transformed as a layout. I want to do it after
> the block is drawn on the screen.
> Is it possible ?
Yes. Attention to line break.
view layout [
size 200x400
button "add button" [
for e 1 10 1 [
insert tail face/parent-face/pane make-face/offset/spec 'button
20x30 + (0x20 * e) [
text: join "button-" e
]
]
show face/parent-face
]
]
---
Ciao
Romano
[11/14] from: info:id-net:ch at: 21-Sep-2002 15:33
The way i use is to place different boxes, in my first layout.. Those boxes
could have 0x0 offset and 1x1 size. (i.e boxA) Each one them could have a
content
when you want, even when the first layout object is done and shown. The
content is another layout. You just has to
1) transform the [] into a layout
2) declare that the layout-number2 is boxA/pane
3) declare boxA/size: 200x200 i.e.
4) declare boxA/offset is 10x10
5) show boxA
All the procedures I used is in the article, too.
http://www.rebolfrance.org/articles/debutantvid/debutantvid.htm But I'm
sure there's other ways to do it.. I do that, because I have problems to
handle subpanels, access and refresh them.
[12/14] from: obiwanbuz::yahoo::fr at: 21-Sep-2002 16:53
Thanks to Scott, it is what I wanted to realize.
Of course some modifications are necessary, but it works.
But simply if you could tell me more about the following: <svv:
system/view/vid>
Also thanks to Philippe, I feel more confortable now with all that knowledge
to go a little bit further with REBOL.
Bertrand
[13/14] from: gscottjones:mchsi at: 21-Sep-2002 10:35
From: "Bertrand"
> But simply if you could tell me
> more about the following: <svv: system/view/vid>
Hi, Bertrand,
Some of REBOL itself is written in code that is platform specific, and these
parts are referred to as native. A surprising amount of REBOL is coded in
REBOL. The first level of this code is also called the mezzanine. One can
get at this level through the path word 'system. Warning: it makes calls
itself, and used to lock up when probed with "probe system". The recursion
is limited now for probe, but the code is long, so it is usually more
helpful to look at sections as needed.
>> probe first system
[self version build product components words
license options user script console ports network
schemes error standard view stats locale user-license]
>> probe first system/view
[self screen-face focal-face caret highlight-start
highlight-end title-size resize-border no-resize-border
line-info VID event-port debug pop-face pop-list
wake-event window-feel]
>> probe first system/view/vid
[self verbose warn word-limits vid-feel icon-image
radio.bmp radio-on.bmp vid-colors vid-face
state-flags vid-words vid-styles track error
warning facet-words fw-with fw-feel spot expand-specs
grow-facets do-facets next-tab choice-face set-edge]
So one can work ones way through the path refinements to get to sections of
the source code. svv was assigned to this path to merely keep the code from
wrapping. vid-styles is a block that contains all the vid styles found in
VID. I merely used a select to get to the face template for text.
There are other ways to make faces, and in fact Romano shows another way in
an earlier submission.
TIMTOWTDI There is more than one way to do it" (Thanks, Larry Wall)
There are benefits to some over others, and I don't pretend to be an expert
to know in which situations where one is better than another.
As a final note about the REBOL system, one can get the source code for
mezzanine-level or higher functions using source.
>> source source
source: func [
"Prints the source code for a word."
'word [word!]
][
prin join word ": "
if not value? word [print "undefined" exit]
either any [native? get word op? get word action? get word] [
print ["native" mold third get word]
] [print mold get word]
]
If you do source on the function that Romano uses, make-face, you will see
that at one point it gets a base style by using get-style which ends up
doing essentially what I did. 'make-face is a more complete and generic
wrapper around what I did manually.
I hope this submission makes sense. And, by the way, reading the system
source is great way to learn some great tricks from the masters: the RT
folks themselves! On a freshly started REBOL console, paste the following
and *be patient*:
echo %//windows/desktop/system.txt
probe system
quit
Then puruse system.txt to your hearts content.
--Scott Jones
[14/14] from: greggirwin:mindspring at: 21-Sep-2002 9:48
Hi Bertrand,
<< But simply if you could tell me more about the following: <svv:
system/view/vid> >>
svv is defined as a shortcut to system/view/vid, to save typing. There are a
couple others as well.
>> same? :svv :system/view/vid
== true
>> same? :svvc :system/view/vid/vid-colors
== true
>> same? :svvf :system/view/vid/vid-feel
== true
--Gregg
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted