Page 1 of 1

PostPosted: Tue Jan 14, 2003 1:48 am
by FrappyDan
I'm wondering. I am able to hide my sipButton and all that but like you said awhile back, when I switch applications and then switch back I have the little sucker come right back. I have inserted a timer that calls hideButton() every 10 seconds incase something should bring it back. My question really is because there is not a real event in PocketC that informs event() of a lost focus or got focus event, and your events are supposedly DUMMY events for PCForm how can I actually tell when my program has been switched from and then back to? Is there a real lostfocus and gotfocus routine that one could use for this so they wouldn't have to continually update a control that might not need to be updated? Does a constant call to hide the button (lack of way to read if it's hidden or showing) allow for a possible eventual error or other problem?, or does the export check to see if it's really showing before actually hiding it?


PostPosted: Tue Jan 14, 2003 7:59 am
by guy
There are get/kill focus notification events for some controls, but not for the main window.

All that the hide functions do is move the thing that you're hiding to the bottom of the Z-Order (under all other windows). It shouldn't be a problem if you keep doing that even when the object is already at the bottom of the Z-Order.

What you <i>can</i> do is call the API function GetForegroundWindow()to get the active window and compare that to the main window handle. That will tell you whether your app is on top or not. The way that PCForm generates the get/kill focus events is to compare the current focus with its previous value each time the event loop iterates.

Mickle was looking at WM_ACTIVATE messages, but there was a problem with the app locking up. I don't know whether he has resolved this yet.

PocketC CE API interface:
PCForm and CE API forum: