Sign In  Sign Up Live-Chat

Setting ComboBox selectedindex

Last post 07-17-2008, 10:16 PM by karen.huang. 6 replies.
Sort Posts: Previous Next
  •  07-16-2008, 2:55 PM 135801

    Setting ComboBox selectedindex

    I have a situation where I programitically populate 2 columns with maybe 100 rows.  A lot of the cells have comboboxes.

    When I initially populate the cells, setting each selectedindex for the combobox takes about .01 seconds.

    However, when the user changes a value in the combo, I'm re-populating that cell's column so I can rebuild the styles based on the change.

    During this re-population of the column, the setting of the selectedindex now takes about .4 seconds.

    Can you think of any reason why it would take longer for the selectedindex to be set the 2nd time around?

    I do have a couple of selecteddatachanged events, but those events aren't firing after stepping through the code which is by design.

     
  •  07-16-2008, 4:03 PM 135810 in reply to 135801

    Re: Setting ComboBox selectedindex

    After further debugging, it's related to having formulas in some of the cells.

    By not setting any formulas "=SUM(B43:C43)", it ran as fast as the original load time.

    Seems like it's similar to SetCellValue being faster than setting the Value property on the cell...can something be done for setting the selectedindex?

     
  •  07-16-2008, 8:41 PM 135819 in reply to 135810

    Re: Setting ComboBox selectedindex

    Hi,

    Thank you for reporting this issue.

    I think you are right. It's related to setting Cell’s value with Cell.Value when the combobox’s selected index is changed. We will figure out this issue and get back to you soon.

     


    Karen Huang
    Developer
    Aspose Nanjing Team
    About Us
    Contact Us
     
  •  07-17-2008, 12:49 AM 135829 in reply to 135819

    Re: Setting ComboBox selectedindex

    Attachment: Present (inaccessible)

    Hi,

    Please try the attached version.

    Please use the new added method Combobox.SetSelectedIndex() to set the selected index. This method will not call calculate formulas. To calculate formula, you need to call GridDesktop.RunAllFormulas manually.

    Thank you.


    Karen Huang
    Developer
    Aspose Nanjing Team
    About Us
    Contact Us
     
  •  07-17-2008, 9:53 AM 135941 in reply to 135829

    Re: Setting ComboBox selectedindex

    Thank you!  Yes, this did fix it.

    If you can think of any other areas where the formulas might be recalculating when I wouldn't want them to, that would be great.

    It would be nice to only have them recalcuate when I call RunAllFormulas.

    Maybe that could be a property.

    RecalculateFormulas = false;

    Do some work

    RecalculateFormulas = true;

    RunAllFormulas

     
  •  07-17-2008, 8:53 PM 136005 in reply to 135941

    Re: Setting ComboBox selectedindex

    Hi,

     

    Thanks for providing us this idea. We will look into this feature in future versions and get back to you.


    Karen Huang
    Developer
    Aspose Nanjing Team
    About Us
    Contact Us
     
  •  07-17-2008, 10:16 PM 136011 in reply to 135941

    Re: Setting ComboBox selectedindex

    Attachment: Present (inaccessible)

    Hi,

    Please try the attached version.

    We added the new property “GridDesktop.RecalculateFormulas”. It indicates whether to recalculate all the cells's formula when a cell's value changed. The default value is true.

     

    Setting Cell.Value and Combobox.SelectedIndex properties will auto recalculate formulas if GridDesktop.RecalculateFormulas is ture. If GridDesktop.RecalculateFormulas is false, they will not auto recalculate formulas.

     

    Cell.SetValue() and Combobox.SetSelectedIndex() will still not recalculate formulas in any case even GridDesktop.RecalculateFormulas is true.

     

    Thank you.


    Karen Huang
    Developer
    Aspose Nanjing Team
    About Us
    Contact Us
     
View as RSS news feed in XML