World: r3wp
[View] discuss view related issues
older newer | first last |
Henrik 23-Aug-2005 [2283x2] | say I have: layout [a: tog true of 'panel b: tog of 'panel c: tog of 'panel] what's the correct way for setting b to true so that a, b and c still behave as part of 'panel? |
b to true = b/state to true | |
Gabriele 23-Aug-2005 [2285x3] | Henrik, this is the engage function for toggles: |
engage: func [face action event][ if find [down alt-down] action [ if face/related [ foreach item face/parent-face/pane [ if all [flag-face? item toggle item/related item/related = face/related item/data] [item/data: item/ state: false show item] ] ] face/data: face/state: not face/state either action = 'down [do-face face face/data] [do-face-alt face face/data] show face ] ] | |
you should basically do the same thing (the foreach above) | |
[unknown: 5] 23-Aug-2005 [2288] | Someone had contacted me a month or so ago and asked for my modified text-list and was looking to make some updates. I don't recall who it was but if your here - can you tell me if you improved such. |
Henrik 24-Aug-2005 [2289x3] | paul, was that the one which supported custom colors per line? |
I remember such a discussion, but that was 3-4 months ago. I didn't get anything done with it. | |
I'm working on a different implementation with a more advanced list system instead | |
Henrik 25-Aug-2005 [2292x2] | pekr, have you any private solution to the face accessor problem you mention so often? |
gabriele, thanks. it works now :-) | |
Pekr 25-Aug-2005 [2294x2] | Henrik - no, I don't have any .... |
I am more busy implementing some solutions so I only think loud from time to time :-) | |
Henrik 25-Aug-2005 [2296x2] | ok, but I'm anxious for a patch solution right here, mostly so that I can access numerous face/text's through a single object |
it would be nice to find a working equivalent to: >>a: make object! [b: 1] >>c: a/b >>c: 2 >>a/b == 2 ; but actually returns 1... | |
Ladislav 25-Aug-2005 [2298] | c: in a 'b set c 2 |
Henrik 25-Aug-2005 [2299x2] | ah, wonderful |
not so wonderful: >>layout [a: field "rebol" b: field "rules"] >>fields: make object! [atext: in a 'text btext: in a 'text] ; how to bind a/text and b/text correctly? >>fields/atext == text ; word! incorrect or: >> fields: make object! compose [atext: (in a 'text) btext: (in b 'text)] >> fields/atext == "rebol" but then: >>set in fields 'atext "test" ; incorrect way, apparently >>fields/atext == "test" ; good >>a/text =="rebol" ; but it didn't propagate back to the face.... | |
Ladislav 25-Aug-2005 [2301] | layout [a: field "rebol" b: field "rules"] fields: make object! [atext: in a 'text btext: in a 'text] get fields/atext |
Henrik 25-Aug-2005 [2302] | ok, that works, and if I would want to traverse all textfields in one go I started with: >> set fields/atext "test" ; which works for one field for multiple fields, I want to set each fields from an object: >> inserts: make object! [atext: "rebol" btext: "rocks!"] >> foreach i next first fields [attempt [set get in fields i get in inserts i]] >> show [a b] Fields are now changed properly in one go. Now I need to show the values in the foreach loop. I also need to allow the elements in the inserts object to be of arbitrary order. |
Gabriele 25-Aug-2005 [2303] | >> view/new layout [a: text "Hello" b: text "World"] >> fields: reduce [in a 'text in b 'text] == [text text] >> set fields "New" show [a b] |
Henrik 25-Aug-2005 [2304x4] | Gabriele, interesting, but if I run |
set fields "New" show [a b] | |
and do it multiple times with different strings, only the last one is set | |
hm... something with string lengths and the size of the textfield. :-) forget it. | |
Anton 25-Aug-2005 [2308x2] | set [a b c d] 1 ; this sets all of A B C and D to the same value, 1. |
set [a b c d] [1 2 3] ; this sets A == 1, B == 2, C == 3, D == none. | |
Henrik 25-Aug-2005 [2310] | ok, not thoroghly tested but: set-faces: func [faces data] [ set reduce foreach var faces [insert tail [] compose [in (var) 'text]] get data show faces ] view layout [a: field b: field c: field d: field] faces: copy [a b c d] ; generate this from the layout? data: make object! [a: "Eeny" b: "Meeny" c: "Miney" d: "Mo"] set-faces data faces ; whammo! |
Gabriele 25-Aug-2005 [2311x3] | hmm, i think what your are trying to do is what the panel accessors do by default (warning: a bit bugged, but easily fixable) |
>> layout [pan: panel [a: field "something" b: field "else"]] >> print mold get-face pan [a: "something" b: "else"] >> set-face pan ["Hello" "World"] >> print mold get-face pan [a: "Hello" b: "World"] | |
set-face does not allow [a: ...] while it should. I have a fix for it if you are interested. | |
Henrik 25-Aug-2005 [2314x2] | ok, I have to read up on 'panel first :-) |
if it's documented... | |
Gabriele 25-Aug-2005 [2316x2] | you could set the window accessor object to the default panel accessor objects, so that you can do the above with the window directly too. |
using panel is useful if you have more than one panel in the window. | |
Henrik 25-Aug-2005 [2318x2] | hmm... it actually does exactly what I need |
basically I'm interested in taking the contents of an object and put it in various faces in a layout in one go | |
Gabriele 25-Aug-2005 [2320x2] | what i do exactly. |
my-access: make ctx-access/panel [ set-face*: func [face value /local val][ if all [block? face/pane block? value][ either set-word? value/1 [ foreach [word val] value [ set-find-var face/pane to word! word val ] ] [ foreach f face/pane [ if any [find f/flags 'input find f/flags 'panel] [ if not empty? value [ set-face f value/1 value: next value ] ] ] ] ] ] ] | |
JaimeVargas 25-Aug-2005 [2322] | Gabriele should your fix make it to the default distribution ? |
Gabriele 25-Aug-2005 [2323x5] | then use Panel with [access: my-access] |
Jaime: it should. as soon as I get the chance to work on mezz code again. | |
with that you can do: set-face panel third object | |
context get-face panel gives you back the object. | |
(or better make template-obj get-face panel) | |
Chris 25-Aug-2005 [2328] | ; Here's a quickie: ctx-busy: context load http://www.ross-gill.com/r/busy-style.r view center-face layout [backcolor snow origin 200x150 busy true coal] |
JaimeVargas 25-Aug-2005 [2329] | Hey that came form OSX! Nice. |
Henrik 25-Aug-2005 [2330] | nice :-) |
Graham 25-Aug-2005 [2331] | Why not use the firefox busy style ... open source. |
Geomol 25-Aug-2005 [2332] | That's really cute, Chris! :-) |
older newer | first last |