Board index » delphi » TToolBar ClickButton procedure
Raymond F. Loycano
![]() Delphi Developer |
Wed, 20 Feb 2002 03:00:00 GMT
TToolBar ClickButton procedure
Im having problems with the TToolBar not working properly. A problem
exists when the "ShowCaptions" property is set to true and the user presses the "ALT" key and then selects the button by pressing the return or the down arrow key. When the "ALT" key is pressed the toolbar receives focus and allows the user to scroll the buttons with the arrow keys. When the down arrow or return key is pressed the button displays as pressed but fails to call the procedure and will not return to depressed state. Also, after selecting the toolbar this way will cause the application to hang. The buttons will react to mouse movements outside the toolbar. I believe this is due to the "ClickButton" procedure for the toolbar. The "ClickButton" procedure performs a "PostMessage" with "WM_LBUTTONDOWN" to be handled by the "Ttoolbar.WndProc" but fails to send a "PostMessage" with "WM_LBUTTONUP" that actually performs the action on the control and resets its state back to depressed. Unfortunately this is not the only problem. Even after sending a "WM_LBUTTONUP" message, the toolbar retains focus and requires another message with "WM_KEYDOWN, VK_ESCAPE" to remove the controls focus. I'm not sure why you would need to send VK_ESCAPE because it should react the same as pressing the mouse button which works fine. The following are the temporary adjustments I've made to the "ComCtrls.pas" file until a solution arises. procedure TToolBar.ClickButton(Button: TToolButton); Thanks, |