Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - Icon Update
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Icon Update

 Post Reply Post Reply
Author
Message
User999 View Drop Down
Groupie
Groupie


Joined: 06 September 2004
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote User999 Quote  Post ReplyReply Direct Link To This Post Topic: Icon Update
    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
Back to Top
apuhjee View Drop Down
Senior Member
Senior Member
Avatar

Joined: 02 September 2005
Location: United States
Status: Offline
Points: 130
Post Options Post Options   Thanks (0) Thanks(0)   Quote apuhjee Quote  Post ReplyReply Direct Link To This Post 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:
 
 
 
Cheers ~ jp
Back to Top
User999 View Drop Down
Groupie
Groupie


Joined: 06 September 2004
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote User999 Quote  Post ReplyReply Direct Link To This Post 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.
 
 
Back to Top
free_user View Drop Down
Groupie
Groupie
Avatar

Joined: 08 March 2006
Status: Offline
Points: 24
Post Options Post Options   Thanks (0) Thanks(0)   Quote free_user Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
User999 View Drop Down
Groupie
Groupie


Joined: 06 September 2004
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote User999 Quote  Post ReplyReply Direct Link To This Post 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.
 
 
 
Back to Top
apuhjee View Drop Down
Senior Member
Senior Member
Avatar

Joined: 02 September 2005
Location: United States
Status: Offline
Points: 130
Post Options Post Options   Thanks (0) Thanks(0)   Quote apuhjee Quote  Post ReplyReply Direct Link To This Post Posted: 20 June 2007 at 11:12am
Sounds like some architectural refactoring needs to occur
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.047 seconds.