r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[View] discuss view related issues

ICarii
9-May-2009
[8639x2]
define a separate: field/info and swap the face reference i guess
just save then reassign pane/face
Henrik
9-May-2009
[8641]
well, it's about which parameters that need to be brought over. size, 
offset and internal data should be the same.
ICarii
9-May-2009
[8642]
should be simple as a variable swap - just have to use globals in 
R2
Henrik
9-May-2009
[8643x2]
I don't think I want to do it that way. The face I swap with could 
probably be obtained using GET-STYLE. But then certain parameters 
from the old face should be grafted onto the new face.
well, about to test, so we'll see if it works...
ICarii
9-May-2009
[8645]
couldn't you get the same effect by selectively locking teh field 
object?
Henrik
9-May-2009
[8646]
locking, how?
ICarii
9-May-2009
[8647x2]
override the feel
style lockable-field field feel [...]
Henrik
9-May-2009
[8649]
that's not enough. it has to be visual as well.
ICarii
9-May-2009
[8650]
you can intercept the redraw
Henrik
9-May-2009
[8651]
that's too complicated.
ICarii
9-May-2009
[8652]
redraw: func [face act pos] [set-face-look..]  ..  not really that 
complicated..
Henrik
9-May-2009
[8653]
It won't do if it has to be added to every face in VID. Besides I've 
built something simpler now.
ICarii
9-May-2009
[8654x2]
:)
alternately I would add a single redraw check at the top level and 
scan children for a 'lock value in a predefined field / flags.
jocko
9-May-2009
[8656x2]
Steeve, Henrik
Steeve, Henrik, thank you for these infos concerning interpolation 
modes with effect and draw
Maxim
9-May-2009
[8658]
the easiest way I`ve done this henrik is to have a face which has 
two extra facets (style, protected) and a function called change, 
 


calling 'change to another style gets all the values from the global 
style block for that stylename, and changes all facets excluding 
any which are in the protected block.  it also sets the stylename 
within the function, so you can easily do decisions based on that.


alternatively, you can make an external function which does the same, 
but adding the protected inside the 'WITH [ ] spec makes it easier 
to contextualize the system.
Henrik
12-May-2009
[8659]
If I have a window-feel with a 'detect function, could it be performed 
after an 'engage function for a face in that window? Is there a way 
to swap that around?
Maxim
12-May-2009
[8660x3]
you can always modify view*/wake-event to it fires other events after 
the do-event.
to=so
just remember to bind the func block to *view before submitting it 
to func

ex:  

view*: system/view
view*/wake-event: func [port ] bind [ 
	.... your wake event redefinition code ...
] in view* 'self


obviously you can mold/all + load  the wake-event func body directly 
or copy it from sdk code if you want.
Henrik
12-May-2009
[8663]
hmm... it's actually only the sequence of events that needs altering. 
as far as I can tell that function only fires one event at a time 
from the event queue.
Maxim
12-May-2009
[8664x2]
but the detect and engage function are the same original event.  
engage is sent to see who really wants it and then it is sent the 
engage
ooops   "detect  is sent ..."
Henrik
12-May-2009
[8666]
but the detect and engage don't originate from the same face?
Maxim
12-May-2009
[8667x3]
basically, the detect goes from window, thru all children up to the 
face which generated the even, in order for you to trap the event 
in a parent face.
at that point, the event will not be sent to the child face (if you 
decide to capture it)
so if you need to "consume" an event (for hotkeys for example)  the 
window can detect it and it wont reach the child field.
Henrik
12-May-2009
[8670]
so the detect is causing the engage to happen?
Maxim
12-May-2009
[8671x2]
if parent face captures it , it will allow the engege to happen.
darn...  if = if no
Henrik
12-May-2009
[8673]
to me it sounds like there is no way to switch them around.
Maxim
12-May-2009
[8674]
I'm getting Reicharteritis
Henrik
12-May-2009
[8675]
I'm a little thick on the event system. So I ask many dumb questions. 
:-)
Maxim
12-May-2009
[8676]
it makes no sense to switch them around, detect basically serves 
to know where to send the events to.
Henrik
12-May-2009
[8677]
Ok, from the event queue it doesn't make sense, I guess. But from 
what I'm trying to do, I need to do something to a local face _before_ 
something else happens globally.
Maxim
12-May-2009
[8678x5]
this whole system is what the do event call in wake-events is for.
ok, in that case you can insert an event handler, which will be run 
before the default one.
there you can trap the events exactly like the wake-event, and do 
what you want before the default event handling happens.
basically, if you return none, the event is consumed and not sent 
to view's default wake-event

if you return the event itself, the next input handler in the chain 
will be fired.
(next event handler being view's default wake-event)
Henrik
12-May-2009
[8683]
hmm.. basically what I have for detect is sitting now in the window-feel. 
So I could move it out into a separate function and use INSERT-EVENT-FUNC 
on it?
Maxim
12-May-2009
[8684x2]
give me a minute, I'll make you an explicit example in rebol code, 
from some source I have here  :-)
it actually takes less text to code it than to explain it.   ;-)
Henrik
12-May-2009
[8686]
ok, I'll go make a cup of chocolate :-)
Maxim
12-May-2009
[8687x2]
rebol []

ctx: context [
	coord: none
	handler: insert-event-func [
		; disable half of the window's events
		if event/offset/x > (event/face/size/x / 2) [
			probe event/offset
			event
		]
	]
]


window: view layout [button "ok"]
note: 

-if returns none when it doesn't match, so that is returned from 
the handler.

-I put the handler within a ctx, just to allow for local vars within 
handler (which I don't use, but figured I'd demonstrate, for all 
to see)