Hi List
Pleas consider the following code. I'm interested in the variable,
lnODSID, which takes the index of the pop-up selected item. Now this is
dim'd at the module level and is thus "global" to all subs therein.
After I've selected an item (string with a code embedded in it), and hit
the "refresh" button, the call to REFRESH_ONDS_DETS_DIALOG first calls
PARSE_ONDS, which takes the selected array element and strips out the
code part, which is then used in finding the relative rec, for
redisplaying in the dialog.
At first I was reusing another var, which had been used to select a
particular rec from the same table, but the call to PARSE_ONDS crashed
with . There are only 2-3 values in the combo, but the variable remained
at 42, what it was when first used.
So tried using a different var, lnODSID. If I don't initialise it, it
is returned as 0 - so "subscript out of range" error (note thus ignoring
the initial set Value of 1). So I initialise it to 1, and all I get in
is array element 1 (so PARSE_ONDS doesn't crash) but only the first rec
in the table each time.
SO, essentially, the dialog isn't giving me the output I want. You may
notice that the dialog calls a procedure which then "recursively" calls
the same dialog, after removing it. But the error occurs before that,
i.e. before MB realises the dialog is to recurse.
I don't know of any other way of refreshing the dialog with new data.
Can anyone please explain this conundrum?
'ppreciate it
Terry McDonnell
------------------------------------
Sub ONDS_DETS_DIALOG
...
Dialog
...
Control StaticText
Position 15, 157
Title "&Other Services:"
Control PopUpMenu
Position 70, 156
Width 140
Title from Variable laZGsOnDServs
Value 1
Into lnODSID
' NOTE laZGsOnDServs and lnODSID "global" to this module
Control Button
Title "&Refresh"
Calling REFRESH_ONDS_DETS_DIALOG
Control OKButton
End Sub
'________________________________________________
Sub REFRESH_ONDS_DETS_DIALOG
' __________________________
note "lnODSID = " + str$( lnODSID)
lcODService = PARSE_ONDS( laZGsOnDServs, lnODSID )
Dialog remove
Select * from csrODS
where csrODS.Service = lcODService
into csrTempODS
Call ONDS_DETS_DIALOG
End Sub
'________________________________________________
Function PARSE_ONDS( tcODSArray() as String, tnODSSelID as SmallInt) as
String
' _________________
' Get the On-d Service ID from the global array of ID - Desc, used in
array for list box
' _________________________________
Dim lcOnDSString, lcODS as String,
lnEndPos as SmallInt
lcOnDSString = RTrim$( tcODSArray( tnODSSelID))
lnEndPos = InStr( 1, lcOnDSString, " - ") - 1
lcODS = Left$( lcOnDSString, lnEndPos)
' On-D S code part of string
PARSE_ONDS = lcODS
End Function
_______________________________________________
MapInfo-L mailing list
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l