Hello,
I'm using TreeViewAdv with large number of nodes I have a question if is it possible to cancel BeforExpand event 'events queue' after calling ExpandAll method?
I would like to cancel ExpandAll process during execution.
At this moment after I call the ExpandAll method, BeforeExpand events are called on every node I would like to stop this at the moment user press 'cancel' button.
(Syncfusion: 4.402.0.51)
(TreeViewAnd with LoadOnDemand set to true)
Thank you for help.
GR
Golda Rebecal
Syncfusion Team
March 8, 2007 10:04 AM UTC
Hi Michal,
It is not directly possible to stop expanding tree nodes on button click, as the main thread will be processing the ExpandAll function and hence the button click event can not be executed. This may be possible by calling the ExpandAll function in a separate thread and abort it on a cancel button click. I will try creating a sample on this and will update you on Monday.
Please let me know if you have any other questions.
Thanks for your interest in Syncfusion products.
Best Regards,
Golda
MI
Michal Iwicki
March 9, 2007 08:26 AM UTC
Thank you, i will be grateful for it.
Regards
Michal
GR
Golda Rebecal
Syncfusion Team
March 12, 2007 10:17 AM UTC
Hi Michal,
I have created a sample that expand the nodes of TreeViewAdv on a button click and cancel the process of expanding nodes on another button click.
Please have a look at the attached sample and let me know if you need any further assistance.
Thanks for your interest in Syncfusion products.
http://websamples.syncfusion.com/samples/tools.Windows/F57455/main.htm
Best Regards,
Golda
MI
Michal Iwicki
March 14, 2007 08:17 AM UTC
Hi Golda,
I have problem with example, after I press 'Expand' button, the folowing exception is thrown:
"
System.InvalidOperationException was unhandled
Message="Cross-thread operation not valid: Control 'treeViewAdv2' accessed from a thread other than the thread it was created on."
Source="System.Windows.Forms"
StackTrace:
at System.Windows.Forms.Control.get_Handle()
at System.Windows.Forms.Control.Update()
at Syncfusion.Windows.Forms.Tools.TreeViewAdv.ExpandedChanged(TreeNodeAdv node, Boolean expanded)
at Syncfusion.Windows.Forms.Tools.TreeNodeAdv.set_Expanded(Boolean value)
at Syncfusion.Windows.Forms.Tools.TreeNodeAdv.ExpandAll()
at Syncfusion.Windows.Forms.Tools.TreeNodeAdv.ExpandAll()
at Syncfusion.Windows.Forms.Tools.TreeViewAdv.ExpandAll()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
"
I'm using VS2005 C# Project.
Best Regards,
Michal
GR
Golda Rebecal
Syncfusion Team
March 14, 2007 12:57 PM UTC
Hi Michal,
When you run your code in the Visual Studio debugger, an InvalidOperationException is thrown if you access a UI element from any thread other than the one on which it was created. The debugger does this to alert you to a dangerous programming practice. UI elements are not thread-safe and should be accessed only on the thread that created them
Could you please try executing the sample with the start without debugging option?
Please let me know if you need any further assistance.
Thanks for your interest in Syncfusion products.
Best Regards,
Golda