Nicki,
 
If you read the Help file closely, you'll see that CommandInfo(CMD_INFO_ROWID) is supposed to be used within the SelChangedHandler.
So I guess MapInfo expects a change in the selection just to have happened. Showing a dialog or in any other way mingling with the user interface might move the change in the selection away from focus and so MapInfo is no longer able to "use" the CMD_INFO_ROWID attribute.
 
The question is why do you need the rowid from the base table ?
 
You have the selection and can easily update the object thru this table:
 
Fetch First From Selection
Do Until EOT(Selection)
    oPolygon = Selection.OBJ
    nRowID    = Selection.ROWID
 
    '...do what needs to be done
 
    Update Selection
        Set OBJ        = oPolygon
        Where ROWID    = nRowID
 
    Fetch Next From Selection
Loop

Peter Horsbøll Møller
GIS Developer, MTM
Geographical Information & IT
 
COWI A/S
Odensevej 95
DK-5260 Odense S.
Denmark
 
Tel     +45 6311 4900
Direct  +45 6311 4908
Mob     +45 5156 1045
Fax     +45 6311 4949
E-mail  [EMAIL PROTECTED]
http://www.cowi.dk/gis

"For enden af regnbuen..." - hvordan kommer man dertil og er det overhovedet muligt?
Læs mere om årets MapInfo konference på www.cowi.dk/mapinfokonference

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Nicki Cozens
Sent: Wednesday, August 30, 2006 4:21 PM
To: [email protected]
Subject: [MI-L] Help with commandinfo(CMD_INFO_ROWID) after a dialog iscalled please

 

Dear Listers

 

I have a number of procedures that are called from a menu bar.  One of the menu items allows the user to change the snapping tolerance of the node snapping tool I have created.  If the user selects a polygon and then runs the main node snapping tool it works ok (if a little slow – see previous postings!), however, if the user previously selects a polygon, then chooses to change the snapping tolerance via the menu, an error occurs back in the main node snapping routine when a CommandInfo is issued to find out the row id of the selected polygon. 

 

Can anyone shed any light on what is happening please – I think it is something to do with the OKbutton on the dialog changing the selection? 

 

Is there an easy way how I can get the CommandInfo(cmd_info_rowid) to find the row id of the selected polygon after the ok button has been clicked?

 

Here are the main snippits of code:

 

#######################################################################

Sub snaptolerance       ‘runs when user selects change tol. from menu

Dialog

      Title "Snapping Tolerance"

      Control StaticText

            Title "Please enter new tolerance (in m)"

            'Position 10, 10

      Control EditText

            Value 0.25

            Into gf_snaptolerance

      Control OKbutton

      Control CancelButton

End Sub

###########################################################################

Sub SnapNodes                       ‘runs when user chooses snap from menu

 

‘... the variable declarations go in here and some initializing

 

If SelectionInfo(SEL_INFO_NROWS) > 0 Then

      aSelName = SelectionInfo(SEL_INFO_SELNAME)            'eg "Query1"      gs_theselTable = SelectionInfo(SEL_INFO_TABLENAME)

      Note (gs_theseltable)   ‘just to check – this is showing table name

Else

      Note("The selection is now 0")                        'just to check

            ‘This is not showing so there are rows selected

End If

gi_myrowid = commandInfo(cmd_info_rowid)   ‘This is where the error occurs

 

###########################################################

 

The error that is returned is:-

CommandInfo: argument 2 out of range, corresponding to the last line shown above

 

Many thanks

Nicki Cozens

 

Nicki Cozens
Data Management Officer
Highways Development Control
Leicestershire County Council
County Hall
Glenfield
Leicester
LE3 8RA

 

 

 

_______________________________________________________________________

Leicestershire County Council - rated a 'four-star' council by the Audit Commission

_______________________________________________________________________

 

 

This e-mail and any files transmitted with it are confidential. If you are not the intended recipient, any reading, printing, storage, disclosure, copying or any other action taken in respect of this e-mail is prohibited and may be unlawful. If you are not the intended recipient, please notify the sender immediately by using the reply function and then permanently delete what you have received.

 

Incoming and outgoing e-mail messages are routinely monitored for compliance with Leicestershire County Council's policy on the use of electronic communications. The contents of e-mails may have to be disclosed to a request under the Data Protection Act 1998 and the Freedom of Information Act 2000.

 

The views expressed by the author may not necessarily reflect the views or policies of the Leicestershire County Council.

 

Attachments to e-mail messages may contain viruses that may damage your system. Whilst Leicestershire County Council has taken every reasonable precaution to minimise this risk, we cannot accept any liability for any damage which you sustain as a result of these factors. You are advised to carry out your own virus checks before opening any attachment.

 

 

_______________________________________________
MapInfo-L mailing list
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l

Reply via email to