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

Changing VID Styles

 [1/21] from: sanghabum::aol::com at: 11-Dec-2001 12:50


Hi all, 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). But it doesn't seem as simple as running through the faces and changing style: 'field to style 'info. I've done a bit of Vid-diving, and it looks like I have to hand-carve entries for feel/redraw and feel/key as well as Style. But I don't particularly want to set feel entries by hand. That might leave me with wrong defaults in later versions of View/VID. Are there any better suggestions out there? Thanks, Colin.

 [2/21] from: nitsch-lists:netcologne at: 11-Dec-2001 20:02


RE: [REBOL] Changing VID Styles [Sanghabum--aol--com] wrote:
> Hi all, > I have a layout with a load of entry fields (VID style Field). I need to
<<quoted lines omitted: 8>>
> me with wrong defaults in later versions of View/VID. > Are there any better suggestions out there?
i expect you should change the complete feel, since this defines how a face reacts. for fields it should be: ctx-text/swipe for info it should be: ctx-text/edit http://www.codeconscious.com/rebsite/vid-ancestry.r says info is derived from a field, so a info should have all a field-face needs? but not tested. (probe get in get-style 'info 'facets) gives usually the source-code of a style, 'style the base-style. have not seen both used til now)
> Thanks, > Colin.
-Volker

 [3/21] from: sanghabum:aol at: 11-Dec-2001 19:08


Hi Volker,
> > > > I have a layout with a load of entry fields (VID style Field). I need to
<<quoted lines omitted: 4>>
> for fields it should be: ctx-text/swipe > for info it should be: ctx-text/edit
Thanks for the response. How do you learn this stuff? help ctx-text on my machine starts an infinite molded print. I've been thinking a bit more about my problem. And It gets more complicated. I want to "freeze" check boxes, Choice boxes, and disable the "Save" button and so forth. That's going to be a lot of work to set a display to "read only". 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 a proof-of-concept. =========== unview/all DataWindow: layout/offset [field button "Display only" [DisplayBox/Image: make Image! MainPanel/Pane DisplayBox/Size: DisplayBox/image/Size MainPanel/Pane: DisplayPanel Show MainPanel ] field button field ] 0x0 view/new layout/offset [MainPanel: box 300x400] 0x0 MainPanel/Pane: DataWindow DisplayPanel: layout/offset [DisplayBox: box 300x400 [] ; no left click ;; Right click to "reactivate" [ MainPanel/Pane: DataWindow Show MainPanel ] ] 0x0 Show MainPanel do-events =========== Colin.

 [4/21] 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.

 [5/21] from: al:bri:xtra at: 12-Dec-2001 14:02


> How do you learn this stuff?
probe first ctx-text will show the words in the ctx-text object. Also, cruising around the World Wide Reb, and going to the Code Conscious Reb Site can help. Andrew Martin Still learning... ICQ: 26227169 http://valley.150m.com/

 [6/21] from: brett:codeconscious at: 12-Dec-2001 12:35


Hi Colin,
> How do you learn this stuff? help ctx-text on my > machine starts an infinite molded print.
You could use Romano's AnaMonitor. See his rebsite for it. It will give you a nice View gui to inspect the fields of the object. I've been using a extended HELP function written by Nenad Rakocevic DocKimbel . This is handy because it works in Core as well. He has a rebsite with a download for it but it doesn't work for me. A direct link to the file is: http://rebol.dhs.org/help.r Sample output looks like:
>> help ctx-text
OBJECT: ctx-text WORDS: keymap -- (Type: block) keys-to-insert -- (Type: bitset) SUB-OBJECTS: edit swipe view* FUNCTIONS: back-field -- (undocumented) back-word -- (undocumented) .......etc Brett.

 [7/21] from: nitsch-lists:netcologne at: 12-Dec-2001 6:04


RE: [REBOL] Re: Changing VID Styles [Sanghabum--aol--com] wrote:
> Hi Volker, > > >
<<quoted lines omitted: 9>>
> Thanks for the response. How do you learn this stuff? help ctx-text on my > machine starts an infinite molded print.
o be a good vid-detective, one should look at vidface/facets and vid-face/style. BMX (by my experiments) 'facets is the part 'layout used to construct the face, and 'style the style its based on. thats a LOT fewer source :)
>> probe get in get-style 'info 'style
FIELD == FIELD
>> probe get in get-style 'info 'facets
[with [ colors: 180.180.180 feel: ctx-text/swipe ]] == [with [ colors: 180.180.180 feel: ctx-text/swipe ]]
> I've been thinking a bit more about my problem. And It gets more complicated. > I want to "freeze" check boxes, Choice boxes, and disable the "Save" button
<<quoted lines omitted: 24>>
> Show MainPanel > do-events
Cool :) but 'info allows copying of text, so maybe the feel-way is usefull? to block a face used once following: i placed a face in front of the original face, this gets now all mouse-events. the face was a filter, so the original face was darkend. a filter with color: font: para: text: data: image: none effect: [blur colorize 0.0.200] but i remember this with change in the future, http://www.escribe.com/internet/rebol/m15951.html then effect will be effect: [mergecolorize 200.0.0] now, could not resist trying it :) rebol [todo: {mark is-disabled somehow, seperate handling of field/info}] disable-face: func [face'] [ change find face'/parent-face/pane face' ( make-face/spec get-style 'image [ offset: face'/offset size: face'/size pane: reduce [ face' make system/words/face [ size: face'/size color: font: para: text: data: image: none effect: [colorize 200.0.0] ] ] ] ) face'/offset: 0x0 show face'/parent-face ] enable-face: func [face'] [ face': face'/parent-face face'/pane/1/offset: face'/offset change find face'/parent-face/pane face' face'/pane/1 show face'/parent-face ] view center-face lay: layout [ rotary "enable" "disable" [ either face/data = face/texts [ enable-face hidi ] [ disable-face hidi ] ] field "field1" hidi: field "hidi" field "field2" ]
> > Colin.
-Volker

 [8/21] from: nitsch-lists:netcologne at: 12-Dec-2001 6:04


RE: [REBOL] Re: Changing VID Styles Hi Brett [brett--codeconscious--com] wrote:
> Hi Colin, > > I've hit on another way that'll do the job for my application. The
<<quoted lines omitted: 17>>
> Interesting detective work Volker! Though I'm > interested to know if flags in the face anything to do with it...
'info is an ancestor of 'field, so it has all field field/feel may use. the other way around is not guaranted, since 'info could add fields and info/feel could use them.. <snipped interesting ideas, read original :) >
> Brett. >
- Volker

 [9/21] from: brett:codeconscious at: 12-Dec-2001 18:26


Hi Volker,
> (probe get in get-style 'info 'facets) gives usually the source-code > of a style, 'style the base-style. have not seen both used til now)
I've updated http://www.codeconscious.com/rebsite/vid-ancestry.r to utilise the information in the 'facets field of the style. Click on a style to view it. BTW, I updated Vid-notes http://www.codeconscious.com/rebsite/vid-notes.r With a section called "function summary". It is my attempt at summarising the functions useful to know with View/Vid. Brett.

 [10/21] from: rebol:optushome:au at: 12-Dec-2001 19:02


Just swap set the feel for the behaviour you want. (You can do the same for appearance too if you want) REBOL [] info-feel: get in get-style 'info 'feel field-feel: get in get-style 'field 'feel swap-feel: func [face][ if find [info field] face/style [ face/feel: either (face/feel = field-feel) [ info-feel ][ field-feel ] ] ] lay: layout [ field field field field info field info button "Swap Feel" [foreach f lay/pane [swap-feel f] show lay] ] view lay Cheers, Allen K

 [11/21] from: g:santilli:tiscalinet:it at: 12-Dec-2001 9:58


[Sanghabum--aol--com] wrote:
> Are there any better suggestions out there?
Doing a custom Field style that accepts field/state: 'disabled ? (It's not difficult, but you'll have to change the feels.) Regards, Gabriele. -- Gabriele Santilli <[giesse--writeme--com]> - Amigan - REBOL programmer Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/

 [12/21] from: g:santilli:tiscalinet:it at: 12-Dec-2001 10:02


[Sanghabum--aol--com] wrote:
> 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
Well, if nothing has to be usable in the face, then you could just add to the tail of the pane a transparent face with the same size of the window; it will eat all the mouse clicks... Regards, Gabriele. -- Gabriele Santilli <[giesse--writeme--com]> - Amigan - REBOL programmer Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/

 [13/21] from: nitsch-lists:netcologne at: 12-Dec-2001 13:32


RE: [REBOL] Re: Changing VID Styles [brett--codeconscious--com] wrote:
> Hi Volker, > > (probe get in get-style 'info 'facets) gives usually the source-code
<<quoted lines omitted: 3>>
> to utilise the information in the 'facets field of the style. > Click on a style to view it.
fantastic! two minutes later i had the feel on right click too, and now i start feeling %vid-anchestry.r has some good facets of howtos :) after having feel, iam immediate disappointed with 'edit-text, 'copy-text missing. could there be some buttons for some hand-selected functions to get them quick too? :) (later: oh, vid-notes remind me there's ctx-text, thanks ;-)
> BTW, I updated Vid-notes > > http://www.codeconscious.com/rebsite/vid-notes.r > > With a section called "function summary". It is my attempt at summarising > the functions useful to know with View/Vid. >
showing the source in the browser and klick to read it formated is a new feeling :) great source! (reading) oh. you wrote a good reference card here! all i regulary forget at hand! how about popping up the function-source on click? could help with all this "undocumented". now i have to do it in console :( since i didnt notice do-face, set-font and lots others before. :) (reading more) hmm, could you group scrolling-infos closer together? i see scroll-para, "Scrolling faces", "The Changes facet" and "performance" related to this. (and more) thats our new FAQ, yes? next time before moving to escribe i will look here first :) hm, could you collect your open questions on a page? i think the list would like to figure it out ;-)
> Brett. >
-Volker (happy:)

 [14/21] from: rebol665:ifrance at: 12-Dec-2001 12:50


Hi, Is it possible to do the same thing with checks ? I would like to use checks only for display. Patrick

 [15/21] from: greggirwin:mindspring at: 12-Dec-2001 12:02


Hi Gabriele, << you could just add to the tail of the pane a transparent face with the same size of the window; it will eat all the mouse clicks...>> You should even be able to cover just an area containing controls, leaving others to react normally. Couldn't you? Now, how could you use an effect on that new face to give a disabled appearance to what's underneath it? Doing that, you could probably come up with a generic scheme to do it for individual controls as well, per your 'disabled idea. --Gregg P.S. Thanks for PDF_Maker! I'm using it to print layout images and it works great. It takes a few seconds to convert large images but I can live with that for my purposes right now. -G

 [16/21] from: brett:codeconscious at: 13-Dec-2001 10:02


Hi Volker,
> fantastic! two minutes later i had the feel on right click too, > and now i start feeling %vid-anchestry.r has some good facets > of howtos :)
Looks like it should be made into "style inspector" :)
> after having feel, iam immediate disappointed with 'edit-text, 'copy-text > missing. could there be some buttons for some hand-selected functions > to get them quick too? :)
Just pop up the source? Sure I think that would be simple.
> (later: oh, vid-notes remind me there's ctx-text, thanks ;-)
Yes well it was your post that prompted me to put that in - thanks! :) Lots of good suggestions Volker. I'll think about them and see what I can produce. I'm very pleased that my programs have been useful to you. Brett.

 [17/21] from: sanghabum:aol at: 13-Dec-2001 5:20


Thanks for all the useful input on my question. Here's a couple of comments and clarifications. Colin
>>The solution is to display the layout as an image when read only. The crude
code... Brett
> 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.
I'd agree it's not idea in this case. It was a quick hack based on a context-sensitive help "proof of concept" I tried the other day....When the user hit F1, the exact screen they were looking at collapses into an image in the top left; the bottom left is some general "about info" and over on the right is a scrolling panel of help text. The neat thing was that you can hit F1 repeatedly until the original image is just a dot. It amused the potential users no end. And all I need to do now is write a massive amount of help text in some sort of make-spec format, and I have a help subsystem. Brett:
> As an alternative idea for your requirement Colin, > rather than considering 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.
That's a great idea, though it isn't feasible in this case. The layout is derived dynamically so it's a bit of a slow process, and then facets in it are linked to loads of other structures to permit them to be updated. Redoing all that, and repopulating the layout with data, would be a pig. Allen:
> Just swap set the feel for the behaviour you want. > (You can do the same for appearance too if you want) > info-feel: get in get-style 'info 'feel > field-feel: get in get-style 'field 'feel
That's a really neat way of capturing the feel of a style, thanks. It answers my original question, which was too loosely phrased. I tried to extend this approach to 'Choice and 'Check, with not so good results. I suspect Patrick has as well from his question:
> Is it possible to do the same thing with checks ? > I would like to use checks only for display.
Gabielle:
> Doing a custom Field style that accepts field/state: > 'disabled ? > (It's not difficult, but you'll have to change the feels.)
Thanks for the clue to the generic solution. It'd be great to be able to offer the list a function that did, eg, this: ChangeVids/Disable mylayout [Choice Info] (prevents data entry to Choice and Info fields in mylayout) but my Vid skills aren't up to that. I guess we're looking at the different between me (an application designer who is using Rebol) and most of the rest of you (Rebgurus one and all). Gabrielle:
> Well, if nothing has to be usable in the face, then > you could just add to the tail of the pane a > transparent face with the same size of the window; > it will eat all the mouse clicks...
Another neat idea. Could it eat all keyboard clicks too? Thanks too to Andrew, Gregg, and Volker Colin.

 [18/21] from: brett:codeconscious at: 13-Dec-2001 22:46


Hi Volker, Regarding looking at objects and functions in Vid-ancestry. I included a button to pop up %anamonitor.r by Romano. I figured this has 80% of what you want. I remember you said you had put some code on right click - just send it too me if you want me to include it or anything else. I think eventually vid-ancestry.r and vid-notes could be rewritten to provide a nice comprehensive learning/inspection tool for Rebol/View but not any time soon I need to learn some more :) Brett.

 [19/21] from: nitsch-lists:netcologne at: 13-Dec-2001 12:59


RE: [REBOL] Re: Changing VID Styles Hi Colin first, have a look at http://www.reboltech.com/library/scripts/disable-face.r , something like this? to access all faces in a layout something like l: layout[...] faces: l/pane forall faces[ face: first faces any[ if 'field = face/style [swap-feel face 'break] ;and change color or effect or that.. if i-want-to-hide face [disable-face face 'break] if i-want-to-show face [enable face 'break] ] note there are three ways to mask a face, one can - append the new face to the parent-face/pane, - to the face/pane - or create a new wrap-face, plug the old face in, append a filter to wrap-face/pane and set the wrap-face at the old position in parent/pane. experimenting, i tried the third, mostly because iam worried about tabbing in a blocked face (is this otherwise possible?). not sure whats the best choice. customize as you like :) oh, and your help-system sounds very cool! :) :) -Volker [Sanghabum--aol--com] wrote:

 [20/21] from: nitsch-lists:netcologne at: 13-Dec-2001 17:39


RE: [REBOL] Re: Changing VID Styles [brett--codeconscious--com] wrote:
> Hi Volker, > > Regarding looking at objects and functions in Vid-ancestry. > > I included a button to pop up %anamonitor.r by Romano. I figured this has > 80% of what you want. >
yes. to show ctx-text perfect :)
> I remember you said you had put some code on right click - just send it too > me if you want me to include it or > anything else. >
well, i found show-facet-info: func [style [word!]] [ view/new layout compose [ styles utility-styles space 0x0 origin 0x0 backdrop gray h1 "Specific facets for" h2 (mold style) scrollpanel subface [text as-is ( (mold get in get-style style 'facets) )] ] ] and just added show-feel-info: func [style [word!]] [ view/new layout compose [ styles utility-styles space 0x0 origin 0x0 backdrop gray h1 "Specific facets for" h2 (mold style) scrollpanel subface [text as-is ( (mold get in get-style style 'feel) )] ] ] then i looked for the call append/only vid-spec reduce ['show-facet-info to-lit-word style-name] and changed it to append/only vid-spec reduce ['show-facet-info to-lit-word style-name] append/only vid-spec reduce ['show-feel-info to-lit-word style-name] resulting in using the right mouse-button too. now finding something like feel: svvf/button in the facets (left click) i have just to go back and click right in the main window :)
> I think eventually vid-ancestry.r and vid-notes could be rewritten to > provide a nice comprehensive learning/inspection tool for Rebol/View but not > any time soon I need to learn some more :) >
it gives inspiration :)
> Brett. >
-Volker

 [21/21] from: g:santilli:tiscalinet:it at: 15-Dec-2001 15:03


Hello Gregg! On 12-Dic-01, you wrote: GI> disabled appearance to what's underneath it? Doing that, you GI> could probably come up with a generic scheme to do it for GI> individual controls as well, per your 'disabled idea. Yup, you can even add the face over a single "control" (a VB term, eh? ;) adding it to its face's pane. GI> It takes a few seconds to convert GI> large images but I can live with that for my purposes right GI> now. -G That's annoying for me too, but I didn't find a faster way yet to dump the image in RGB format (there always seems to be the alpha channel...). But maybe I could look if I can put the alpha channel in the PDF file too (I don't remember if that was possible...) Anyway, I won't have time to work on it before January... Regards, Gabriele. -- Gabriele Santilli <[giesse--writeme--com]> - Amigan - REBOL programmer Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted