[REBOL] Re: Changing VID Styles
From: brett:codeconscious at: 12-Dec-2001 12:25
Hi Colin,
> I've hit on another way that'll do the job for my application. The
solution
> is to display the layout as an image when read only. The crude code below
is
That's a sneaky idea. I like it :). I'll have to keep it in the back of my
mind. Though normally the user would get some
visual indication that the visual elements cannot be modified through
dimming etc.
Back to the original requirement:
> I have a layout with a load of entry fields (VID style Field). I need to
> occassionaly display this with all entry fields disabled.
>
> So (I think) I need a way of running through the layout and changing all
> 'field style faces to 'info style (and vice versa to make it enterable
again).
Such a function could be a nice facility especially for conditional fields
or panels. I've seen Volkers reply about
the feels (BTW I think they are supposed to be around the other way).
Interesting detective work Volker! Though I'm
interested to know if flags in the face anything to do with it...
As an alternative idea for your requirement Colin, rather than considering
the the layed out faces (result from
LAYOUT) as being the variable (the model you have to manipulate), how about
keeping your layout specification (input to LAYOUT) as the variable that you
manipulate or create on demand. When you want to swap to read-only mode,
call LAYOUT again and reshow. Have some functions that decided how to create
the layout specification based on whether you want it read only or not. Or
you could have a function for each type of layout mode you want to present
to the user. Maybe you do it for the whole interface or just for a sub
panel. Think of it as "disposable interface" - a bit like an airline
toothbrush, use it and then throw it.
Next alternative is to have more permanent layouts but one for each mode.
Rather than disposing of them as I suggest above you keep them in the
background until you need them. So you might have two layouts that look
exactly alike except
that one has fields and the other has info styles instead of the field
styles. Then you need to copy info back and forth
between these two layouts. And likely you'll end up with some function to
build the layout because they are so similar.
So this is pretty close to the "disposable interface" idea but perhaps being
a little more "environmentally friendly" for performance reasons :)
I admit that my first habit is to think in terms of manipulating faces, but
that is because of my previous experience with other
GUI frameworks. However, for an ordinary user interface, the "disposable
interface" idea is sometimes easier to maintain rather than fiddling with
the
innards of the face object model. It shifts the emphasis back a bit towards
representing your data
rather than "building GUIs".
Brett.