My custom stylesheets
[1/4] from: etienne::alaurent::free::fr at: 26-Jul-2001 1:57
Hi Rebolers,
In my app, I defined some stylesheets. Any user can use one of those
stylesheets. When the user changes, the stylesheet must be up to date.
My solution is to close the GUI, and reload it with the new stylesheet. it
runs fine like this. But I'm not pleased with this approch. What I want is to
update "on the fly" the GUI with the new stylesheet. I'm thinking to find on the
face all definitions in the stylesheet and change them dynamicaly.
What do think of this approch and how can I do ?
---
Etienne
[2/4] from: brett:codeconscious at: 26-Jul-2001 13:13
Hi Etienne,
In order to see the effect of another stylesheet - you need to recreate the
GUI by using LAYOUT. That is, you need to call LAYOUT each time you want to
use a new stylesheet. This is because the stylesheet is interpreted by
LAYOUT to create the faces of your GUI. I think you may have found out
earlier, there is no point just changing the stylesheet itself an expecting
the changes to take effect on existing windows (faces).
In terms of structuring your GUI there are many ways.
One idea is to UNVIEW/ALL and then re-create your GUI by calling view/new
layout [....] each time you want to change styles.
Another idea is to create a main window with a subpanel (see the subpanel
howto). Then each time you want to change
to a new stylesheet, create a new subpanel face and set it inside the main
panel.
For both these solutions you will probably need to think about keeping your
layout specification block as a variable which can be copied and modified
each time you call layout.
For example:
my-layout: [ Title "Example" field]
for i 1 3 1 [
new-layout: copy my-layout
append new-layout compose [button (join "test" i)]
view layout new-layout
]
HTH,
Brett.
[3/4] from: g:santilli:tiscalinet:it at: 26-Jul-2001 19:15
Hello Etienne!
On 26-Lug-01, you wrote:
EA> What do think of this approch and how can I do ?
What about this:
relayout: func [
"Update the layout of a window"
win [object!] "The window to update"
lay [block!] "The new layout to show"
/local new
] [
new: layout lay
win/pane: new/pane
win/size: new/size
show win
]
Regards,
Gabriele.
--
Gabriele Santilli <[giesse--writeme--com]> - Amigan - REBOL programmer
Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/
[4/4] from: etienne:alaurent:free at: 26-Jul-2001 23:43
Hi Brett and Gabriele,
Your two approches are similar. And I implemented them , and it's now ok.
That's great :-))
Thanks a lot
---
Etienne