[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Bug reports
. . -> [Subject]  GetFocus without LoseFocus possible
Home  |  Users  |  Search  |  FAQ
Register forum user name
Forgotten password?

GetFocus without LoseFocus possible

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Posted by Hve   Germany  (11 posts)  [Biography] bio
Date Sat 29 Jan 2005 08:24 PM (UTC)
If a world has focus and I switch to a dialog modal (i.e. Configuration[Alt+Enter], Find[Ctrl+F], Generate Character Name[Ctrl+Alt+N], or many others), the world does not lose focus (or at least the "Loose Focus" script function is not called).
If I close that dialog, however, the "Get Focus" function *is* called.
This way, a world may get focus several times in a row without losing focus inbetween.

Also, when clicking the Help button e.g. in the Configuration dialog, LooseFocus is called.
When switching to Mushclient again (still with configuration dialog in foreground), LooseFocus is called a second time.
Closing configuration dialog causes GetFocus (once).

- Technically, these dialogs should all trigger "Loose Focus" in order to have matching Get and Loose counts.
At least it should be prevented that LooseFocus or GetFocus are called twice in a row (e.g. add a flag to each world window with the info, which of these may be called next)

- It might be desireable though to neither loose nor get focus in connection with these dialogs (i.e. the get/loose functions should be called only if the change of focus goes to/from another world or to/from another application but not to some "meta" part of the mushclient application)

- combination of the above: Have a configuration option
"[x] Call Get/Loose Focus for MUSHclient dialogs"
[Go to top] top

Posted by Shadowfyr   USA  (1,783 posts)  [Biography] bio
Date Reply #1 on Sun 30 Jan 2005 08:11 PM (UTC)
Well.. I suspect that this is a Windows issue, not Mushclient. I seem to remember that Windows, in some circumstances, will cause multiple focus messages, depending on what sorts of windows you go between, etc. Its confusing and somewhat inconsistent, but I am not sure Nick can fix it.
[Go to top] top

Posted by Hve   Germany  (11 posts)  [Biography] bio
Date Reply #2 on Tue 01 Feb 2005 06:22 AM (UTC)
Hm, I had already imagined something like that.
What I wanted to do, was setting an away message when I'm gone and removing it when I'm back.
I'm about to make my own wrapping now like this

sub OnLooseFocus()
if (world.GetVariable("FocusAway")=0) then
world.send "away He's doing something else"
end if
world.setvariable "FocusAway",1
end sub

sub OnGetFocus()
if (world.GetVariable("FocusAway")=1) then
world.send "away"
end if
world.setvariable "FocusAway",0
end sub

In fact, I think I'll additionally use a one-shot timer in OnLooseFocus so that the away message will only be set if the world looses focus for more than a minute or so--just to avoid lot's of commands when I'm just checking for mail for a couple of seconds or so.
Thanks anayway,

[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum

[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]