Dear List,

I have encountered some problems regarding the WindowFocusChangedHandler
procedure.

My application creates a button pad, which has some custom buttons. Some of
these buttons should only be enabled when the main map window of the
application is active. This main map window is also set up by the
application on startup and a global variable, map_id, is assigned the main
map window's window ID.

During the application the user can invoke a custom button, on which the
main map window is cloned. With this new window having the focus some of the
custom button should be disabled, because the cloned window's only purpose
is to be placed into a frame in a layout window. Therefore no other
functions should be performed on this window.

To disable the buttons I use the WindowFocusChangedHandler procedure:

sub WinFocusChangedHandler
dim CurrentWindow as integer

'CurrrentWindow is the window that has the focus, map_id is the
'the main map window of the application

CurrentWindow = FrontWindow()
if CurrentWindow <> map_id then
        alter button id 10001
                disable
        alter button id 10009
                disable
        alter button id FROM_BUTTON
                disable
        alter button id 10002
                disable
else
        alter button id 10001
                enable
        alter button id 10009
                enable
        alter button id FROM_BUTTON
                enable
        alter button id 10002
                enable
end if
alter buttonpad "Concession Plotter"
        Show
end sub

Here when the active window is not the main map window some button become
disabled.

When executing this code in MapInfo the buttons do not become disabled
automatically when the cloned window gets the focus. Only if the user clicks
on the toolbar the state of the buttons changes according to what is written
in the WindowFocusChangedHandler procedure, showing that the code is
somewhat correct.

So, here the question: Why is the state of the buttons not updated
immediately when the active window changes ? How can I force this ? (I tried
to use the show method of the button pad explicitly, see code, but this did
not help.)


Thanks in advance for help and comments ...

Thomas G�lden
Diplom-Geologe

Email (privat):      [EMAIL PROTECTED]
Email (dienstl.):   [EMAIL PROTECTED]



----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

Reply via email to