Hi Laurence,

Making selects within the SelChangedHandler is risky business, as one is constantly in 
danger of making a self-propogating, never
ending loop. But if you can select without affecting the current "selection", i.e. 
"select ... noselect", you're on safer ground,
but then off course you can't use the built-in Find Selection functionality.

My best suggestion is to either build your own "Find Selection" logic or disable all 
event handling whilest executing your logic in
the event handler. I recommend the first approach, but you might be able to get the 
other approach to work too.

The reason I generally discourage making potential recursive logic in an event handler 
is that I've seen too many examples where one
mbx works perfectly by itself, but crashes MIPro when working alongside other event 
handling mbx's. So having your mbx work is not a
guarantee against severe crashing later. Unfortunately MIPro's event handling model 
has a number of deficiencies we must live with
:-(

The necessary logic itself is off course rather simple: get some ID from the selected 
record and use that to get the records from
the original. Here's a piece of code that gives a rough idea of what to do, but one 
that'll certainly result in a never-ending loop:

Sub SelChangedHandler
    If SelectionInfo(SEL_INFO_TABLENAME) = MyOriginalTable Then
        Fetch First From Selection
        myID = Selection.myIDField
        Select * From MyOriginalTable Where myIDField = myID
        Run Menu Item M_QUERY_FIND_SELECTION
    End If
End Sub

Please beware of the pitfalls involved in working with SelChangedHandler. It's called 
every time a selection changes:
- when a selection is made
- when a selection is increased/decreased (e.g. when selecting multiple records with 
the Shift key)
- when a selection is cleared (also before a new replacement selection is accepted !)

You can use SelectionInfo and CommandInfo to determine what the current state is.

Best regards/Med venlig hilsen
Lars V. Nielsen
GisPro, Denmark
http://www.gispro.dk/
http://hjem.get2net.dk/lars-online/
WGS84: 10.20'40"E 55.20'20"N
----- Original Message -----
From: "Laurence Seeff" <[EMAIL PROTECTED]>
To: "MI-List" <[EMAIL PROTECTED]>
Sent: Sunday, December 29, 2002 2:14 PM
Subject: MI-L MB: SelChangedHandler


Seasonal greetings to all the list,

I have a simple problem that has me stumped.

I have a browser open (result of a SQL group query). When a record is selected in this 
browser (WindowId  is known), I want to
select all the records from the original base table and do a FindSelection on the map.

Thanks,


Laurence Seeff
Points Business Mapping Ltd.
22 Tuval St., Ramat Gan, 52522, Israel

Tel:  +972-3-6126216
Fax: +972-3-6126323
Email: [EMAIL PROTECTED]
Web: www.points.co.il


---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 4705

Reply via email to