Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
  • Sign in / Register
  • Lazarus Lazarus
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 2,094
    • Issues 2,094
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 7
    • Merge requests 7
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • Code review
    • Insights
    • Issue
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar

Scheduled maintenance on the database layer will take place on 2022-07-02. We expect GitLab.com to be unavailable for up to 2 hours starting from 06:00 UTC. Kindly follow our status page for updates and read more in our blog post.

  • FPC
  • Lazarus
  • LazarusLazarus
  • Issues
  • #29149
Closed
Open
Created Dec 08, 2015 by FPC Admin account@fpc_adminOwner

TCustomComboBox: Support Windows Message CB_SETDROPPEDWIDTH

Original Reporter info from Mantis: Simon Ameis @SAmeis
  • Reporter name: Simon Ameis

Description:

Currently the property TCustomComboBox.ItemWidth is ignored on Windows. This may be changed by sending a CB_SETDROPPEDWIDTH message to the combobox's handle.

https://msdn.microsoft.com/en-us/library/windows/desktop/bb775901%28v=vs.85%29.aspx

Additional information:

The correct place where to put this SendMessage could be TWin32WidgetSet.SetComboMinDropDownSize() which may be changed to 
<code>function TWin32WidgetSet.SetComboMinDropDownSize(Handle: HWND; MinItemsWidth,
  MinItemsHeight, MinItemCount: integer): boolean;
begin
  Result:= ThemeServices.ThemesEnabled and
    boolean(Windows.SendMessage(Handle, CB_SETMINVISIBLE, MinItemCount, 0));
  Result := Result and boolean(Windows.SendMessage(Handle, CB_SETDROPPEDWIDTH, MinItemsWidth, 0));
end;</code>

But this method is never called during application startup; this may be an error in TCustomComboBox.AdjustDropDown:
<code>procedure TCustomComboBox.AdjustDropDown;
var
  Count, MinItemsWidth, MinItemsHeight: Integer;
begin
  if (not HandleAllocated) or (not DroppedDown) then exit;
  Count := Items.Count;
  if Count > DropDownCount then Count := DropDownCount;
  if Count < 1 then Count := 1;
  MinItemsWidth := ItemWidth;
  MinItemsHeight := Count * ItemHeight;
  SetComboMinDropDownSize(Handle, MinItemsWidth, MinItemsHeight, Count);
end;</code>
may need to be changed to
<code>procedure TCustomComboBox.AdjustDropDown;
var
  Count, MinItemsWidth, MinItemsHeight: Integer;
begin
  if (not HandleAllocated) then exit;
  Count := Items.Count;
  if Count > DropDownCount then Count := DropDownCount;
  if Count < 1 then Count := 1;
  MinItemsWidth := ItemWidth;
  MinItemsHeight := Count * ItemHeight;
  SetComboMinDropDownSize(Handle, MinItemsWidth, MinItemsHeight, Count);
end;</code>

Mantis conversion info:

  • Mantis ID: 29149
  • OS: Windows
  • Version: 1.4.4
  • Fixed in version: 1.7 (SVN)
  • Fixed in revision: 51094 (#9effa4e6)
  • Target version: 1.6
Assignee
Assign to
Time tracking