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

World: r3wp

[View] discuss view related issues

Anton
21-Feb-2007
[6812]
When is the next release, by the way ? I ask because we keep stumbling 
on this same bug, and I think it's an easy one to fix, judging by 
how fast those other string bugs were fixed.
Gabriele
22-Feb-2007
[6813]
i guess when Carl manages to escape from thread prison ;)
Anton
27-Feb-2007
[6814x3]
Does anyone know a way how to detect when all rebol windows are inactive 
(ie. because a non-rebol window became active) ?
I can trap inactive events sent to a rebol window, but I want to 
know whether that was because another rebol window was activated 
or a non-rebol application window was activated.
If it is a rebol window, that window gets an active event --- but 
this is *after* the previous inactive event.
Henrik
27-Feb-2007
[6817]
another window in the same rebol process or a differen rebol process?
Anton
27-Feb-2007
[6818x2]
Same process.
I need something like a "none-active" event that lets me know when 
all rebol windows are inactive.
Henrik
27-Feb-2007
[6820]
I would like to know that too. A program I'm making has a timer mechanism 
where the program must be active all the time and I want to display 
an alert if the window gets out of focus.
Anton
27-Feb-2007
[6821x2]
Maybe the system port ?
Let me dig around...
Henrik
27-Feb-2007
[6823]
never messed with it
Anton
27-Feb-2007
[6824x9]
How many windows in your program ?
If only one, it's easy - just trap inactive event.

If more than one, and since you are running a timer, you can track 
the state of all windows and react when a timer event comes along 
after an inactive event which was not followed by an active event.
Probably that's my solution too - run a timer.
excellent, time events are still running even when all rebol windows 
are inactive. This means it's possible.
active-windows: []
insert-event-func event-func: func [face event][
	;print event/type 

 if event/type = 'active [if not find active-windows event/face [append 
 active-windows event/face]] 

 if event/type = 'inactive [if find active-windows event/face [remove 
 find active-windows event/face]] 
	if event/type = 'time [
		if none-active? <> empty? active-windows [
			none-active?: empty? active-windows
			if none-active? [
				print "all windows inactive!!"
			]
		]
	]
	event
]
view/new win1: layout [size 400x250]
view/new win2: layout [size 500x200]
win1/rate: 0 show win1 ; start time events
none-active?: false
do-events
Can you see any holes in this method ? (Apart from the fact that 
it requires time events.)
I discovered a problem when closing the first window which has RATE 
set. Now time events no longer flow and so the state isn't detected. 
But it is solved by catching the close event and setting RATE in 
a second window.
do http://anton.wildit.net.au/rebol/view/detect-all-windows-inactive.r
The above seems to be working satisfactorily. It has the limitation 
of setting the window/rate, though.
Maxim
27-Feb-2007
[6833x2]
I handle this by patching the wake-event func and checking if the 
screen-face/pane has any faces within (which is the pane which holds 
the windows).  when ever this happens, it means all windows are closed. 
 and so I quit with none which disables the do-events.
obviously I verify after the part which handles any close event types, 
to make sure I trap any event which would have unviewed the last 
window or popup.
Gregg
27-Feb-2007
[6835]
Seems like it should work Anton. Another way would be to catch the 
inactive event, set a "deadman switch" timer to go off shortly. When 
a window gets an 'active event, disable that timer.
Maxim
27-Feb-2007
[6836x3]
oops... "so I quit with none" above should have read... "so I return 
with none"
hum. isn't it possible to have decimal rates?  I just tried using 
0.5 and am getting no 'time events. is this normal?
(v 2.7)
Gregg
27-Feb-2007
[6839]
I believe it rounds them. If you want slower rates, use a time! value 
(e.g. 0:0:2 for every two seconds).
Anton
27-Feb-2007
[6840x7]
Maxim, catching all *inactive*, not simply closed.
Gregg, I'm working on that way now. For minimal impact, I only start 
time events if they aren't running already, and then I restore the 
window/rate after I catch the first time event.
This version uses the "deadman switch" timer idea and is working 
ok.

do http://anton.wildit.net.au/rebol/gui/demo-all-windows-inactive-handler.r
http://anton.wildit.net.au/rebol/gui/all-windows-inactive-handler.r
The reason I need this is for a pop-menu system (implemented with 
windows). When a completely different application window becomes 
active, I want to close all menues and submenues.
And it seems to be working for this application.. :) Now the long 
test...
oh no it's buggy. it works sometimes and sometimes not. Damn, time 
events are tricky.
Maxim
28-Feb-2007
[6847x2]
ahhh didn't notice the subtility.
thanks gregg
Brock
6-Mar-2007
[6849x6]
Has anyone done any work on the Rebol Desktop?
I have an application that might be able to make use of a local web-page 
like interface to launch Word Documents and web page links.
The current application (not my own) uses an HTML page to list all 
this information, but new versions of MS apps all open the .doc files 
in the browser window instead of launching Word.  The problem here 
is the .doc files contain macros that run when executed, but this 
does not happen through the browser.  The Word templates also get 
auto-updated if new versions are available, but this is handled by 
a secondary .exe file.
The templates are stored on the users local computer and essentially 
build sales documents based on basic user input.
Just wondering if this sounds like something that a modified desktop 
would be able to do.  I know this is exactly what IOS does, but this 
is overkill for this simple document generating tool.
I've created a [temporary] group called Desktop as that is likely 
a better place to discuss this topic.
Maxim
6-Mar-2007
[6855]
Hi all, anyone remember an easy to tell if the user called the action 
of a field from tab or enter?  


This is causing headaches in user comprehension... windows does not 
react the same way with enter and tab...


right now, pressing tab, triggers actions, which normally should 
only occur when "enter" is pressed.
Gregg
6-Mar-2007
[6856]
I think you have to override the feel.
Maxim
7-Mar-2007
[6857x2]
hahahahahah  the field's feel is a typical View obscurity built from 
hidden contexts which are only availble at boot time  :-(
we can loose 6 hours trying to map all that back up... maybe someone 
has already done it here?  I have the sdk, I could look into it... 
but its just a question of time... I've got more important code to 
write than searching for this right now.
Gregg
7-Mar-2007
[6859]
Yeah, the View system isn't the easiest thing to work with sometimes. 
OTOH, it's not so bad when compared to, say, writing Windows custom 
controls.
Maxim
7-Mar-2007
[6860]
Not saying its better else where  ;-) ... I guess I'll have to make 
a memoriser within a custom key handler callback in GLayout. that 
way within the action I can check if the last key press was tab or 
enter.  :-)
Anton
7-Mar-2007
[6861]
Maxim, FIELD's FEEL is not so obscure. You need to bind to CTX-TEXT 
and SYSTEM/VIEW, that's all.