[REBOL] Re: Examining the layout object
From: carl:cybercraft at: 2-Jul-2002 22:39
On 02-Jul-02, Joel Neely wrote:
> Hi, Carl,
> Carl Read wrote:
>> So, I've narrowed the error down to 'face being a function
>> sometimes, but while this...
>> print type? :face
>> gets round it for a word, I don't know how to do that for a
>> function in an object. ie, this doesn't work......
>> print type? :face/pane
>> pane still being evaluated.
>>> foo: make object! [
> [ a: 1
> [ b: 2
> [ c: func [] [a + b]
> [ ]
>>> print type? get in foo 'c
> function
> HTH!
Thanks Joel, it did. (And thanks to the others who replied too.)
Here's a working (at least for me) version of the layout examiner...
---8<---
REBOL []
examine-lo: func [face][
style: func [face][
if error? try [return join " Style: " face/style][""]
]
examine: function [face spaces][panes][
prin join spaces type? :face
if not object? :face [print "" exit]
print style :face
append spaces " "
panes: get in face 'pane
print rejoin [spaces type? :panes style :panes]
either block? :panes [
foreach pane face/pane [examine :pane spaces]
][
examine :panes spaces
]
remove/part spaces 4
]
examine face ""
]
lo: layout [text-list]
examine-lo lo
---8<---
The example at the end there prints out...
object Style: none
block
object Style: text-list
object Style: none
object Style: none
block
object Style: box
function
function
object Style: slider
object
object
none
none
--
Carl Read