View previous topic :: View next topic |
Author |
Message |
sparge
Joined: 11 Apr 2005 Posts: 371
|
Posted: Tue Nov 03, 2009 5:56 pm Post subject: Monitoring which of several MDI child windows has focus |
|
|
Hi all! It's been a while since I looked in this forum, because I haven't done any work with FTN95 for quite a while; it's good to be back. I've picked up an app I haven't looked at for some time, and I'm trying to grasp a nettle that I shied away from last time.
The app is a basic image processing app, so it creates a number of MDI child windows within the main window, each containing a %gr graphics region with the same associated callback. The main purpose of this callback is to monitor use of the mouse to select a rectangular region of interest within a specific graphic region, and it does this just fine.
For various housekeeping reasons, I want to be able to keep track of which of these windows currently has focus. ClearWin+ provides clearwin_info@ ('FOCUS_WINDOW') which at first sight seems to be the answer - but only if it can be joined up with callback code that is activated when focus changes, and there's the rub. The only way I've found to do this so far is to kludge it! Provided I select a window by clicking in the graphics region, I can pick this up with the associated callback. Clicks anywhere else, in particular in the title bar (which is the intuitive place to click to select a window), I am as yet unable to identify. So I can change focus by clicking on the title bar, but ClearWin+ remains blind to this change unless or until I click in the graphics region. Suffice to say that this all too often causes my app to terminate disgracefully.
Has anyone else wrestled with this problem and come up with a solution? Or can anyone see an obvious-with-hindsight wrinkle that is eluding me? TIA,
Andy |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7938 Location: Salford, UK
|
Posted: Wed Nov 04, 2009 11:59 am Post subject: |
|
|
Depending upon the application, one way is to have a different callback for each %gr region. Each one sets an ID and then calls the common callback.
If this does not fit your situation it would help if you could post a short sample. |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2391 Location: Yateley, Hants, UK
|
Posted: Fri Nov 06, 2009 1:42 pm Post subject: |
|
|
Perhaps the answer is for Paul to consider adding a callback option to %ca?
Having an option to make the caption bar to the left of its window, not on top, would make dockable toolbars much easier to program (I imagine).
Eddie |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7938 Location: Salford, UK
|
Posted: Fri Nov 06, 2009 2:39 pm Post subject: |
|
|
%ca just sets the Microsoft Windows caption text. There is no event that is associated with it apart perhaps the usual mouse events (movement over and clicking on the caption). |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2391 Location: Yateley, Hants, UK
|
Posted: Fri Nov 06, 2009 4:24 pm Post subject: |
|
|
Hi Paul,
A fast response to an idle speculation, thanks. Back to the drawing board.
Eddie |
|
Back to top |
|
|
|