Print Page | Close Window

Icon Update

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=7406
Printed Date: 18 June 2025 at 1:31pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Icon Update
Posted By: User999
Subject: Icon Update
Date Posted: 19 June 2007 at 9:52am
Hi,
 
we would like to indicate a running operation by changing the icon of a commandbar button (vb6 code):
 
.Actions(MenüID1).IconId = ID_ActionIsRunning
Do
....   operation code..
Loop
.Actions(MenüID1).IconId = ID_ActionIsOver
 
The problem is that the icon does not update even if we use .redrawbar but only if we add a "DoEvents" statement between icon assignment and loop. But we cannot use "DoEvents" here for other reasons.
Is there a solution for this?
 
Thank you
Andreas



Replies:
Posted By: apuhjee
Date Posted: 19 June 2007 at 10:56am
I ran into a similar problem the first time I tried writing "progress bar" code.  The bar would sit at zero and then hit 100% once the running method had completed.
 
The solution was to put the UI update code in a seperate thread by making Asynchronous method calls.  That's in the .NET world.  I'm not so sure you'll be so lucky with VB6.
 
Here are two blog posts by Jeff Atwood related to the subject:
 
http://www.codinghorror.com/blog/archives/000159.html - http://www.codinghorror.com/blog/archives/000159.html
 
http://www.codinghorror.com/blog/archives/000370.html - http://www.codinghorror.com/blog/archives/000370.html
 
Cheers ~ jp


Posted By: User999
Date Posted: 20 June 2007 at 4:31am
Thank you for the hint. The overhead would be to big for an asynchronous solution in this case. But we found that the WinAPI function
 
UpdateWindow .FindControl(, MenüID1).Parent.hwnd
produces an immediate redraw of the parent commandbar. Hope that this is the solution.
 
 


Posted By: free_user
Date Posted: 20 June 2007 at 7:21am
HI
you can use Doevents command like this:
.Actions(MenüID1).IconId = ID_ActionIsRunning
doevents '--------------- This line
Do
....   operation code..
Loop
.Actions(MenüID1).IconId = ID_ActionIsOver


Posted By: User999
Date Posted: 20 June 2007 at 7:34am
Hi,
 
thanks, but
 
doevents '--------------- This line
 
is what we want to avoid (s.o.) because other operations could start with this line - and this shall not happen.
 
 
 


Posted By: apuhjee
Date Posted: 20 June 2007 at 11:12am
Sounds like some architectural refactoring needs to occur



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net