[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 154
  • Last Modified:

postmessages blocks other messages

I'm trying to solve a problem with a homemade button, because mouseleave not always work (http://www.experts-exchange.com/jsp/qShow.jsp?ta=delphi&qid=10254821 ). Now i'm trying to solve the problem by sending myself a message (by postmessage) to check if the mouse is outside my button area - BUT if i postmessage everytime i get the message and the mouse is still over the button area i'm blocking for other messages to get through (e.g. invalidate, onclick)
I've tried to insert Application.processmessags - that will solve the problem, but i think it is too heavy to call so often. How can i be sure not to block the message queue ?
  • 2
1 Solution
It's not the idea to post messages application internal. To check if the mouse is over the butten use the OnMouseMove-Event. It's forced every time the mouse is over your button (an you can do your hovver-effect).
I hope your button derives vom TWinControl, isn't it?
espensenAuthor Commented:
My button is derived from TPaintbox because it's very simpel. It's showing 3 states (bitmaps), one if disabeld another if enabled and the 3. if the mouse is over the button (and enabled). I've made my own handle to send messages.

I need to know that the mouse is OUTSIDE my button, so I can change it's state (bitmap). MouseLeave isn't arriving if the program is busy with something else.......
Perhaps looking at Jordan Russell's speedbutton component will give you a hint. He's documented this problem and solved it by using a timer (if I remember right).


The button is in the toolbar97 collection.

Regards, Madshi.
espensenAuthor Commented:
It was a timer..... Thanks !

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now