ButtonWidth property not working on TwwDBComboBox and TwwDBComboDlg

Comments

2 comments

  • Official comment
    Roy Woll

    I have reproduced your problem and will incorporate a fix in future builds.  If you require immediate resolution, you can modify our source in vcl.wwdotdot.pas as follows. Please note the code labeled 4/28/2020

    Procedure TwwDBCustomCombo.UpdateButtonPosition;
    var offset :Integer;
    begin
      if Frame.IsFrameEffective then
      begin
         offset:= 2;
      end
      else offset:= 0;
    
      // Update now, as it can get rescaled incorrectly in high dpi
    
      if FButtonWidth=0 then // 4/28/2020
        FButton.Width:= wwmax(GetSystemMetrics(SM_CXVSCROLL), wwAdjustPixels(15, 96)) // 4/2/18
      else
        FButton.Width:= wwAdjustPixels(FButtonWidth, 96);
    
      if UseRightToLeftAlignment then // Support bidimode for button - 8/26/08
      begin
        if (not NewStyleControls) or (BorderStyle = bsNone) or (not Ctl3d) then
           FBtnControl.SetBounds (1, offset, FButton.Width, ClientHeight-offset*2)
        else
           FBtnControl.SetBounds (0, offset, FButton.Width, ClientHeight-offset);
      end
      else begin
        if (not NewStyleControls) or (BorderStyle = bsNone) or (not Ctl3d) then
           FBtnControl.SetBounds (Width - FButton.Width - offset, offset, FButton.Width, ClientHeight-offset*2)
        else
           FBtnControl.SetBounds (Width - FButton.Width - 4, offset, FButton.Width, ClientHeight-offset);
      end;
      if BorderStyle = bsNone then begin
         FButton.Top:= -1; {Allows bitmap to be larger }
         FButton.Height := FBtnControl.Height+1;
      end
      else begin
         FButton.Top:= 0; {Allows bitmap to be larger }
         FButton.Height := FBtnControl.Height;
      end;
    
      SetEditRect;
    
      // 3/10/18 - Or dbchecku.pas demo has wrong height for comboboxes
      if (Screen.PixelsPerInch>96) then
      begin
        if (BorderStyle=bsNone) and AutoSize and
           not wwIsClass(parent, 'TCustomGrid') then Frame.AdjustHeight;
      end;
    
    end;
    
    Comment actions Permalink
  • Massimo Clot

    Great! Thanks a lot, Roy!!

    Massimo

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk