Scott,

A ReadControlValue() function call is only valid while there is an active
dialog box. So you can't use it in the handler for the OK (or Cancel
buttons). Instead you need to use an INTO clause in the Control ListBox, as
follows.

 CONTROL ListBox
      WIDTH 100
      HEIGHT 100
      ID 100
      TITLE FROM VARIABLE arrMenu
        INTO iItem              'you can then use the value of iItem to
identify which item in the list was selected
                                ' & don't forget to Dim it

'***OTHER CHANGES
'***change the call to COMMANDINFO(CMD_INFO_DLG_OK):-

 IF COMMANDINFO(CMD_INFO_DLG_OK) THEN
        If ASK("Quadrant is about to be deleted from the AVL menu
list.","&OK","&Cancel") THEN
          CALL okhandler(iItem)         'pass the index of selected item to
handler
        ELSE
          Dialog Preserve               'no need to call the dialog
procedure recursively
        END IF
 ELSE
   Dialog Preserve
 END IF

'***the handler would then look like:-
SUB okhandler(ByVal c_id AS INTEGER)

Open TABLE v_table
DELETE FROM NewView WHERE RowID = c_id 
COMMIT TABLE NewView

END SUB

'*** procedure declaration needs to be changed too
'**************************************

Hope this is clear and helpful.

Keith



-----Original Message-----
From: Scott Walsh [mailto:[EMAIL PROTECTED]]
Sent: 04 June 2001 21:34
To: [EMAIL PROTECTED]
Subject: MI-L Dialog and Tables
Importance: High


Hello All!

I'm new to MB and MI and am having difficulty trying to do something and
need help!  I've created a dialog box which loops through a table and
displays the name of the View(s) that are in the table to the user in a
list box.  The table structure is as follows:

Table Name:  NewView
Fields:  TableIndex, ViewName Char(30), Lan Float, Lon Float, Zoom
Float....so i'm getting the Lon and lat and zoom of the current map and
storing it in the Table...when the user adds a view...anyway....

Below I'm attempting to display the names..which seems to be
working...then when a user clicks on a name in the listbox I'm trying to
get the ReadControlValue of the control (listbox) and compare it to what
is in the Table to REMOVE that Row from the table...so the next time the
user brings up the dialog the name they deleted should not be
there...does this make sense?

Thanks everyone!
Scott



SUB AVLVEH_quadrant_delete_dialog

DIM prompt AS LOGICAL
DIM v_name AS STRING
DIM ii AS INTEGER                   'counter
DIM l_value as INTEGER

OPEN TABLE v_table  'opening the table   Path is declared at top...

FETCH First FROM NewView                        'Looping throught
pulling out the values in the table   NewView is the table name
ii=1
DO WHILE NOT EOT(NEWVIEW)
  REDIM arrMenu(ii)
       arrMenu(ii) = NewView.viewname
  FETCH Next FROM NewView
 ii = ii + 1
Loop

Dialog
     TITLE "Delete Quadrant"
     WIDTH 112
     HEIGHT 160
 CONTROL ListBox
      WIDTH 100
      HEIGHT 100
      ID 100
      TITLE FROM VARIABLE arrMenu
 CONTROL OKButton
      TITLE "&Delete View"
      POSITION 30,120
      ID 101
      CALLING okhandler
'------------------------------------------------------
 CONTROL CancelButton
      TITLE "&Exit"
      POSITION 36,140
      ID 103
 IF COMMANDINFO(CMD_INFO_DLG_OK) THEN
  'prompt=ASK("Quadrant is about to be deleted from the AVL menu
list.","&OK","&Cancel")                 'Commented out for now...but am
having trouble getting to work
   'IF prompt = FALSE THEN
        'b/c the dialog needs to be open in order to get the
    'CALL AVLVEH_quadrant_delete_dialog
        'ReadControlValue
   'ELSE
    'CALL okhandler
   'END IF
 END IF

END SUB
'----------------------------------------------I'm not sure about this
SUB...
'---------I want to take the id of the user selection from the dialog
list box..loop through the table and delete the row.....i'm confused...

SUB okhandler

DIM c_id AS INTEGER
DIM ii AS INTEGER

c_id = ReadControlValue(100)  'Gets the value of the item selected (1
for the first, 0 if none selected)


Open TABLE v_table
DELETE OBJECT FROM NewView WHERE TableIndex = c_id  '----doesn't seem to
work?????
COMMIT TABLE NewView

END SUB




_______________________________________________________________________
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, send e-mail to [EMAIL PROTECTED] and
put "unsubscribe MapInfo-L" in the message body.


This email and any attached files are confidential and copyright protected.
If you are not the addressee, any dissemination of this communication is
strictly prohibited. Unless otherwise expressly agreed in writing, nothing
stated in this communication shall be legally binding.




_______________________________________________________________________
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, send e-mail to [EMAIL PROTECTED] and
put "unsubscribe MapInfo-L" in the message body.

Reply via email to