Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2002-11

timer on win32

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Vincent Snijders

Hi,

As somebody may have noticed, at the moment timers are not working in the win32 widgetset. Since this seemed a relatively easy and confined problem, I decided to look into it.

I think the problem is caused by the fact that the settimer function isn't called with a real window handle, but with the pointer to the (LCL-)timer object. I don't think we can / should / may put any window handle in the LCL, so calling it with a window handle is out of the question.

I think the procedures SetTimer and KillTimer should be removed from LCLLinux, because they don't offer a compabitible functionality as in the windows unit.

CustomTimer should then make direct calls to the interfaceobject. Maybe we can change the names to CreateTimer and DestroyTimer.

What do you think of this?

I am willing to implement these changes.

One other question:
In the interfacebase both DoEvents and HandleEvents are declared. In the GTK interface only HandleEvents is implemented. What is the difference between DoEvents and HandleEvents? Why is only one needed in the GTK interface? Does that mean we can remove DoEvents from the interfaceBase?

Regards,
Vincent Snijders.

Reply by email

Mattias Gaertner
to Vincent Snijders
Show quoted text 10 lines
Hi, As somebody may have noticed, at the moment timers are not working in the win32 widgetset. Since this seemed a relatively easy and confined problem, I decided to look into it. I think the problem is caused by the fact that the settimer function isn't called with a real window handle, but with the pointer to the (LCL-)timer object. I don't think we can / should / may put any window handle in the LCL, so calling it with a window handle is out of the question.

Agreed.

Show quoted text 8 lines
I think the procedures SetTimer and KillTimer should be removed from LCLLinux, because they don't offer a compabitible functionality as in the windows unit. CustomTimer should then make direct calls to the interfaceobject. Maybe we can change the names to CreateTimer and DestroyTimer. What do you think of this?

Makes sense.

I am willing to implement these changes.

ok

One other question: In the interfacebase both DoEvents and HandleEvents are declared. In the GTK interface only HandleEvents is implemented. What is the difference between DoEvents and HandleEvents?

I'm not sure, it looks win32 specific. Delphi6 does not use it.

Why is only one needed in the GTK interface?

To handle a message queue you need only three functions: One that tells if message is waiting, one that handles all waiting messages and one that waits till a message arrives.
I don't know, why win32 has two different functions to handle the messages. Maybe someone with win32 knowledge knows why.

Does that mean we can remove DoEvents from the interfaceBase?

Since it is not used and it's not needed for Delphi compatibility: yes.

Mattias

Reply by email

Martin Smat
to Vincent Snijders: As somebody may have noticed, at the moment timers are not working in the win32…
Vincent Snijders wrote 11 lines
Hi, As somebody may have noticed, at the moment timers are not working in the win32 widgetset. Since this seemed a relatively easy and confined problem, I decided to look into it. I think the problem is caused by the fact that the settimer function isn't called with a real window handle, but with the pointer to the (LCL-)timer object. I don't think we can / should / may put any window handle in the LCL, so calling it with a window handle is out of the question.

Yes, you are right. I tried to implement timers some weeks ago. As the handle I used the handle of the parent window
(TWinControl(AOwner).Handle) in Timer constructor. There was no problem, but the timer never calls the assigned TimerCBProc. Maybe you will have more luck.

Martin Smat.

Reply by email