![]() |
Icon Update |
Post Reply
|
| Author | |
User999
Groupie
Joined: 06 September 2004 Status: Offline Points: 10 |
Post Options
Thanks(0)
Quote Reply
Topic: Icon UpdatePosted: 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 |
|
![]() |
|
apuhjee
Senior Member
Joined: 02 September 2005 Location: United States Status: Offline Points: 130 |
Post Options
Thanks(0)
Quote Reply
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
|
|
![]() |
|
User999
Groupie
Joined: 06 September 2004 Status: Offline Points: 10 |
Post Options
Thanks(0)
Quote Reply
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.
|
|
![]() |
|
free_user
Groupie
Joined: 08 March 2006 Status: Offline Points: 24 |
Post Options
Thanks(0)
Quote Reply
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 |
|
![]() |
|
User999
Groupie
Joined: 06 September 2004 Status: Offline Points: 10 |
Post Options
Thanks(0)
Quote Reply
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.
|
|
![]() |
|
apuhjee
Senior Member
Joined: 02 September 2005 Location: United States Status: Offline Points: 130 |
Post Options
Thanks(0)
Quote Reply
Posted: 20 June 2007 at 11:12am |
|
Sounds like some architectural refactoring needs to occur
|
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |