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

World: r3wp

[View] discuss view related issues

Maxim
26-May-2010
[9912x3]
here is how it works..... I had to stumble upon this within GLASS.


when you add a rate to a face, actually, the timer will trigger 30 
times a second, no matter what your rate is.

do event

will filter the events based on what your rates are set up.
because detect is part of the wake-event system, it gets all the 
events from the input stream, so you end up with all time events.
it was done this way so view can share the same time event among 
many faces, internally.
Henrik
26-May-2010
[9915]
ok, I see.
Maxim
26-May-2010
[9916]
It took me quite a while to figure out what I called "Time event 
madness"  ;-)
Henrik
26-May-2010
[9917]
ok, the "do event" thing? when do I apply that?
Maxim
26-May-2010
[9918x2]
that managed within the do-event of wake-events.


the fact that  detect is called, means do event was called.  whenever 
a detect returns false, it consumes the event and subfaces do not 
get their events (even time IIRC).
sorry...  "that managed within the do-event of wake-events"  should 
read

that's managed within view's port wake-event
Steeve
26-May-2010
[9920]
IIRC the corrected time event is kept by engage, not detect.
Maxim
26-May-2010
[9921]
exactly.
Henrik
26-May-2010
[9922]
ok, I've added a delay handler, but it seems a bit wasteful to do 
it this way.
Steeve
26-May-2010
[9923x2]
use engage not detect to trap the time event accordingly with the 
rate
and after changing the rate of a face you need to issue immedialty 
a SHOW on the face
Henrik
26-May-2010
[9925]
hmm...
Steeve
26-May-2010
[9926]
using detect slow down your app, avoid it if you can
Maxim
26-May-2010
[9927]
detect should only be used to trap events to sub-faces.   as Steeve 
notes, engage is where you should really be handling the events.
Henrik
26-May-2010
[9928]
I'm messing around in the detect function for the main window.
Maxim
26-May-2010
[9929x2]
aaahhhh lots of "fun" isn't it   ;-P
you might be better of using an input even handler, its faster cause 
it proceeds at the very start of do events... before it starts looking 
at faces within panes.
Henrik
26-May-2010
[9931]
seems that engage has no effect. so you are not supposed to be able 
to use engage and detect at the same time in the same face?
Maxim
26-May-2010
[9932]
it depends what you return from detect.  if you return none, it consumes 
the event, if you return the event, then engage is called.

that's how its supposed to work, AFAIK.
Henrik
26-May-2010
[9933]
I return the event, yet nothing happens. Oh, well, I've studied RebGUI 
code and it does the same thing as I do.
Maxim
26-May-2010
[9934x2]
strange.
what are you trying to achieve?
Henrik
26-May-2010
[9936]
I just want a delay before displaying a tool-tip anywhere in the 
window.
Maxim
26-May-2010
[9937]
you do know that the window feel is replaced everytime it is viewed?
Henrik
26-May-2010
[9938]
yes, I take care of that just fine. I've made plenty of modifications 
to the detect function for window already.
Maxim
26-May-2010
[9939]
ok, just reminding you,  its bitten me in the arse a few times, even 
if I know about it  ;-)
Henrik
26-May-2010
[9940]
yes, it's not easy, however everything is working as expected, except 
for time events and the use of engage.
Maxim
26-May-2010
[9941x2]
its possible the window cannot have time events, no matter its rate. 
 try using a master face in which you put everything, using its feel 
instead.


the window is managed differently than other faces by view... it 
has its own events like resize and stuff, so I wouldn't be surprised 
that its time handling is different.
(I meant, support for time events in its engage)
ICarii
26-May-2010
[9943]
yes - iirc window does handle time differently and you should always 
use a master face
Henrik
27-May-2010
[9944x2]
Posted this in the OSX group, but it's private:


View bug: When getting a timer event in a DETECT feel, event/offset 
is 0x0 in OSX. In Win32 the event/offset during a timer event is 
correct. Can anyone confirm this under Linux?

f: make face [
	size: 200x200
	rate: 2
	offset: 100x100
	color: red
	feel: make system/view/window-feel [
		detect: func [face event] [
			print [event/type event/offset]
			event
		]
	]
]
view f
Anton
27-May-2010
[9946]
In View 2.7.7.4.2 in linux, the event/offset is set correctly when 
I mouse over the window.
Henrik
27-May-2010
[9947]
This is a bit confusing.... I get 'move events on a click, where 
I should get 'down. This occurs inside an insert-event-func function.
Maxim
27-May-2010
[9948]
yep.  rebol adds some move events when other events are generated. 
 you get them on mouse, window activation, and some others I don't 
remember.


its VERY annoying, though.  I think "do event" consumes some of them, 
but some go through and end-up within feel/engage anyways.

I've been battling these "stray" events for years.  :-(
Steeve
27-May-2010
[9949]
I used to filter them in my own insert-event-func handlers
Henrik
27-May-2010
[9950]
found a way to brute force it. not pretty, though...
Cyphre
28-May-2010
[9951]
IMO these 'unwanted' events are generated by the actual OS so I don't 
think we can do anything with this. But for example the 'move events 
on mouse click shouldn't hurt anything because the event/offset is 
still the same so your code should treat them as 'almost no-op'.
Henrik
28-May-2010
[9952]
Cyphre, I didn't get the 'down event at all, which is what confused 
me.
Cyphre
28-May-2010
[9953]
really? Under WinXP if I do 'mouse click' I'm getting this sequence:
down 58x47
up 58x47
move 58x47
Henrik
28-May-2010
[9954]
I'm not sure my setup was that simple (it's gone now).
Cyphre
28-May-2010
[9955]
I tested on this code:
insert-event-func f: func [f e][print [e/type e/offset] e]
view layout [box red]
remove-event-func :f
Anton
28-May-2010
[9956x2]
With the above code on Linux I see this:

move 77x78 ; Final move of mouse to a stop, then I wait a short time...
down 77x78 ; <- I click.
up 77x78 ; <- I release, and I wait...
move 77x79 ; I begin moving mouse again.
(That's using View 2.7.6.4.2)
Cyphre
28-May-2010
[9958]
Yes, so it looks windows is adding the 'move event after I release 
the button....seems like no big issue tome though.
Anton
28-May-2010
[9959]
If I remember correctly, Windows also inserts a 'move event before 
the 'down, doesn't it?
Cyphre
28-May-2010
[9960]
I don't see that behaviour on my system..only one additional 'move 
after 'up
Anton
28-May-2010
[9961]
Ok, probably my poor memory of it then.