 |
Anaristos Sorcerer
Joined: 17 Jul 2007 Posts: 821 Location: California
|
Posted: Thu Jul 08, 2010 10:38 pm
[322B+] Window management enhancement wishlist |
In order to improve the performance and execution predictability of scripts (and to do certain things not possible now) I would like to propose the following enhancements:
#SETFOCUS command - This command would transfer ownership of the focus to the designated window. It would have the following format:
Code: |
#SETFCOUS [windowname]
|
where windowname would be the name of the target window. If no name is provided, the session window would be the target.
%focus([windowname][,value]) function - This function would return the window name of the window currently owning the focus and optionally transfer focus ownership to the window specfied by windowname. The optional value would cause the function to do the following: < 0 -> remove the window from the focus list, 0 -> give focus ownership only, and > 0 give focus ownership and add to focus list. The default is 0. The session window would not eligible for removal from the focus list.
This is a bit obtuse so let me show some of the intended usages:
Code: |
$wname = %focus() // Return the name of the window currently owning the focus.
;;
#CALL %focus(%session.WindowName) // Transfer focus ownership to the session window.
;;
$wname = %focus(%session.WindowName) // Transfer focus ownership to the session window and return its name.
;;
#CALL %focus($wname,-1) // Remove the window from the focus list.
;;
|
.
Why do we need this? Well, let's say one is dynamically updating a secondary window from script (i.e. writing event-generated data to the window), what will happen when the secondary window is updated is that the session window will permanently lose focus. In previous versions of CMUD this didn't matter much (or had not a very big impact) because the command line was a separate window and it always had focus (a keystroke would return focus to it, though the window with the "actual" focus would mantain "ownership"). This allowed one to continue secondary window updates while typing on the command line (the command line of any window of interest). This is no longer possible because the command line is part of the main session window (or any window of interest) and shares its focus ownership, so any update to a secondary window will force the user to click on the main window (or any window of interest) to regain control of the command line. The above proposition would solve this problem by having the update script save the focus ownership prior to the update and restore it afterward. Another non-trivial example would be the prevention of output misdirection caused by the clicking of a non-target window. For instance, the clicking of a window tab gives focus to the selected window causing any running scripts sending data to window A having that data displayed on window B. Focus management would prevent this.
Notice that if the window is removed from the focus list, updates to the window would not be prevented.
In essence, this enhancement would allow scripts to have direct control over focus ownership. This control would be exerted at a level lower than execution control so that the script execution itself would not be affected. That is, focus management would not affect scoping.
This focus management needn't be used (would not be required), if the writer is satisfied with the way things work out then that would be fine. The enhancement would be geared to those with the need or desire for a finer-grain script management.
I am sure some of you will think that this is not necessary or that it is overkill. Still I would like this suggestion to be taken under consideration. |
|
_________________ Sic itur ad astra. |
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Thu Jul 08, 2010 11:28 pm |
I think you can already do this.
Using "#WINDOW name" should set focus to the named window (and yes, it creates the window if it doesn't exist). The %curwin variable should return the name of the window that currently has the focus.
Not sure what you mean by a "focus list" but Windows doesn't have any concept like that so I doubt I could do anything like it. Remember that we are at the whims of Windows when dealing with stuff like keyboard focus. If you click on something, it gets the focus. |
|
|
 |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|