|
-
May 29th, 2006, 11:07 AM
#1
Thread Starter
Member
Timer event and mouse respone
Hi
I have a huge app with >200 active x controls. All of them uses a timer to update themselves. This is a necessity, hovever, with so many timers mouse respone becomes a problem. Any sollution to this? The mouse hangs, want click etc...multiple clicks to do one simple thing etc..Coding in VB6
-
May 29th, 2006, 01:56 PM
#2
Addicted Member
Re: Timer event and mouse respone
Hi Madsun,
I think we're going to need a few more details.
What does your program do ? What type of ActiveX controls are you using ? Why do they all need timers ? Did you design the controls ? Are they connecting to the web or another program ?
Here are a few questions that you can ask yourself:
Can one control replace several ? Do they all need to be displayed and active ? Can some be placed on another form or tab of a SSTab control and just be active when visible ?
You say the timers are in the controls. Can the interval be increased. Update every second instead of every half a second.
If you designed them, then maybe update the control from an Event() instead of a timer. Only do an update if something changes.
Without a little more info, you won't get specific answers, just guesses.
Keith_VB6
If you have any further questions, just ask.
If this solves things, then please mark the thread resolved.
[Thread Tools] --> [Mark Thread Resolved]
-
May 29th, 2006, 02:49 PM
#3
Thread Starter
Member
Re: Timer event and mouse respone
Ok, more info then
The controls is part of a control system. This system show trends of different kind. The trends needs to update each second, but if the value doesnt change in the main system, no new value is sent to my control, therefore i use timers to do an update.
As the controls are part of a huge system, and needs to be very flexible, they cannon be merged into one big control.
An event is triggered each time a new value is received from the system, but this only change occasionally.
Im not at work now, but the code goes like this (psedo way)
private event data_received(value as double)
old_time = now
timer1.enabled = true
update trend()
end sub
private sub timer1
if (old_time - now)> 1 then
update_trend()
timer1.enabled =false
endif
end sub
-
May 29th, 2006, 07:20 PM
#4
Addicted Member
Re: Timer event and mouse respone
Well, it definitely sounds interesting. If you don't mind, it would help to see a screen shot, to get a better idea. It sounds like it's quite a program.
Without a true understanding of what trends it tracks and how they're displayed. i.e. data, graphs, gages. I can't think of anything specific to help. But as more details are explained, someone in the forum should be able to help. And I'll be glad to try and help.
You didn't say, did you make these controls ? If you did, then you'll be able to optimize them.
I can't think of any specific tips. Your code might benefit from various optimizations. From replacing standard functions with API functions, sometimes code needs a simple DoEvents, or I don't know.
I didn't mean to infer that you merge all controls into one, but there might be a couple here and there.
Having over 200 controls to imagine, is a bit overwhelming. How about you post a screen shot and we go from there.
Keith_VB6
If you have any further questions, just ask.
If this solves things, then please mark the thread resolved.
[Thread Tools] --> [Mark Thread Resolved]
-
May 30th, 2006, 02:54 AM
#5
Thread Starter
Member
Re: Timer event and mouse respone
Cant post any screenshots due to copyright / customer issues. Ive made the controls myself, and they've been optimized in all ways known to man
There are alot more controls wich i didnt mentioned, but the only tricky part left is the trend with its timer events.
To be specific:
Would the controls benefit from using the Timer API instead?
The controls cannot be merged in any way!
-
May 30th, 2006, 09:37 AM
#6
Addicted Member
Re: Timer event and mouse respone
I understand why you can't show the screen shot. I don't think I personally can help. Without seeing the code or even a screen shot, then all I can offer is ideas on general optimization.
My final thought would be to selectively dis-able parts of the program. If that's possible and see if a particular piece of code or control is sucking up all the resources.
You probably need someone in the real world to look through your project, unless someone else in this forum can help.
As far as using the timer API instead of a timer control, I don't see much difference. The timer shouldn't be using many resources, it's the code the timers execute.
I'm sorry that I can't be of more help.
Keith_VB6
If you have any further questions, just ask.
If this solves things, then please mark the thread resolved.
[Thread Tools] --> [Mark Thread Resolved]
-
May 30th, 2006, 11:40 AM
#7
Re: Timer event and mouse respone
From the timer code, it looks as if the timers have a short interval. Try changing the interval to 1000. It'll be less code (you don't need to see if it's been 1 second since the last time) and the program will be more responsive.
It looks as though you're doing an update when the event is received, then another update 1 second later - then nothing else until an event is received. Is that what you intended?
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|