World: r3wp
[View] discuss view related issues
older newer | first last |
Janeks 28-Sep-2006 [5648] | But in wait 10 place I have load http://server/image.ext |
Anton 28-Sep-2006 [5649x2] | Well you must do: view/new mainWin: layout [ t1: text "loading..." pic: image 73x76 ] pic/image: load http://server/image.ext t1/text: "loaded." show window do-events |
See working code: http://anton.wildit.net.au/rebol/plugin/browser-plugin-test.html http://anton.wildit.net.au/rebol/plugin/browser-plugin-test.r | |
Janeks 28-Sep-2006 [5651] | O'k - thanks, Anton! Now it is clear! |
Anton 28-Sep-2006 [5652] | You're welcome. |
james_nak 5-Oct-2006 [5653] | Does anyone know how to turn on/off the busy indicator at will? I'm moving files with services and it would be nice to show that something is happening. Thanks in advance. |
Volker 5-Oct-2006 [5654] | system/options/quiet: false ; ? |
Pekr 6-Oct-2006 [5655] | I have one question from Bobik, to which I don't know an aswer: he's trying to stylize/master his field, but it does not work for him, unless he uses full path in 'engage function, e.g.: system/words/ctx-text/edit-text face event get in face 'action whereas 'field itself does not need full path specified. Why such a difference? Or is he doing anything wrong probably? |
Volker 6-Oct-2006 [5656] | Because 'field is bound there. probe ctx-text/edit thats the feel plugged into 'field. |
Pekr 6-Oct-2006 [5657x3] | REBOL [] stylize/master [ myfield: field with [ feel: make feel [ engage: func [face act event][ switch act [ down [ either equal? face focal-face [unlight-text] [focus/no-show face] caret: offset-to-caret face event/offset show face ] over [ if not-equal? caret offset-to-caret face event/offset [ if not highlight-start [highlight-start: caret] highlight-end: caret: offset-to-caret face event/offset show face ] ] key [ if event <> newline [ edit-text face event get in face 'action ] ] ] ] ] ] ];end of stylize? halt |
So you just can't take original field feel method, and use it inside of stylize? | |
that was wrong, sorry: REBOL [] stylize/master [ myfield: field feel [ engage: func [face act event][ switch act [ down [ either equal? face focal-face [unlight-text] [focus/no-show face] caret: offset-to-caret face event/offset show face ] over [ if not-equal? caret offset-to-caret face event/offset [ if not highlight-start [highlight-start: caret] highlight-end: caret: offset-to-caret face event/offset show face ] ] key [edit-text face event get in face 'action] ] ] ] ];end of stylize? view layout [f1: field f2: myfield button "End" [quit]] | |
Volker 6-Oct-2006 [5660] | Theres a trick. feel: make feel bind [..] ctx-edit |
Pekr 6-Oct-2006 [5661] | f2 field crashes the script ... it does not know focal-face, neither it does edit-text |
Volker 6-Oct-2006 [5662x4] | then it finds edit-text withut path. BTW you only need ctx-text/edit-text, not that system/words before. |
field is defined inside system/view. | |
so it can shortcut system/view/focal-face too. bind to both. | |
In the sdk-source they are nested there. | |
Pekr 6-Oct-2006 [5666] | hmm, that is guru stuff ... although I do seem to understnad the bind, I think I also understand, while less experienced user is in hell ... then stylize/master is insufficient imo |
Volker 6-Oct-2006 [5667x2] | The other trick is to edit the feel to use full pathes. |
system/view/focal-face, unlight-text, highlight-start, caret. and ctx-text/edit-text. | |
Pekr 6-Oct-2006 [5669] | well, it is just - stylize/master is here for you to define new style ... looking into other ones. It should not presume you know about where the stuff is bound ... the question is, if it could be cured :-) after all - touching stylize/master you are already touching the guru stuff, so you better know what you are going to do ... and how :-) |
Volker 6-Oct-2006 [5670x2] | Its not stylize fault. its rebol and defining things in another context. |
That style is not written to be probed and pasted. maybe it should. in the source it is inside the right context, so no guru-stuff needed. just a member of an object plugged elsewhere. | |
Pekr 6-Oct-2006 [5672] | would it be different looking into SDK sources? |
Volker 6-Oct-2006 [5673x3] | there is something like ctx-edit: context[ edit-text: func .. edit: make feel[..] ] |
and system/view around that. At least thats the usual way. | |
No, for system/view %source/view-edit.r there is some bind-magic at the end. | |
Anton 6-Oct-2006 [5676x2] | Pekr, what does Bobik want to do ? It looks like he wants to capture the return key (which is #"^M" and not newline by the way). |
Here is a quick way to modify the engage function, maybe it does what he wants. view layout [ f: field feel [ engage: func [face act event] head insert copy/deep second :engage [ if (probe event/key) = #"^M" [exit] ] ] ] | |
Pekr 6-Oct-2006 [5678] | I will post it to him ... what does your function do in particular? :-) |
Anton 6-Oct-2006 [5679] | Insert PROBE before head insert ... and you will know. |
Pekr 6-Oct-2006 [5680] | well, it seems to insert the code into body of engage which is used for our new engage function as a template, or something like that :-) |
Anton 6-Oct-2006 [5681] | First it copies the body of engage (copy/deep second :engage). Copying the code this way keeps the binding of all the words. Then it inserts some new code. INSERT leaves us after the insert, so we use HEAD to move back to the head of the block. The copied and modified code is then used as the body of a new engage function. Because we are creating a function using FUNC, the body block is bound to the new function's context, as usual. This means that the 'event word is bound correctly and the new code works correctly. (That's what happens anytime we create a function.) |
Pekr 6-Oct-2006 [5682] | and if 'function would be used instead? |
Anton 6-Oct-2006 [5683x2] | No difference there. |
I didn't mean to stress "using FUNC", just pointing out that we are using FUNC in this case. | |
Pekr 6-Oct-2006 [5685] | ok, thanks a lot .... for me the interesting part was 'head ... |
Anton 6-Oct-2006 [5686] | Of course you can check each step using PROBE. |
Pekr 6-Oct-2006 [5687x2] | because .... copy/deep still returns block ... I thought the position does not matter |
I know .... | |
Anton 6-Oct-2006 [5689] | It's only because INSERT returns the block at the position *after* the newly inserted part that we need HEAD. |
Pekr 6-Oct-2006 [5690x2] | I know - but I thought that func simply accepts the block, regardless of position .... |
I thought ti would work without the head, but it does not ... | |
Anton 6-Oct-2006 [5692] | Well, most functions care about the series index. We can easily test if FUNC does: >> body: tail [print "hello"] == [] >> f: func [] body >> f <---- nothing is printed |
Pekr 6-Oct-2006 [5693] | it is imo bug :-) |
Anton 6-Oct-2006 [5694] | Nah... |
Pekr 6-Oct-2006 [5695] | func accepts the second argument as a block ... not a block at certain position :-) it should automatically move to the head, but ... maybe not ... |
Ladislav 6-Oct-2006 [5696] | no way, it would be bug if it worked differently |
Anton 6-Oct-2006 [5697] | Blocks are series and series are fundamental to understanding rebol. You must understand this behaviour and be comfortable with it, because understanding it opens up a lot of the power of series. |
older newer | first last |