Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/VCL/Ribbon Controls    [ Add a report in this area ]  
Report #:  72776   Status: Reported
ScreenTip don't follow control's BiDiMode
Project:  Delphi Build #:  12.0.3210.17555
Version:    12.1 Submitted By:   Hichem BOUKSANI
Report Type:  Minor failure / Design problem Date Reported:  4/5/2009 1:48:32 PM
Severity:    Serious / Highly visible problem Last Updated: 4/6/2009 2:24:05 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: 15
Description
ScreenTip don't follow control's BiDiMode
Steps to Reproduce:
In ScreenTipDemo
Set BiDiMode of frmMain to bdRightToLeft
Run
Move mouse on Change Font button for example
Workarounds
In ScreenTips.pas

procedure TScreenTipsWindow.Paint;
var
  LRect: TRect;
  LTextHeight: Integer;
  LLeftPos: Integer; // left position. can be different if image is being shown
  LRightPos: Integer;
  LY: Integer; // position from the top that the next line will be drawn at
  LShowImage: Boolean;
  AL: Integer; // Hichem
begin
  inherited;
  // draw background
  LRect := ClientRect;
  DrawBackground(LRect);
  Canvas.Brush.Style := bsClear;
  // Draw header
  LY := DrawHeader;
  // Draw image if one is available. Images are only displayed for Enabled
  // items and the Items ShowImage property must also be True
  LShowImage := FActiveItem.ShowImage and (FImage <> nil) and (FImage.Graphic <> nil) and
    (not FImage.Graphic.Empty) and FActiveItem.IsEnabled;
  if LShowImage then
  begin
    FImage.Graphic.Transparent := True;
    if HintControl.BiDiMode <> bdLeftToRight then // Hichem
      Canvas.Draw(LRect.Right - cSpacing - FImage.Width, LY, FImage.Graphic)
    else
      Canvas.Draw(cSpacing, LY, FImage.Graphic);
  end;
  Canvas.Font.Color := clWindowText;
  if HintControl.BiDiMode = bdLeftToRight then  // Hichem
    AL := DT_LEFT
  else
    AL := DT_RIGHT;
  // Check to see if the command is disabled. Disabled commands have an
  // additional message that is drawn in Bold
  if not FActiveItem.IsEnabled and HasDisabledText then
  begin
    LTextHeight := Canvas.TextHeight(FActiveItem.DisabledHeader);
    LRect := ClientRect;
    LRect.Top := LY;
    if HintControl.BiDiMode = bdLeftToRight then // Hichem
      LRect.Left := cSpacing * 2
    else
      LRect.Right := LRect.Right - cSpacing * 2; // Hichem
    DrawText(Canvas.Handle, FActiveItem.DisabledHeader, -1, LRect, AL);
    Inc(LY, LTextHeight + cSpacing);
  end;
  // Draw body
  LRect := ClientRect;
  Canvas.Font.Style := [];
  LLeftPos := LRect.Left + (2 * cSpacing);
  LRightPos := LRect.Right - (2 * cSpacing);
  if LShowImage then
    if HintControl.BiDiMode = bdLeftToRight then // Hichem
      Inc(LLeftPos, FImage.Width)
    else
      Dec(LRightPos, FImage.Width);
  LRect.Left := LLeftPos;
  LRect.Right := LRightPos;
  LRect.Bottom := LRect.Top;
  DrawText(Canvas.Handle, FBody, -1, LRect, AL or DT_WORDBREAK or DT_CALCRECT);
  Inc(LRect.Top, LY);
  Inc(LRect.Bottom, LY);
  LRect.Right := LRightPos; // Hichem
  DrawText(Canvas.Handle, FBody, -1, LRect, AL or DT_WORDBREAK);
  DrawFooter;
  LRect := Rect(0, 0, ClientWidth, ClientHeight);
  // Draw border
  DrawBorder(LRect);
end;
Attachment
None
Comments

None

Server Response from: ETNACODE01