Thanks to David, Keith and Martin for their quick response! I just
wanted to let you all know what I ended up doing in the end. It appears
to be working!
Thanks Again,
Scott Walsh
State College, Pa
p.s. The original message is at the bottom.
'*************************************************************************************************************
SUB AVLVEH_quadrant_delete_dialog
DIM prompt AS LOGICAL
DIM v_name AS STRING
DIM ii AS INTEGER
DIM iItem AS INTEGER
OPEN TABLE v_table 'opening the table
FETCH First FROM NewView 'Looping throught pulling out the values in
the table
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
INTO iItem 'Getting the name of the value passed and putting it
into a variable
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")
If prompt = False Then
Call AVLVEH_quadrant_delete_dialog
ELSE
CALL okhandler(iItem) 'Passing the value to the OkHandler Sub
which will delete the selection
END IF 'from the dialog and the NewView Table
END IF
END SUB
'***************************************************END
SUB**************************************************
SUB okhandler(BYVal c_id AS INTEGER)
DIM ii AS INTEGER
Open TABLE v_table
DELETE FROM NewView WHERE ROWID = c_id
COMMIT TABLE NewView
PACK TABLE NewView DATA 'This will remove any row that have been
deleted ("empty rows") and free up the
'row so it can be used when another view is added. Also without
this you would
'be unable to FETCH to the EOT if a row was deleted somewhere
b/w the first and
'last row.
Call AVLVEH_update_menu 'To update the menu
END SUB
'****************************************************END*******************************************************
Original MESSAGE:
> 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.