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
[8655]
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
[8687x3]
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)
I remind myself, how complicated those few lines would be to implement 
in .net and I continue to say that rebol is still conceptually, if 
not in capacity, better than most solutions out there.
Henrik
12-May-2009
[8690x2]
I'm not sure it explains much, as you keep talking about consuming 
events. From what I gather from system/view/screen-face/feel, the 
event functions are just stacked in there and invoked using 'detect, 
which to me appears to be the same as the window-feel.
I.e. they would still be invoked in the reverse order of what I need.
Maxim
12-May-2009
[8692]
when you run the above, half of the windows events are consumed by 
the new event handler, since we return none on the left side of the 
window.
Henrik
12-May-2009
[8693]
yes, I can see that.
Maxim
12-May-2009
[8694x2]
you could instead trigger a function here, (if proper conditions 
are met) and return event all the time.
so your windows/feel/on-something would happen before it does its 
normal event handling
Henrik
12-May-2009
[8696]
That's exactly the opposite of what I want. It already does that. 
:-)
Maxim
12-May-2009
[8697]
but here, if the trigger is met, you can call the do event yourself 
and THEN call your function   :-)  by returning none, the normal 
view handler will then ignore the event (since you've already handled 
it)
Henrik
12-May-2009
[8698]
I really think I need this painted on a big card board sign, because 
I don't get it. Would the original detect first need to be blocked, 
then the engage would run and then we run the detect again?
Maxim
12-May-2009
[8699x5]
working on an exact example  :-D
somehow I can't seem to get the resize events in my window... that 
is strange.
I just realized I had a slightly skewed view of the event ordering, 
but in essence the above still holds.
darn, 8 years of view and I still discover some little tricks and 
details  ;-)
ok for your specific need, the easiest is to hack the wake-event. 
 the insert-event-handler event chain is triggered by of  "do event" 
 handling
Henrik
12-May-2009
[8704]
hacking the wake-event function?