Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Cell deletion (Read 2693 times)
marie
Full Member
***
Offline



Posts: 147
Joined: Nov 11th, 2008
Cell deletion
Nov 17th, 2008 at 6:58pm
Print Post  
Hi,

-1-
Is it possible to delete a cell from a TableNode? I can DeleteRow or Delete Col, but not a specific cell...

-2-
Instead, I could do a manual deletion by setting the cell's text to string.empty and removing anchors. That's fine. However, I don't know how to delete the links that are already attached to the anchors.

Code
Select All
foreach (DiagramLink link in tableNode.GetAllLinks())
{
    int linkAnchorPt = null;
    if (column == IN_COLUMN)
    {
        linkAnchorPt = link.OriginAnchor;
    }
    else if (column == OUT_COLUMN)
        linkAnchorPt = link.DestinationAnchor;

    if (linkAnchorPt == myAnchorPoint))
    {
        this.diagram.Items.Remove(link);
    }
} 



The problem with this code is that OriginAnchor & DestinationAnchor are int and that myAnchorPoint is an AnchorPoint. How can I get the related AnchorPoint / index so I can do the comparison to the delete the good links?

-3-
If I take solution #2, is there a way to shift cells up below the delete one so that there is no empty space left?

Thank you,
Marie



p.s. If this is not clear, I have a table that has the following cells:

input1 output1
input2 output2
input3 output3
input4

If I delete input4, it's easy to call DeleteRow since there is nothing on the same row. However, I want to delete input2 so that my table becomes:

input1 output1
input3 output2
input4 output3

(and of course delete related links & patterns)
« Last Edit: Dec 9th, 2008 at 2:53pm by marie »  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Cell deletion
Reply #1 - Nov 18th, 2008 at 3:37pm
Print Post  
You can think of a cell in a TableNode row as a field of a database record, deleting it does not shift the other fields in the column. Our developer will create a sample that shows how to implement what you need and we'll upload it here in a few hours.

Stoyan
  
Back to top
 
IP Logged
 
marie
Full Member
***
Offline



Posts: 147
Joined: Nov 11th, 2008
Re: Cell deletion
Reply #2 - Nov 18th, 2008 at 4:45pm
Print Post  
Thanks!

I'll be waiting for that code...

For future reference, it said in another post how to get the related AnchorPoint / index:

Code
Select All
int i = link.OriginAnchor;
AnchorPoint ap = link.Origin.AnchorPattern.Points[i]; 




Edit: This doesn't work for me since anchor points are stored in rows, not in tables...
« Last Edit: Nov 18th, 2008 at 6:38pm by marie »  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Cell deletion
Reply #3 - Nov 19th, 2008 at 12:39pm
Print Post  
This is the sample:
https://mindfusion.eu/_samples/delete_cell.zip

You can access the row's AnchorPattern by typecasting link.Orgin to TableNode and then use TableNode.Rows[link.OrginIndex].AchorPattern.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
marie
Full Member
***
Offline



Posts: 147
Joined: Nov 11th, 2008
Re: Cell deletion
Reply #4 - Nov 20th, 2008 at 5:04pm
Print Post  
Hi!

Thanks a lot for the sample code. It helps a lot.

Marie
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint