Updating a Table from code does not displayed data until you double click a cell

Updating a Table from code does not displayed data until you double click a cell

gotMorris
Enthusiast Enthusiast
1,247 Views
7 Replies
Message 1 of 8

Updating a Table from code does not displayed data until you double click a cell

gotMorris
Enthusiast
Enthusiast

After my program runs the table cells appear to be empty however if I click into  cell then click out the data is there. Any help would be great.

 

Before clicking

before.png

After clicking

after.png

 

table.UpgradeOpen();
table.Cells[2, 0].TextString = autoFixture.TitleBlock.AttributeData.FirstOrDefault(d=>d.Name == "REV").Value;
table.Cells[2, 1].TextString = "FINAL- NEW DRAWING";
table.Cells[2, 2].TextString =DateTime.Now.ToShortDateString();
table.Cells[2, 3].TextString = autoFixture.TitleBlock.AttributeData.FirstOrDefault(d => d.Name == "DRAWNBY").Value;

 

0 Likes
Accepted solutions (1)
1,248 Views
7 Replies
Replies (7)
Message 2 of 8

fieldguy
Advisor
Advisor

are you using table.GenerateLayout() somewhere that's not shown? 

0 Likes
Message 3 of 8

norman.yuan
Mentor
Mentor

You may want to try calling Editor.UpdateScreen() after the Transaction, within which the table is opened and updated, is committed.

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 4 of 8

gotMorris
Enthusiast
Enthusiast

I haven't tried that yet. I assumed GenerateLayout was needed if I created a new Table. Is that the case?

0 Likes
Message 5 of 8

gotMorris
Enthusiast
Enthusiast

UpdateScreen didn't do the trick. I did notice ,however, that if I resize the table the cell data is appears.

0 Likes
Message 6 of 8

gotMorris
Enthusiast
Enthusiast

I am still having trouble with this issue. I have noticed that any change in the properties of the table fixes the problem. Below I show how by changing the direction to "down" then "up" again the text is displayed. I have tried Editor.UpdateScreen() and table.GenerateLayout(). Is there a way in code to refresh the table @_gile?

 
0 Likes
Message 7 of 8

_gile
Consultant
Consultant
Accepted solution

Hi,

 

I cannot reproduce what you describe.

It's quite difficult to help you seein so few code, anyway, did you try to call.table.DowngradeOpen() after editing the table?



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 8 of 8

gotMorris
Enthusiast
Enthusiast

Thanks @_gile calling DowngradeOpen() fixed my problem. I don't recall needing to use that method after calling UpgradeOpen() on other objects before. 

Thanks for your help.