Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: /view custom styles

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] ]