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

Stylize/deep

 [1/18] from: carl:cybercraft at: 26-Dec-2001 13:29


How do you use stylize to set panes within a style. ie, to set the likes of text-list/sld/edge/color and so on? -- Carl Read

 [2/18] from: ammonjohnson:yaho:o at: 25-Dec-2001 19:03


Try 'with Stylize [a: box with [data: "Some Data"]] Enjoy!! Ammon

 [3/18] from: carl:cybercraft at: 26-Dec-2001 15:02


On 26-Dec-01, Ammon Johnson wrote:
> Try 'with > Stylize [a: box with [data: "Some Data"]]
No joy Ammon. I couldn't get any variations on the following to work... my-styles: stylize [ txt-lst: text-list with [sld: edge [color: 0.0.0]] ] view layout [ styles my-styles txt-lst ]
>> How do you use stylize to set panes within a style. ie, to set the >> likes of text-list/sld/edge/color and so on?
-- Carl Read

 [4/18] from: ammonjohnson::yahoo at: 25-Dec-2001 21:11


I see where you are coming from, sld happens to be a slider, but it is not defined until init happens so... One thing you might like to try at the console is,
>>probe get-style 'text-list
That will return the actually text-list style, which may give you awonderful insight. Something that you will notice is that 'sld is defined in the 'init function so you will need to redefine it something like: my-styles: stylize [ txt-lst: text-list with [sld: edge [color: 0.0.0] init: [ if all [not flag-face? self as-is string? text] [trim/lines text] if none? text [text: copy ""] change font/colors font/color if :action [feel: svvf/hot saved-area: true] data: size if any [none? size size/x < 0 size/y < 0] [ state: max 1x1 pane-size * 9 / 10 - offset - para/margin if none? size [size: state] if size/x < 0 [size/x: state/x] if size/y < 0 [size/y: state/y] size: size-text self all [ para para/origin size: size + para/origin para/margin size: size + para/margin ] ] if all [data data/y < 0] [size/x: data/x] data: none sz: size sn: 0 slf: :self act: :action if none? data [data: texts] if none? data [data: copy []] lines: data picked: copy [] iter: make-face/size 'txt sz * 1x0 + -16x20 iter/para: make self/para [origin: 2x0] iter/font: make self/font [] lc: to-integer sz/y / iter/size/y: second size-text iter iter/feel: make iter/feel [ redraw: func [f a i] [ f/color: either find picked f/text [svvc/field-select] [slf/color] ] engage: func [f a e] [ if a = 'down [ if cnt > length? head lines [exit] if not e/control [f/state: cnt clear picked] alter picked f/text do :act slf f/text ] if a = 'up [f/state: none] show pane ] ] pane: layout/size [ origin 0 space 0 sub-area: box slf/color sz - 16x0 ibevel with [pane: :text-pane] at sz * 1x0 - 16x0 sld: slider edge [color: 0.0.255] sz * 0x1 + 16x0 [ value: to-integer value * ((1 + length? head lines) - lc) if sn <> value [sn: value] show sub-area ] ] size sld/redrag lc / max 1 length? head lines pane/offset: 0x0 ] ] ] view layout [ styles my-styles txt-lst ] Enjoy!! Ammon PS in the init function it declares the pane...

 [5/18] from: petr:krenzelok:trz:cz at: 26-Dec-2001 5:30


Ammon Johnson wrote:
>I see where you are coming from, sld happens to be a slider, but it is not >defined until init happens so... One thing you might like to try at the
<<quoted lines omitted: 4>>
>insight. Something that you will notice is that 'sld is defined in the 'init >function so you will need to redefine it something like:
or just use layout post-processing capability, something like: view layout [t: text-list "ABCD" do [t/sld/edge/color: 0.0.0]] ... the 'do block will be called just once, after the 't is already defined .... or so it seems .... -pekr-

 [6/18] from: ammonjohnson:y:ahoo at: 25-Dec-2001 22:41


yes, but he wants a style... Enjoy!! Ammon

 [7/18] from: petr:krenzelok:trz:cz at: 26-Dec-2001 6:22


Petr Krenzelok wrote:
> Ammon Johnson wrote: >> I see where you are coming from, sld happens to be a slider, but it
<<quoted lines omitted: 16>>
> defined .... or so it seems .... > -pekr-
while we are at it, you can even do following: view layout [t: text-list "ABCD" do [t/sld/dragger/image: load %/C/Rebol/View/bay.jpg t/sld/dragger/effect: [tile-view] show t]] however - there is some problem with such aproach: 1) it doesn't show the image when running for the first time, even if 'show t is explicitly being done 2) it hardcodes above values into system structure, so all your further dragger usage will show an image, and it is not what we intended to do .... I think that while it is fine we have some stylize, get-styles and other helper functions, layout should always copy system styles, to save us from typical rebol object headache - shared subobjects. Is there any reason why subobjects are shared other than possible memory saving? I think that if something causes global confusion, it should be removed. Calls to make/deep are not fullfilled, so typical View novice annoyance is - how's that changing something on one place in one time influences its further usage? -pekr-

 [8/18] from: carl:cybercraft at: 26-Dec-2001 19:19


On 26-Dec-01, Ammon Johnson wrote:
> I see where you are coming from, sld happens to be a slider, but it > is not defined until init happens so... One thing you might like to
<<quoted lines omitted: 6>>
> my-styles: stylize [ > txt-lst: text-list with [sld: edge [color: 0.0.0]
(Snip of way too many lines just to change a color!:) I think there has to be a better way, or if there isn't, there should be...
> Enjoy!! > Ammon
<<quoted lines omitted: 28>>
> Do You Yahoo!? > Get your free @yahoo.com address at http://mail.yahoo.com
-- Carl Read

 [9/18] from: carl:cybercraft at: 26-Dec-2001 19:28


On 26-Dec-01, Petr Krenzelok wrote:
> Ammon Johnson wrote: >> I see where you are coming from, sld happens to be a slider, but it
<<quoted lines omitted: 8>>
> or just use layout post-processing capability, something like: > view layout [t: text-list "ABCD" do [t/sld/edge/color: 0.0.0]]
I knew you could do that, but as you pointed out in your next post, it has a global effect. It even changes 'slider, never mind just the 'text-list slider.
> ... the 'do block will be called just once, after the 't is already > defined .... or so it seems .... > -pekr-
-- Carl Read

 [10/18] from: rotenca::telvia::it at: 26-Dec-2001 11:24


Hi Carl,
> I think there has to be a better way, or if there isn't, there should > be... >
stylize [t: text-list with [insert tail init [sld/edge: make sld/edge [color: 1.2.200]]]] --- Ciao Romano

 [11/18] from: petr:krenzelok:trz:cz at: 26-Dec-2001 12:08


Romano Paolo Tenca wrote:
>Hi Carl, > >>I think there has to be a better way, or if there isn't, there should >>be... >> > >stylize [t: text-list with [insert tail init [sld/edge: make sld/edge [color: >1.2.200]]]] >
a hack, isn't it? Look at rebol docs and look at face object - there is no description of various phases of GUI creation, of fields like init, multi, etc. Anyway, better some possibility of change, than no possibility at all :-) ... and as with rebol, where everything is a block, it can be done :-) Thanks, -pekr-

 [12/18] from: carl:cybercraft at: 27-Dec-2001 0:27


On 26-Dec-01, Romano Paolo Tenca wrote:
> Hi Carl, >> I think there has to be a better way, or if there isn't, there >> should be... >> > stylize [t: text-list with [insert tail init [sld/edge: make > sld/edge [color: 1.2.200]]]]
Many thanks Romano - that seems to do the job perfectly. Will look into why/how it works. -- Carl Read

 [13/18] from: rotenca:telvia:it at: 26-Dec-2001 12:52


Hi Petr,
> >stylize [t: text-list with [insert tail init [sld/edge: make sld/edge
[color:
> >1.2.200]]]] > > > > a hack, isn't it? Look at rebol docs and look at face object - there is > no description of various phases of GUI creation, of fields like init, > multi, etc.
My docs are the layout source and the sources of RT styles, which use "append init" (and my anamonitor, of course :-). I agree: Rebol docs on this kind of things is like a great zero. If we want to write our own styles, the only way we can go is "disassembling". If i find some code in the RT code, i do not consider it an hack. If we should follow only the ufficial vid doc, we could do almost only simple interface good only for language demo. RT could always say that this is not documented, but this is true for almost all view/vid feature. --- Ciao Romano

 [14/18] from: rotenca:telvia:it at: 26-Dec-2001 13:01


Hi Carl,
> Many thanks Romano - that seems to do the job perfectly. Will look > into why/how it works.
At the end of the layout execution of init block, every standard aspects of the style face is done. Now is the time to change it to follow our wishes. I clone the edge object of the slider, because it could be shared by others face, and change the field color of the edge object. To create a new style from an existing one, the first thing is appending something to the init block or to change it in a deeper manner. --- Ciao Romano

 [15/18] from: ptretter:charter at: 26-Dec-2001 7:45


What I typically do is just change the system object to conform to a default that I can work with through my layouts. For example the edge object is not defined within the Text-list style. Therefore, I just add the default face edge to the text-list such as: system/view/vid/vid-styles/text-list/edge: make object! [ color: 200.200.200 image: none effect: none size: 2x2 ] now I can work with text-list more easily throughout all the remaining layouts I define such as: view layout [text-list with [edge/color: red]] Paul Tretter

 [16/18] from: rotenca:telvia:it at: 26-Dec-2001 15:24


Hi Paul,
> What I typically do is just change the system object to conform to a default > that I can work with through my layouts. For example the edge object is not
<<quoted lines omitted: 6>>
> size: 2x2 > ]
I do not like to change system defaults. I reach the same goal with: t: layout [tl: text-list edge [color: 1.0.0]] without changing system defaults. --- Ciao Romano

 [17/18] from: petr:krenzelok:trz:cz at: 26-Dec-2001 16:29


Paul Tretter wrote:
>What I typically do is just change the system object to conform to a default >that I can work with through my layouts. For example the edge object is not
<<quoted lines omitted: 9>>
>layouts I define such as: >view layout [text-list with [edge/color: red]]
well, now you can use edge directly, but still - try to delete 'with block - and you will see that your global setting was influenced, as all further text-list will have red edge no matter if you specify it or not ... and that is not correct behavior imo .... btw: could 'make-face help to make our life easier? ->> help make-face USAGE: MAKE-FACE style /styles ss /clone /size wh /spec blk /offset xy DESCRIPTION: Make a face from a given style name or example face. MAKE-FACE is a function value. ARGUMENTS: style -- A name or a face (Type: word object) REFINEMENTS: /styles ss -- Stylesheet (Type: any) /clone -- Copy all primary facets /size wh -- Size of face (Type: pair) /spec blk -- Spec block (Type: block) /offset xy -- Offset of face (Type: pair)) PS: and guys ... try to delete at least few lines of text you are not quoting directly :-) -pekr-

 [18/18] from: ammonjohnson:y:ahoo at: 26-Dec-2001 17:06


See Romano's solution, that's what I tried for, but I didn't realize I was looking for 'tail (append tail init) Enjoy!! Ammon

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