Deleting rows from edit tables (OpenInsight Specific)
At 17 AUG 2001 11:38:50AM Mike O'Neal wrote:
Hello all:
I am working on some code that is called from a button on a frame that deletes a row from an edit table on a MDI child. The gist of it is:
Retval=Send_Message(Win_ctrlentid,"DELETE",Row)
Works like a charm *unless* there is only one row remaining in the edit table. Once the final row deleted, I lose all ability to edit or even access the edit table again, all grid lines disappear, etc. Have tried re-setting various properties (SELPOS, FOCUS) but am out of ideas.
Any suggestions? Thanks much,
Mike O.
At 17 AUG 2001 12:02PM Don Miller - C3 Inc. wrote:
Mike ..
To do this programatically here's what I do:
Normally I don't allow for the Delete key to work on a table since
most of my apps have to do some internal checking of the data within
the table so like you, there's a button to do this with an appropriate
message that checks to see if it's OK to delete and to confirm that the user really wants to do this.
Then ..
Get the SELPOS property of the Table (Col,Row)
Where=Get_Property(Ctrlentid,"SELPOS")
col=Where
row=Where
Get the "ARRAY" property of the table
ARY=Get_Property(CtrlEntId,"ARRAY")
then
..in BASIC+ delete the columns for that row (checking if necessary before doing this)..
K1=Count(ARY,@vm)+1 ;* the count of columns
For I=1 to K1
ARY=Delete(Ary,Row,I,0)Next I
* Next Save it back
CALL Set_Property(CtrlEntId,"ARRAY",ARY)
* if there are symbolics that need to be fixed, you may want to
* send a CALCULATE event to the Window
Return 1
Anyway, that's what I've done. I found the same problem on the last row as you. This seems to work completely.
Don Miller
C3 Inc.
At 17 AUG 2001 02:14PM Steve Botes wrote:
I have found that when the table is completely empty that I can add rows back by using Insert.
At 17 AUG 2001 02:41PM Mike O'Neal wrote:
Don and Steve:
Both suggestions worked - thanks *much*!
Mike O