G'day Andrew

As I read your request:   You want to click on an object on the map,
then a dialog appears, with the fields from the record at that point
(the same you used to input the data in the 1st place), by which you can
edit the fields (columns).  So I'm assuming you know how to save the
data, from the dialog, when you click OK.

Just been doing this sort of stuff myself.  Here is an example of an
"Info tool" button I use to enable users to click on a "facility" on the
map and display its details in a dialog:

Create ButtonPad "Facilities" As
 ...
  ToolButton  
    HelpMsg "Click this to select Facility to display its
Details\nFacility's Details Info Tool" 
    Calling GET_FAC_DETS
    ID DISP_FACS_DETS_BUTTON_ID
    Icon  327 file FILE_DLL_ICONS
    Cursor   MI_CURSOR_CROSSHAIR 
    DrawMode DM_CUSTOM_POINT
...

Then the code to react to the info tool clicking on a facility:

Sub GET_FAC_DETS
' ______________
  Dim lcTableName, lcZG, lcDesc, lcFilePath as String, 
      llFound                         as Logical,
      lnNumObjects, lnRowID, lnZone   as Integer,
      I, lnFacCode                    as SmallInt,
      lnX, lnY                        as Float

  lnX             = COMMANDINFO( CMD_INFO_X)
  lnY               = COMMANDINFO( CMD_INFO_Y)                ' where've
we clicked?
  lnNumObjects    = SEARCHPOINT( FrontWindow(), lnX, lnY, )     ' any
object where we clicked?
  If lnNumObjects = 0 then                                  ' Missed!
      BEEP
      EXIT SUB
  Else
      llFound     = FALSE
        I           = 1
        Do while I <= lnNumObjects 
                and   not llFound  
'       there may be several map layers at this point.  Make sure got
the one you want
'       _________________________________________________________
          lcTableName  = RTRIM$( SEARCHINFO( I, SEARCH_INFO_TABLE))
          If lcTableName <> "FacMast" then
                I          = I + 1   ' not the one we want
        Else
            Set ProgressBars Off
            llFound  = TRUE
            lnRowID  = SEARCHINFO( I, SEARCH_INFO_ROW) ' row ID number
of the object that was a hit
            Select * from FacMast
              Where RowID = lnRowID     
              into csrFacMast
            If TableInfo( "csrFacMast", TAB_INFO_NROWS) > 0 then        
            Fetch first from csrFacMastPlus

'           ... Now get the data from this row/record and put the values
into vars.  
'           ... The display dialog must be in the scope of the vars,
i.e. they're global, 
'           ... or local but defined at the module level. I expect
you've already got the code.  E.g.

            lnFacCode   = csrFacMastPlus.Fac_Code
            lnZone      = csrFacMastPlus.Zone
'           ... Sometimes I need to feature on the dialog look-up
values, given by the rec's FKs
            Select Desc from FacDesc
              where FacDesc.Fac_Code = lnFacCode 
              into csr1 NoSelect
            If TableInfo( "csr1", TAB_INFO_NROWS) > 0 then      
                Fetch First From csr1
                lcDesc    = RTrim$( csr1.Desc)
                Update csrFacMastPlus
                  Set FT_Desc = lcDesc        
            End If
            ...
'           This is your existing dialog for inputting your values.  It
must be able to "see"
'           the variables set up above.
            Call FAC_DETS_DIALOG 
        End If  ' lcTableName <> "FacMast"
      Loop
  End If        ' lnNumObjects = 0 
End Sub

HTH

Terry McDonnell

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

Reply via email to