Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/VCL/Action Classes    [ Add a report in this area ]  
Report #:  67219   Status: Reported
The customisation button of a TActionToolBar should remain in its  'down' state while its dropdown menu is shown, but does not
Project:  Delphi Build #:  11.0.2902.10471
Version:    11.0 Submitted By:   Chris Rolliston
Report Type:  Minor failure / Design problem Date Reported:  9/26/2008 8:24:01 AM
Severity:    Commonly encountered problem Last Updated: 2/13/2009 9:01:54 AM
Platform:    All platforms Internal Tracking #:  
Resolution: None  Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
The customisation button of a TActionToolBar (i.e., the right-aligned button with a downward arrowhead graphic) should remain in its 'down' state while its dropdown menu is being displayed, but in fact does not when the mouse cursor is moved.
Steps to Reproduce:
1. Run the 'WordPad' action band demo.
2. Click on one of the right-aligned toolbar buttons.
3. Move the mouse over the resulting menu, or indeed anywhere outside of the button itself and its parent toolbar (but don't actually click the mouse).
4. Result: the hutton loses its 'focussed' state, which is a non-standard behaviour.  (Compare, for example, clicking on an equivalent button in Word 2003 and moving the cursor around.)

The underlying issue is that on receipt of a CM_MOUSELEAVE message, the button repaints itself regardless of whether its dropdown menu is being displayed.
Workarounds
Edit TCustomUtilityButton like this -

1. Add as a private field

  FClicking: Boolean;

2. Amend Click as the following:

procedure TCustomUtilityButton.Click;
begin
  FClicking := True;
  try
    if Assigned(FOnClick) then
      FOnClick(Self);
  finally
    FClicking := False;
  end;
end;

3. Amend CMMouseLeave as the following:

procedure TCustomUtilityButton.CMMouseLeave(var Message: TMessage);
begin
  if not FClicking then //!!!added
    inherited;
  FScrollTimer.Enabled := False;
end;

Basically, this semi-hack relies on the fact that a CM_MOUSELEAVE message is manually sent after the menu is shown, this being so because of the UpdateTracking call at the end of TCustomButtonControl.MouseUp.
Attachment
None
Comments

None

Server Response from: ETNACODE01