Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
MrCheviot
Novice


Joined: 02 Dec 2007
Posts: 42

PostPosted: Tue Mar 11, 2008 11:37 pm   

Moving Window Focus
 
First, this isn't about using ":" to shift command focus. I know how to do that, as it's useful when clicking on buttons in secondary/status windows to have a command executed in the main window.

My question is more related to clicking on MXP links in a secondary window. Say I have a list of MXP options that appear based on content in the main session window. Could be an action to cast a spell, walk to a room, whatever. If you click on the MXP link, the action does occur in the main session window. However, you then have to click in the main session window to resume typing commands. Sometimes if the command you're executing has a processing lag, you can click in the main window, only to have focus shift away once the command has completed processing.

Is there a way to use zscript to change the focused window to main session window after clicking on something in another window? This isn't an issue for clicking buttons in the statusbar as focus never changes when this happens.

BTW, I've tried appending an alias with #menu {Window|1} in it to the mxp commands with no luck.

Any ideas? Thanks,

-Mrc
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4715
Location: Pensacola, FL, USA

PostPosted: Wed Mar 12, 2008 12:44 am   
 
#WIN %item(%names, 1)
_________________
Discord: Shalimarwildcat
Reply with quote
MrCheviot
Novice


Joined: 02 Dec 2007
Posts: 42

PostPosted: Wed Mar 12, 2008 1:16 am   
 
Uhm.. this doesn't work? In an alias both in main session settings and subwindow settings.

Code:
#alias mainWinFocus {#win %item(%names,1)}
#win subWin <send href="mainWinFocus">focus</send>


Click all you want. The focus shifts for an instant, then returns to window you clicked in (same behavior as #menu {window|1}

I suspect this has something to with "OnMouseClick()" type behavior of the <send>, so maybe there's a way to disable that?


-MrC
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Wed Mar 12, 2008 2:03 am   
 
Enable an alarm at the end of the script run by the click. The alarm should shift the focus where you want it and disable itself. This should get you out of the mouse click handler.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4715
Location: Pensacola, FL, USA

PostPosted: Wed Mar 12, 2008 2:05 am   
 
perhaps make a short alarm to change focus afterwards?

#ALA "mainWinFocus" +.5 {#WIN %item(%names, 1)}

time may need to be adjusted

bah, beat me to it
_________________
Discord: Shalimarwildcat
Reply with quote
MrCheviot
Novice


Joined: 02 Dec 2007
Posts: 42

PostPosted: Wed Mar 12, 2008 3:26 pm   
 
Nice.. +.2 works great for me. Hadn't thought of using alarm to delay it.

-MrC
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Thu Mar 13, 2008 12:25 am   
 
Change it to .501. .2 should not be firing at all, much less firing at the 200 millisecond mark (at least, such is the case for non-temporary alarms).
_________________
EDIT: I didn't like my old signature
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4715
Location: Pensacola, FL, USA

PostPosted: Thu Mar 13, 2008 1:07 am   
 
I believe I saw that that rule was only there for non temporary triggers...
_________________
Discord: Shalimarwildcat
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Thu Mar 13, 2008 1:32 am   
 
Yes, .5 seconds is the minimum for repeating alarms. As far as I'm aware, the minimum for one-time alarms is 0.001.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net