/view custom styles
[1/4] from: max::ordigraphe::com at: 23-Aug-2001 15:59
Hello world,
A follow up on my previous question regarding custom menus...
I have peeled doc kimbel's win95 skin code and still have not figured
out how it "hooks" upon view layout, so that it may parse arguments and
have its own setup dialect?
If I empty the init-last function and/or empty the builder object in the
menu's definition, It just becomes a normal layout block. I have no
errors I was thinking that if the definition is the same but broken,
that I would know where it enters the gadget.
I'm stumped!
TIA!
-Max
This is the exact code I'm using... what's missing or wrong?
--------------------------------------------------------
REBOL[
title: "vid test"
]
skin: stylize [
menu: label 100x100 "menu container"
with [
color: 188.188.188
pane: make block! 1
state: off
data: none
switch-off-all: func [/local item][
foreach item pane [item/state: off]
]
init-last: function [root][item li][
print "FUCK"
]
sub-popup: make object! []
builder: make object! []
]
;end menu
]
view layout [
styles skin
menu [ "hey"]
button "quit" [quit]
]
ask "HEY!"
[2/4] from: dockimbel:free at: 24-Aug-2001 12:05
Hi Max !
Maxim Olivier-Adlhoch wrote:
[...]
> I have peeled doc kimbel's win95 skin code and still have not figured
> out how it "hooks" upon view layout, so that it may parse arguments and
> have its own setup dialect?
[...]
To answer your question, you can find a patched 'layout function within the
/skin directory. It adds to the standard 'layout function, support for a
new facet called 'init-last, which is called after all the faces are builded.
(I needed this to get the final size of the root face and some other "effects")
In your example, you have to first load my %layout.r script in order to use 'init-last.
The standard 'layout function doesn't know about it and would just ignore it.
VID provides a standard way to "hook": the 'init facet. Just give it a block of code
and
it will be executed during the layout building. 'init have to be a block, not a function.
About the setup dialect, i use the standard 'action facet. When VID encounters a block,
it stores it in the current face's 'action facet for execution. But sometimes, the purpose
of
'action is changed and the block is parsed for a sub-dialect instead of been executed
(see 'panel source for example, >> probe get-style 'panel). I use the same trick and
parse it
with menu dialect rules. All this is done within 'init-last, but could be done in 'init
too.
'init is the standard way.
HTH,
DocKimbel.
PS: Here is a modified source :
REBOL [
title: "vid test"
]
skin: stylize [
menu: label 100x100 "menu container"
with [
color: 188.188.188
pane: make block! 1
state: off
data: none
switch-off-all: func [/local item][
foreach item pane [item/state: off]
]
init-last: function [root][item li][ ; load %skin/layout.r first !
print "FUCK" ; to use 'init-last
]
init: [
print "Oh my god!" ; init have to be a block !
probe :action
probe second :action ; now you can parse it.
]
sub-popup: make object! []
builder: make object! []
]
;end menu
]
view layout [
styles skin
menu [ "hey"]
button "quit" [quit]
]
[3/4] from: max:ordigraphe at: 24-Aug-2001 10:23
Hi
Thanks for pointing out the patched 'layout function... this would
explain my problems.. A not so obvious trick to decyphre ;-)
I did not notice the init facet... even though I have been through the
docs several times... I find the lastest view documentation very
prohibitive, when compared to the old docs which where sent out with the
public beta version of view... I wish an advanced manual would be
released for view which explain some of the more nebulous and intricate
topics a bit more in detail and with working examples.
btw, in your Win95 skin, you mention that you are waiting for the /Draw
to be available... Well, are you aware that it is?
And, does anyone know if the virtual coordinate system is anywhere near
ready for /view ?
Again, Merci!
-Max
Contrary to popular belief, Unix IS user-friendly...
its just picky on who it considers a friend
[4/4] from: dockimbel:free at: 24-Aug-2001 17:07
Hi Max,
Maxim Olivier-Adlhoch wrote:
[...]
> I did not notice the init facet... even though I have been through the
> docs several times... I find the lastest view documentation very
[...]
It's not documented, it's part of VID internals. Anyone interested in writing
docs about it ?
> btw, in your Win95 skin, you mention that you are waiting for the /Draw
> to be available... Well, are you aware that it is?
Yeah, sure ! :) Win skins are not my top priority project, so it's currently
very difficult to find free time to work on it.
Regards,
DocKimbel.