We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

TreeViewAdv + ExpandAll() + posibility to cancel process

Thread ID:

Created:

Updated:

Platform:

Replies:

57455 Mar 5,2007 01:55 PM UTC Mar 14,2007 12:57 PM UTC WinForms 5
loading
Tags: Tools
Michal Iwicki
Asked On March 5, 2007 01:55 PM UTC

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.

Golda Rebecal [Syncfusion]
Replied On 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



Michal Iwicki
Replied On March 9, 2007 08:26 AM UTC

Thank you, i will be grateful for it.
Regards
Michal

Golda Rebecal [Syncfusion]
Replied On 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

Michal Iwicki
Replied On 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

Golda Rebecal [Syncfusion]
Replied On 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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;