World: r3wp
[View] discuss view related issues
older newer | first last |
TomBon 16-Jul-2010 [10016] | is there a programmtically solution to 're-center' the toplevel-face on the os-desktop after a face reseize? |
Henrik 16-Jul-2010 [10017] | you can add an event function to the window and trigger it on event/type = 'resize and then move the window according to its current size versus system/view/screen-size (or some such) |
TomBon 16-Jul-2010 [10018x2] | yes, nice idea henrik. this way I don't have to take care for every resize. thx... (so the path 'system/view/screen-size' looks don't exists, will check) |
just found it -> system/view/screen-face/size | |
Henrik 16-Jul-2010 [10020] | couldn't remember, so was betting you could find it yourself :-) |
TomBon 16-Jul-2010 [10021] | thx henrik ;-) |
Henrik 16-Jul-2010 [10022] | remember to use remove-event-func with the function again, when the window closes, otherwise amusing (depending on your mood) things happen. |
Anton 16-Jul-2010 [10023] | There is an AGG group, but there may be cause for a new "Draw dialect" group. |
TomBon 16-Jul-2010 [10024] | how to detect - which face - is envoking an event within a global insert-event-func? |
Henrik 16-Jul-2010 [10025] | do you want the face or the window? |
TomBon 16-Jul-2010 [10026x3] | window |
so I have to filter the correct event (resize) and object (the window/face) to calculate the new pos on the desktop. | |
something like this... insert-event-func [ switch event/type [ key [] time [] close [] offset [] resize [ switch event/face [ X [recalculate pos for face x] ... ... ] ] scroll-line [] scroll-page [] up [] move [] down [] active [] inactive [] alt-down [] alt-up [] minimize [] maximize [] ] event ] | |
Henrik 16-Jul-2010 [10029] | the window face name usually works, if you differentiate the names of the windows. |
TomBon 16-Jul-2010 [10030] | ?? |
Henrik 16-Jul-2010 [10031] | try probing face/text and see if it matches the window name |
Maxim 16-Jul-2010 [10032] | resize events only occur for windows... no? |
TomBon 16-Jul-2010 [10033] | don't know sure but is there no event/object message? |
Henrik 16-Jul-2010 [10034] | event/face perhaps |
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 [10065] | 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? |
older newer | first last |