----- Original Message -----
From: Guy Matters <[EMAIL PROTECTED]>
To: 'MapInfo List' <[EMAIL PROTECTED]>
Sent: Thursday, April 13, 2000 12:06 AM
Subject: MI Problems with SelChangedHandler


> We have had a link written in MapBasic between MI and a third party
product.
> It uses the Windows DDE.
>
> Unfortunately it causes the MI cursor to change from the "Normal Pointer"
to
> the "Move object cross hairs".
>
> This has led to accidental movement of map objects.
>
> We have isolated the cause to the SelChangedHandler.
>
> > I can cause this behaviour with about 3 lines of MapBasic
> >
> > See attached
> >
> > Run this when you have a map in editable mode
> >
> > The problem is that any event that causes the event handler
> > "SelChangedHandler"
> > to wait more than about .1 seconds shifts MapInfo into Move mode.  I
don't
> > think
> > this is nice behaviour.  It has nothing to do with how long the mouse is
> > held.
> >
> >
> >  <<TestSelect.MB>>  <<TestSelect.MBX>>
>
> Does anybody out there have a work around?

Err, yeah. Redesign your application. ;)

SelChangedHandler should not open new windows.

The only things (*) you should do in a SelChangedHandler is
check the selection, and enable or disable menu items and
buttons based upon what's selected.

You don't want your application to immediately go and
perform an action upon selection, because if somebody
selects the wrong thing, your SelChangedHanlder will
perform its action on the wrong thing.

When you use SelChangedHandler, you are assuming your users
will use the following sequence of actions:

1. Select one or more items using one of the selection tools.
2.  Maybe select more items or remove items from the selection
using SHIFT, CTRL, and one of the selection tools.
3. See what buttons and menu items become enabled or disabled
(because you enabled or disabled them in SelChangedHandler).
4. Select a menu item or button to perform the action.

If you really need something to happen as soon as somebody
selects something in a Map window, you should consider
putting the action in a ToolButton instead of putting it in the
SelChangedHandler.

Call the SearchPoint() and SearchRect() functions in the handler
for your ToolButton to select objects in the MapWindow based
upon the location(s) that were chosen.

Hope this helps,
Spencer


(*) Sometimes it's ok to do select statements inside a
SelChangedHandler.  But if you do, make sure you either:

1) turn the SelChangedHandler off as soon as you enter it,
and turn it back on just before you exit, or
2) use NoSelect on your select statements.

----------------------------------------------------------------------
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