Why doesn't HasFocus() work properly in BP?

BlitzPlus Forums/BlitzPlus Programming/Why doesn't HasFocus() work properly in BP?

sswift(Posted 2004) [#1]
http://www.blitzbasic.com/codearcs/codearcs.php?code=853

There's the function to which I refer. I didn't write it, someone else did. Basically if I remember correctly in Blitz3D it would return the number of the active window if the app had focus, or 0 if it did not.

But in BP it doesn't seem to work at all, at least when you have a window with a canvas rather than being in fullscreen mode.

I know there are alternative ways in BP to find out if the window has lost focus, but it sure would be nice if stuff I've grown accustomed to using would continue to work. It would certainly make it more likely that my code would work if ported back to BLitz3D.


pantsonhead.com(Posted 2004) [#2]
Sounds like you don't really like BlitzPlus commands.
Remember that BlitzPlus IS a different application with different features.
If you can't get your head around the changes I suggest you write some wrapper functions that emulate what you're used to (and quit complaining already).


sswift(Posted 2004) [#3]
My other thread was a complaint. This one is a question.

And it's not the fact that I don't like the Blitzplus commands. It is that it is inconsistent. Stuff that works in fullscren mode stops working when you switch to windowed mode unless you set windowed mode with the graphics commands, but then you can't have maximize minimize and close buttons. Well unless you allow the window to be resized. I think. Why is there no close button aon a non resizeable window? Because BP won't return an event if you click it if you set the graphics mode with the graphics command instead of creating a window with a canvas? Why? That's inconsistent.


sswift(Posted 2004) [#4]
It seems that HasFocus does not work when the app is minimized, but it will work otherwise. This is different from the behavior of Blitz3D.

In other words, if the app is open, and you click on another window, hasfocus will return false. However, if the app is minimized, it will not return false. Nor will it return false if another app is clicked on while it is minimized. It will only tell you if the app has lost focus when the app is actually in a non-minimized state.


pantsonhead.com(Posted 2004) [#5]
Sounds like an autosuspend issue
http://www.blitzbasic.com/bpdocs/command.php?name=AutoSuspend&ref=2d_cat


sswift(Posted 2004) [#6]
Interestingly AppSuspend doesn't do anything at all. Just tested it. In my main loop, I made a debuglog that writes random numbers to the debuglog. SetAppSuspend True after I set my window up... when I minimize, the program continues writing numbers to the debug log. I dunno if this applies outside of debug mode or not, but in debug mode it apparently does nothing, and even if it will work outside of debug mode, I don't think I want to use it because that will make debugging that much more difficult.


pantsonhead.com(Posted 2004) [#7]
Did Blitz still have focus or did you switch to another application?
I suspect it suspends when the application loses focus rather than the window (but I haven't tested it).


sswift(Posted 2004) [#8]
See the Blitzplus bugs section. I described the issue in detail. It only has the problem when in debug mode.

You migth be right about the cause though. But I do not consider the debug window to be a part of my app. That is part of the IDE, and if I crash my app, I would expect not to take down the debugger as well, nor would I expect to be able to access the sebug window from within my app or add menu items to it. So why should it affect whether the app has suspended or not?

I'm sure it's a complicated issue that I don't have a proper understanding of, and it may not be fixable, but it would be nice if there were a way to solve the problem.


Eikon(Posted 2004) [#9]
@Sswift: To define window styles

http://www.blitzbasic.com/Community/posts.php?topic=27958