Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic TableNode values not removed for recreation (Read 2444 times)
madhan1
Full Member
***
Offline


FOLLOW NO ONE BUT LEARN
FROM EVERY ONE ..

Posts: 101
Location: India
Joined: Feb 17th, 2010
TableNode values not removed for recreation
Dec 7th, 2021 at 5:52am
Print Post  
Dear sir,
    
Code (C++)
Select All
 TableNode tbResources1 = diagram1.Factory.CreateTableNode(210, 10, 100, rowheight * itemIDs.Count);
            tbResources1.RowHeight = rowheight;
            tbResources1.RedimTable(1, itemIDs.Count);
            tbResources1.Caption = itemIDs[0][2].ToString();
            tbResources1.Font = new Font(FontFamily.GenericSansSerif, 9.0F, FontStyle.Italic, GraphicsUnit.Pixel);
            tbResources1.Pen = new MindFusion.Drawing.Pen(Color.FromArgb(192, 192, 192));
            tbResources1.CaptionHeight = rowheight;
            tbResources1.CaptionBrush = new MindFusion.Drawing.SolidBrush(Color.White);
            tbResources1.CaptionBackBrush = new MindFusion.Drawing.SolidBrush(Color.FromArgb(247, 150, 70));
            for (int i=1;i<itemIDs.Count;i++)
            {
                tbResources[0, i-1].Text = itemIDs[i][1].ToString();
                tbResources1[0, i-1].Text = itemIDs[i][2].ToString();
                match1[i-1] = Convert.ToInt32(itemIDs[i][3])-1;
            } 



it is a function call for creating new questions i am using this same function.
but the issue is.
if some question set have 6 questions  and the next question set have 4 questions then
the before 2 questions is displaying in the next question
  

2_005.png ( 29 KB | 106 Downloads )
2_005.png
3.jpg ( 83 KB | 104 Downloads )
3.jpg

if you want something then go and grab it
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 3343
Joined: Oct 19th, 2005
Re: TableNode values not removed for recreation
Reply #1 - Dec 7th, 2021 at 7:57am
Print Post  
Hi,

Assuming this code runs for each new set of questions, that would happen if itemIDs.Count remains the same as for previous set. Otherwise if you are reusing the TableNode and copying items somewhere else in the code, make sure you are calling RedimTable there too (or resetting the RowCount property).

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
madhan1
Full Member
***
Offline


FOLLOW NO ONE BUT LEARN
FROM EVERY ONE ..

Posts: 101
Location: India
Joined: Feb 17th, 2010
Re: TableNode values not removed for recreation
Reply #2 - Dec 7th, 2021 at 8:14am
Print Post  
Dear sir,
Code (C++)
Select All
 void pickcurrentquestion()
        {
            List<string[]> itemIDs = new List<string[]>();
            for (int i = 0; i < numberofQuestions; i++)
            {
                if (allquestions[i, 0] == currentquestion.ToString())
                {
                    itemIDs.Add(new string[4] { allquestions[i, 0], allquestions[i, 1], allquestions[i, 2], allquestions[i, 3] });
                }
            }

            if (itemIDs.Count < 1)
            {
                MessageBox.Show("You have finished all the Questions :-)");
                return;
            }

            int rowheight = 20;
            Array.Resize(ref match1, itemIDs.Count);
            TableNode tbResources = diagram1.Factory.CreateTableNode(10, 10, 100, rowheight * itemIDs.Count);
            tbResources.DeleteColumn(0);
            tbResources.RowHeight = rowheight;
            tbResources.RedimTable(1, itemIDs.Count);
            tbResources.Caption = itemIDs[0][1].ToString();
            tbResources.Font = new Font(FontFamily.GenericSansSerif, 9.0F, FontStyle.Italic, GraphicsUnit.Pixel);
            tbResources.Pen = new MindFusion.Drawing.Pen(Color.FromArgb(192, 192, 192));
            tbResources.CaptionHeight = rowheight;
            tbResources.CaptionBrush = new MindFusion.Drawing.SolidBrush(Color.White);
            tbResources.CaptionBackBrush = new MindFusion.Drawing.SolidBrush(Color.FromArgb(247, 150, 70));

            TableNode tbResources1 = diagram1.Factory.CreateTableNode(210, 10, 100, rowheight * itemIDs.Count);
            tbResources1.RowHeight = rowheight;
            tbResources1.RedimTable(1, itemIDs.Count);
            tbResources1.Caption = itemIDs[0][2].ToString();
            tbResources1.Font = new Font(FontFamily.GenericSansSerif, 9.0F, FontStyle.Italic, GraphicsUnit.Pixel);
            tbResources1.Pen = new MindFusion.Drawing.Pen(Color.FromArgb(192, 192, 192));
            tbResources1.CaptionHeight = rowheight;
            tbResources1.CaptionBrush = new MindFusion.Drawing.SolidBrush(Color.White);
            tbResources1.CaptionBackBrush = new MindFusion.Drawing.SolidBrush(Color.FromArgb(247, 150, 70));
            for (int i=1;i<itemIDs.Count;i++)
            {
                tbResources[0, i-1].Text = itemIDs[i][1].ToString();
                tbResources1[0, i-1].Text = itemIDs[i][2].ToString();
                match1[i-1] = Convert.ToInt32(itemIDs[i][3])-1;
            }
            diagram1.Nodes.Add(tbResources);
            diagram1.Nodes.Add(tbResources1);

        } 



this is the function i am using. itemIDs.Count is created at the each time. here only i am creating the table node other than this i not creating any nodes.
  

if you want something then go and grab it
Back to top
 
IP Logged
 
madhan1
Full Member
***
Offline


FOLLOW NO ONE BUT LEARN
FROM EVERY ONE ..

Posts: 101
Location: India
Joined: Feb 17th, 2010
Re: TableNode values not removed for recreation
Reply #3 - Dec 7th, 2021 at 2:20pm
Print Post  
Dear team,
       i found the issue. when ever i am calling the function.
i am creating a new table above the old table (because i am creating on same location)
so i delete the old table and then created the new table  Wink

Code (C++)
Select All
 TableNode L_tab, r_tab;
                L_tab = (TableNode)diagram1.FindNodeById("Lefttable");
                r_tab = (TableNode)diagram1.FindNodeById("Righttable");
                if (L_tab != null)
                {
                    diagram1.Nodes.Remove(L_tab);
                    diagram1.Nodes.Remove(r_tab);
                }
 


issue is solved thanks Slavcho

  

if you want something then go and grab it
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 3343
Joined: Oct 19th, 2005
Re: TableNode values not removed for recreation
Reply #4 - Dec 7th, 2021 at 2:57pm
Print Post  
Ah right, that's slightly discernible from the doubled shadow in screenshot above Smiley
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint