Martin,

Yes, you're right. What I should have said is that the ReadControlValue
function couldn't be used following the call to COMMANDINFO, because the
dialog box was not active at the time.

So an alternative to my suggested alterations would be to remove the  'IF
COMMANDINFO(CMD_INFO_DLG_OK) THEN' statement altogether and change the
okhandler to:-

SUB okhandler

        If ASK("Quadrant is about to be deleted from the AVL menu
list.","&OK","&Cancel") THEN
                DELETE FROM NewView WHERE RowID = ReadControlValue(100) 
                COMMIT TABLE NewView
        ELSE
          Dialog Preserve
        END IF

END SUB

Probably much neater.

Keith



-----Original Message-----
From: Martin Hodder [mailto:[EMAIL PROTECTED]]
Sent: 05 June 2001 09:54
To: Campbell, Keith A; 'Scott Walsh'
Cc: 'MapInfo-L (E-mail)
Subject: Re: MI-L Dialog and Tables


Keith,

You wrote:-

>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).

This is not strictly true. When you press the ok and cancel buttons it can
call a handler.
This hander will actually query the form before it is removed. it give the
user an oppotuninty to check values
once OK is press and have the option of using "dialog preserve" to keep in
on the screen if a wrong value is entered.

This is useful for data validation purposes. I hope this makes sense!

Regards

Martin

----- Original Message -----
From: "Campbell, Keith A" <[EMAIL PROTECTED]>
To: "'Scott Walsh'" <[EMAIL PROTECTED]>
Cc: "'MapInfo-L (E-mail)" <[EMAIL PROTECTED]>
Sent: Tuesday, June 05, 2001 9:26 AM
Subject: RE: MI-L Dialog and Tables


> 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.
>



_______________________________________________________________________
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