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

World: r3wp

[View] discuss view related issues

Maxim
16-Jul-2010
[10035x2]
windows are passed in the event/face, that is sure... so if resize 
events occur only for windows, you should be pretty safe in assuming 
that in this case the event/face is always a window.
one thing though.  I've discovered that at low-level (view port wake 
event) resizing generates one event per mouse move.   


it sends all of them AFTER you finished resizing (pretty dumb) so 
you may end up with up to a 100 resizing events which are all, basically 
useless except for the last one.


I do not know if they are filtered out within the do-events (and 
thus within the event-func) but you should print out something to 
see if this is the case.
TomBon
16-Jul-2010
[10037]
event/face is dumping all.
Maxim
16-Jul-2010
[10038]
not sure I get what you mean...
TomBon
16-Jul-2010
[10039]
hmmm...face/size too.
Maxim
16-Jul-2010
[10040]
dumping?
TomBon
16-Jul-2010
[10041]
event/face is holding the whole objects not only the face specs...at 
least if I see rthe amount of data.
Maxim
16-Jul-2010
[10042]
yes it always does.  its the face object!
TomBon
16-Jul-2010
[10043]
yes, a probe looks like a data dump here. not like a standard face 
spec.
Maxim
16-Jul-2010
[10044]
which includes all the subfaces tree in pane
TomBon
16-Jul-2010
[10045x2]
yes but thjis is looking like much more than only the subfaces / 
panes etc.

well if I can intercept an eventtype, I should also be able to detect 
the face from where these events are coming from or not?
ahhh.. this works -> probe event/face/size
Maxim
16-Jul-2010
[10047x2]
yes the face triggering the event is in event/face... sorry, I thought 
it was obvious  ;-)
I just checked and the resize event is only triggered once within 
the event-func.
TomBon
16-Jul-2010
[10049]
/text seems like another identifier. 0is there a unique identifier 
I can set for each face? (e.g. a hidden tag field)
Maxim
16-Jul-2010
[10050]
I just checked and it as I remembered it, the event func only receives 
the top-level events for the window.
TomBon
16-Jul-2010
[10051]
maxim, yes I think you are so deep in lowlevel view ;-))
Maxim
16-Jul-2010
[10052]
so up/down events aren't triggered for subfaces, only the window.


so you can assume that the event/face is ALWAYS the window in which 
the event is being generated, NOT the face is could eventually be 
assigned to.
TomBon
16-Jul-2010
[10053]
so at least I can use the /text so make a simple switch identifier...
Maxim
16-Jul-2010
[10054]
(that's within the event-func)
TomBon
16-Jul-2010
[10055]
ahh...ok. just found /data wihich is user-defined. will use this 
to store a simple windows-indicator there.
Maxim
16-Jul-2010
[10056x2]
you don't have to.   the event/face IS a window... everytime.
the actual window face object.
TomBon
16-Jul-2010
[10058x3]
and if I have more than one windows open?
how can I select the right resize to the right window?
the insert-event-func is global, so mit will fire up also when other 
windows doing messaging or not?
or can't I see the forrest with all these trees :-)))
Maxim
16-Jul-2010
[10061]
I'm building a little working example... give me 2 minutes
TomBon
16-Jul-2010
[10062]
cool.. that would be great max.
Maxim
16-Jul-2010
[10063]
there are MANY ways to do this, and depending on the surrounding 
code you have this may or may not be optimal, but this should give 
you an idea of what is going on.

rebol [
	title: "resizing example"
]


insert-event-func 	[
    switch event/type [
        resize      	[
			if in event/face 'on-resize [
				event/face/on-resize
			]
		]
		down 		[
			; always a window title, even if clicking on a button.
			probe event/face/text
		]  
    ]
    event
]


view/new/options layout [button "nope"] 'resize

win: layout [
	button "ok"
]

win: make win [
	on-resize: func [
		/local subface
	][
		; window size is already set at this point.
		subface: pane/1
		subface/offset: (size / 2) - (subface/size / 2)
		show self
	]
	offset/x: 200
]

view/new/options win 'resize


do-events
TomBon
16-Jul-2010
[10064]
hey max cool, you are lighning fast! 

muchas gracias...!!
Endo
21-Jul-2010
[10065x2]
I have a weird question, decode-url function uses parse-url function. 
But there is no parse-url at all?? even if I copy & paste decode-url 
function and create another function it gives error "** Script Error: 
parse-url has no value". any idea?
I use R2.7.7
Henrik
21-Jul-2010
[10067x2]
Endo, decode-url uses parse-url from a different context. That's 
why you can't see the parse-url function.
context [
	invisible-func: does [print "moo"]

 set 'my-func does [invisible-func] ; this is how decode-url was written
]

>> my-func
moo
>> invisible-func
** Script Error: invisible-func has no value
** Where: forever
** Near: invisible-func
Endo
21-Jul-2010
[10069]
Ohh. I see. Thanks a lot.
Henrik
21-Jul-2010
[10070]
I can't remember where parse-url is, though. Possibly somewhere inside 
the system object.
Endo
21-Jul-2010
[10071]
any simple way to get the source of parse-url? or other hidden functions?
Ladislav
21-Jul-2010
[10072]
print mold get first second :my-func
Endo
21-Jul-2010
[10073]
Thanks, this works for parse-url (it is not the first word in function)
print mold get probe first fourth second :decode-url
Henrik
21-Jul-2010
[10074]
yes, it will help you see the source, although it won't help you 
find where it is. if source is all you need, then that's good.
Endo
21-Jul-2010
[10075x2]
yes right.

oh god, there is url-rules block in parse-url function which is also 
hidden :) I think I should write a function to get the source of 
a word! inside the context of the word.
but it is difficult to make it deep.
Ladislav
21-Jul-2010
[10077x2]
where it is: print mold bind? first second :my-func
where it is: print mold bind? first second :my-func
Endo
21-Jul-2010
[10079]
great. thanks.
Gregg
21-Jul-2010
[10080]
And for this case you can look in net-utils/URL-parser.
Maxim
21-Jul-2010
[10081]
guys.... why not try the function called.... source  :-)

source decode-url
Ladislav
21-Jul-2010
[10082]
Maybe because that is not what was needed?
Maxim
21-Jul-2010
[10083]
ok seems I missed a detail in reading the thread.
sqlab
22-Jul-2010
[10084]
A simple alternative
editor form    system