World: r3wp
[View] discuss view related issues
older newer | first last |
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! :-) |
BrianW 26-Aug-2005 [2333] | hrm. Having issues getting "show" to work right for me. Time to dig a little and see what I can find out... |
james_nak 26-Aug-2005 [2334] | Ok, I've tried... I have a list of toggles with a scroller attached. For the life of me I can't get the "dragger" to size properly. The slider button is not proportional to the what is being shown in the list. In my case, I'm seeing about 20 of the 24 rows so the dragger should be about 80% the size of the panel, no? Thanks in advance to anyone who knows. |
MikeL 27-Aug-2005 [2335] | James, The code? |
james_nak 27-Aug-2005 [2336x2] | Rebol Lesson #3: "An object can contain variables that refer to functions that are defined within the context of the object." Therefore, don't assume an object's path leads one to having a value '"shoved into" it replacing the current value. In other words, sometimes all it takes is noticing that there isn't a ":" (colon) following the path. In Judeo-Christian lingo: "Thou shall not murder a function held in an object." Man, I didn't notice that scroller_object/redrag holds a function and just requires a value to be passed to it! When will I ever learn? Thanks MikeL. The phrase, "The code?" caused me to notice that. |
Almost there. What controls the amount of scroll when the user drags the bar up or down. I want my bar to move in increments of one row at a time but it seems like I have way too fine of a value in there to the point where the program has to catch up to the user's movements after a while. I would think it would be obj/step. | |
Anton 28-Aug-2005 [2338x4] | The code ? :) |
I'm expecting you're doing a show every time there is a scroller movement. What you want to do is check if the current row (ie. the one at the top of your list) has changed If so, show the list. If not, ignore. Not all the shows are necessary. | |
James, this example might help: do http://www.lexicon.net/antonr/rebol/gui/iterated/demo-vid-list-scroller.r | |
The STEP facet is what you want to set. This snippet from the above script does the work: ; arrow buttons cause the slider to move by the value of step scroll/step: either zero? non-visible-part [0][1 / non-visible-part] | |
Volker 28-Aug-2005 [2342] | Since customizing buttons comes sometimes up, i just found this link: http://www.rebol.com/how-to/btns-cust.html. Did not know that image can do that :) |
james_nak 28-Aug-2005 [2343] | Oh Anton-san, you very wise. The step was set correctly but it was indeed the # of "shows" that were being performed. I just check the before and after offset and do the show if necessary. Thanks. |
Geomol 29-Aug-2005 [2344] | Is there a way to draw a dot with the draw dialect? I'm looking for a way to do it with the draw dialect, and not just a poke in the image, so e.g. line-width will take effect. A line, where start- and end-point is the same, is not shown. A circle with radius 1 is not a dot, but slightly larger. Any ideas? |
Ingo 29-Aug-2005 [2345] | does a circle with radius 0.5 work for you? |
Anton 29-Aug-2005 [2346x7] | No, and even smaller does not work either: |
view layout [i: image black effect [draw [anti-alias off circle 10x10 0.0001]] image (i/size * 5) (to-image i)] | |
This might be a way: | |
view layout [i: image black effect [draw [anti-alias off scale 0.1 1 line 100x10 101x10 scale 1 1]] image (i/size * 5) (to-image i)] | |
Seems crazy that you can't just draw a dot, doesn't it ? | |
Here is another way: | |
view layout [i: image black effect [draw [anti-alias off shape [move 10x10 hline 10.1]]] image (i/size * 5) (to-image i)] | |
older newer | first last |