Delphi 3's installation menu had an interesting feature, when the mouse hovered over a menu item it glowed. Then if you clicked on the menu item, it moved like a button. I was, to say the least, impressed with this and mistakenly thought that I would be able to find this component with the included VCL; it wasn't.
Well, it's been a while now since Delphi 3 has been released, in fack Delphi 4 is out and it didn't include this component either. So, I built my own TMILFlashLabel.
It's really a fairly simple component, there are only three properties of interest: 1) Caption, 2) Normal Color, and 3) Highlight Color. The Caption is where you specify what the label will display (just like a TLabel). Normal Color is where you specify the color of the unhighlighted text, it is also the color of the text in the middle of the highlight. Highlight Color is the color to draw around the label when the mouse moves over it.
You can also set the label's font with the Font property and there is an OnClick event to handle processing when the item is clicked.
During testing I added two properties
Hover and
MouseIsDown to test the various states without running an application every time I made a change. I decided to leave them, who knows you may find a use for them someday. Hover indicates whether to simulate the mouse hovering over the label or not. If Hover is true the label will be highlighted. MouseIsDown simulates a mouse click, if it is true the label will appear over and down two pixels from the original position.
Because I needed to trap the CM_MOUSEENTER and CM_MOUSELEAVE messages to detect when to highlight the label, I decided to surface those events. You don't have to use them for anything, but if you ever need to know when the mouse enters or leaves the label, these events will tell you.
Return to the top