471,339 Members | 1,225 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,339 software developers and data experts.

BeginUpdate not working for 2nd TreeView

Hi, I have a form containing 2 TreeViews. When I click on a button, items
are transfered from the left tree to the right tree, which causes
flickering. In order to remove such flickering, I surrounded code with
BeginUpdate/EndUpdate for both trees. The left tree doesn't flicker anymore,
but the right one still does!! Even if I call BeginUpdate/EndUpdate on the
right tree only, it still flickers. What's going on here? Is BeginUpdate
working only for the first TreeView of a form or what?

Thanks for your help!
Etienne
Jul 21 '05 #1
6 1922
how many times do you call begin/end update for the second tree?

"Etienne" <oh> wrote in message news:lP********************@b2b2c.ca...
Hi, I have a form containing 2 TreeViews. When I click on a button, items
are transfered from the left tree to the right tree, which causes
flickering. In order to remove such flickering, I surrounded code with
BeginUpdate/EndUpdate for both trees. The left tree doesn't flicker
anymore, but the right one still does!! Even if I call
BeginUpdate/EndUpdate on the right tree only, it still flickers. What's
going on here? Is BeginUpdate working only for the first TreeView of a
form or what?

Thanks for your help!
Etienne

Jul 21 '05 #2
Only once, in the Button.Click event. BeginUpdate is the first line and
EndUpdate the last line..BeginUpdate isn't ever called before. Also, I
disabled XP Theme just to be sure this isn't the problem.

Etienne

"Joep" <St***@DeStoep.nl> wrote in message
news:41***********************@news.xs4all.nl...
how many times do you call begin/end update for the second tree?

"Etienne" <oh> wrote in message news:lP********************@b2b2c.ca...
Hi, I have a form containing 2 TreeViews. When I click on a button, items
are transfered from the left tree to the right tree, which causes
flickering. In order to remove such flickering, I surrounded code with
BeginUpdate/EndUpdate for both trees. The left tree doesn't flicker
anymore, but the right one still does!! Even if I call
BeginUpdate/EndUpdate on the right tree only, it still flickers. What's
going on here? Is BeginUpdate working only for the first TreeView of a
form or what?

Thanks for your help!
Etienne


Jul 21 '05 #3
what does the transfer proces look like? are you taking a node out of the
left tree and then put that node into the right tree and then loop? or are
you copying a node from the left tree, putting it into the right tree, then
loop and finally removing all nodes from the left tree? is there a
difference between the two methods with respect to flicker?

"Etienne" <oh> wrote in message news:4N********************@b2b2c.ca...
Only once, in the Button.Click event. BeginUpdate is the first line and
EndUpdate the last line..BeginUpdate isn't ever called before. Also, I
disabled XP Theme just to be sure this isn't the problem.

Etienne

"Joep" <St***@DeStoep.nl> wrote in message
news:41***********************@news.xs4all.nl...
how many times do you call begin/end update for the second tree?

"Etienne" <oh> wrote in message news:lP********************@b2b2c.ca...
Hi, I have a form containing 2 TreeViews. When I click on a button,
items are transfered from the left tree to the right tree, which causes
flickering. In order to remove such flickering, I surrounded code with
BeginUpdate/EndUpdate for both trees. The left tree doesn't flicker
anymore, but the right one still does!! Even if I call
BeginUpdate/EndUpdate on the right tree only, it still flickers. What's
going on here? Is BeginUpdate working only for the first TreeView of a
form or what?

Thanks for your help!
Etienne



Jul 21 '05 #4
I found where the problem is. Whenever I edit the text of an existing node,
it causes the tree to redraw even if BeginUpdate was called. Here's a sample
code to reproduce the problem :

destTree.BeginUpdate();
TreeNode n = null, p = null;
for (int i=0; i<50; i++) {
p = n;
n = destTree.Nodes.Add("test");
if (p != null) // If you comment those 2 lines, it no longer redraws.
p.Text = "*" + p.Text;
}
destTree.EndUpdate();

This causes the treeview to redraw for every item. Any idea for a
work-around? I tried subclassing and blocking WM_PAINT (0xF) after
BeginUpdate is called, but this doesn't solve the problem.

Etienne

"Joep" <St***@DeStoep.nl> wrote in message
news:42***********************@news.xs4all.nl...
what does the transfer proces look like? are you taking a node out of the
left tree and then put that node into the right tree and then loop? or are
you copying a node from the left tree, putting it into the right tree,
then loop and finally removing all nodes from the left tree? is there a
difference between the two methods with respect to flicker?

"Etienne" <oh> wrote in message news:4N********************@b2b2c.ca...
Only once, in the Button.Click event. BeginUpdate is the first line and
EndUpdate the last line..BeginUpdate isn't ever called before. Also, I
disabled XP Theme just to be sure this isn't the problem.

Etienne

"Joep" <St***@DeStoep.nl> wrote in message
news:41***********************@news.xs4all.nl...
how many times do you call begin/end update for the second tree?

"Etienne" <oh> wrote in message news:lP********************@b2b2c.ca...
Hi, I have a form containing 2 TreeViews. When I click on a button,
items are transfered from the left tree to the right tree, which causes
flickering. In order to remove such flickering, I surrounded code with
BeginUpdate/EndUpdate for both trees. The left tree doesn't flicker
anymore, but the right one still does!! Even if I call
BeginUpdate/EndUpdate on the right tree only, it still flickers. What's
going on here? Is BeginUpdate working only for the first TreeView of a
form or what?

Thanks for your help!
Etienne

Jul 21 '05 #5
the edit is a new feature, anyway, have a look

http://www.codeproject.com/cs/miscctrl/listviewff.asp
"Etienne" <oh> wrote in message news:v8********************@b2b2c.ca...
I found where the problem is. Whenever I edit the text of an existing node,
it causes the tree to redraw even if BeginUpdate was called. Here's a
sample code to reproduce the problem :

destTree.BeginUpdate();
TreeNode n = null, p = null;
for (int i=0; i<50; i++) {
p = n;
n = destTree.Nodes.Add("test");
if (p != null) // If you comment those 2 lines, it no longer redraws.
p.Text = "*" + p.Text;
}
destTree.EndUpdate();

This causes the treeview to redraw for every item. Any idea for a
work-around? I tried subclassing and blocking WM_PAINT (0xF) after
BeginUpdate is called, but this doesn't solve the problem.

Etienne

"Joep" <St***@DeStoep.nl> wrote in message
news:42***********************@news.xs4all.nl...
what does the transfer proces look like? are you taking a node out of the
left tree and then put that node into the right tree and then loop? or
are you copying a node from the left tree, putting it into the right
tree, then loop and finally removing all nodes from the left tree? is
there a difference between the two methods with respect to flicker?

"Etienne" <oh> wrote in message news:4N********************@b2b2c.ca...
Only once, in the Button.Click event. BeginUpdate is the first line and
EndUpdate the last line..BeginUpdate isn't ever called before. Also, I
disabled XP Theme just to be sure this isn't the problem.

Etienne

"Joep" <St***@DeStoep.nl> wrote in message
news:41***********************@news.xs4all.nl...
how many times do you call begin/end update for the second tree?

"Etienne" <oh> wrote in message news:lP********************@b2b2c.ca...
> Hi, I have a form containing 2 TreeViews. When I click on a button,
> items are transfered from the left tree to the right tree, which
> causes flickering. In order to remove such flickering, I surrounded
> code with BeginUpdate/EndUpdate for both trees. The left tree doesn't
> flicker anymore, but the right one still does!! Even if I call
> BeginUpdate/EndUpdate on the right tree only, it still flickers.
> What's going on here? Is BeginUpdate working only for the first
> TreeView of a form or what?
>
> Thanks for your help!
> Etienne


Jul 21 '05 #6
This article doesn't solve my problem, but I tried blocking both WM_PAINT
and WM_ERASEBKGND. There is not much flickering anymore! The scrollbars
still flicker, but at least not the content. Is there a way to stop
redrawing of scrollbars?

Etienne

"Joep" <St***@DeStoep.nl> wrote in message
news:42***********************@news.xs4all.nl...
the edit is a new feature, anyway, have a look

http://www.codeproject.com/cs/miscctrl/listviewff.asp
"Etienne" <oh> wrote in message news:v8********************@b2b2c.ca...
I found where the problem is. Whenever I edit the text of an existing
node, it causes the tree to redraw even if BeginUpdate was called. Here's
a sample code to reproduce the problem :

destTree.BeginUpdate();
TreeNode n = null, p = null;
for (int i=0; i<50; i++) {
p = n;
n = destTree.Nodes.Add("test");
if (p != null) // If you comment those 2 lines, it no longer redraws.
p.Text = "*" + p.Text;
}
destTree.EndUpdate();

This causes the treeview to redraw for every item. Any idea for a
work-around? I tried subclassing and blocking WM_PAINT (0xF) after
BeginUpdate is called, but this doesn't solve the problem.

Etienne

"Joep" <St***@DeStoep.nl> wrote in message
news:42***********************@news.xs4all.nl...
what does the transfer proces look like? are you taking a node out of
the left tree and then put that node into the right tree and then loop?
or are you copying a node from the left tree, putting it into the right
tree, then loop and finally removing all nodes from the left tree? is
there a difference between the two methods with respect to flicker?

"Etienne" <oh> wrote in message news:4N********************@b2b2c.ca...
Only once, in the Button.Click event. BeginUpdate is the first line and
EndUpdate the last line..BeginUpdate isn't ever called before. Also, I
disabled XP Theme just to be sure this isn't the problem.

Etienne

"Joep" <St***@DeStoep.nl> wrote in message
news:41***********************@news.xs4all.nl...
> how many times do you call begin/end update for the second tree?
>
> "Etienne" <oh> wrote in message
> news:lP********************@b2b2c.ca...
>> Hi, I have a form containing 2 TreeViews. When I click on a button,
>> items are transfered from the left tree to the right tree, which
>> causes flickering. In order to remove such flickering, I surrounded
>> code with BeginUpdate/EndUpdate for both trees. The left tree doesn't
>> flicker anymore, but the right one still does!! Even if I call
>> BeginUpdate/EndUpdate on the right tree only, it still flickers.
>> What's going on here? Is BeginUpdate working only for the first
>> TreeView of a form or what?
>>
>> Thanks for your help!
>> Etienne



Jul 21 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by SJ via .NET 247 | last post: by
2 posts views Thread by shumaker | last post: by
6 posts views Thread by Etienne | last post: by
1 post views Thread by DraguVaso | last post: by
3 posts views Thread by Daves | last post: by
1 post views Thread by Daves | last post: by
4 posts views Thread by Anil Gupte | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.