* * *

Author Topic: [Solved] TComboBox DropDown Width?  (Read 5714 times)

Avishai

  • Hero Member
  • *****
  • Posts: 1021
[Solved] TComboBox DropDown Width?
« on: July 10, 2012, 11:33:25 am »
Is there a way to make the DropDown of a TComblox wider than TComboBox?  I see it in other apps but I have not found a way with Lazarus TCombox.
« Last Edit: July 10, 2012, 01:03:45 pm by Avishai »
Lazarus Trunk / fpc 2.6.2 / Win32

wp

  • Hero Member
  • *****
  • Posts: 5056
Re: TComboBox DropDown Width?
« Reply #1 on: July 10, 2012, 12:35:58 pm »
This (http://delphi.about.com/b/2012/07/03/sizing-tcombobox-drop-down-list-width-no-cut-off.htm) is for Delphi and Windows. Maybe it works for Lazarus as well.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: TComboBox DropDown Width?
« Reply #2 on: July 10, 2012, 01:03:15 pm »
Thanks wp.  It took a bit to find all the units to add to the Uses, but it worked perfectly.  I think it is Windows Only, but that is OK for me.

I wrote a TFontComboBox but some Font Names are very long.  I didn't want to make the ComboBox so wide and it looked bad.  Now it is fine.

If anyone wants the TFontComboBox, let me know and I will share.
Lazarus Trunk / fpc 2.6.2 / Win32

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 4906
    • wiki
Re: TComboBox DropDown Width?
« Reply #3 on: July 10, 2012, 01:10:08 pm »
Thanks wp.  It took a bit to find all the units to add to the Uses, but it worked perfectly.  I think it is Windows Only, but that is OK for me.

If you use 0.9.31 and install package cody: There is an "identifier/unit dictionary". It finds the unit for any identifier.

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: [Solved] TComboBox DropDown Width?
« Reply #4 on: July 10, 2012, 01:12:07 pm »
Thanks Martin_fr,  I will have to see if I can find it.  It sounds like a real time saver :)
Lazarus Trunk / fpc 2.6.2 / Win32

Ocye

  • Hero Member
  • *****
  • Posts: 518
    • Scrabble3D
Re: [Solved] TComboBox DropDown Width?
« Reply #5 on: July 13, 2012, 09:45:13 pm »
Any idea how to increase size under *nix? Unfortunately, CB_SETDROPPEDWIDTH does not exists but native Gtk2 procedures, I guess it's themed stuff, work well.
Lazarus 1.7 (SVN) FPC 3.0.0

CM630

  • Hero Member
  • *****
  • Posts: 845
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: [Solved] TComboBox DropDown Width?
« Reply #6 on: October 24, 2018, 11:10:08 am »

Since it took me quite a long time to find the solution, here is what works for me (Sadly, only in Windows):

Code: Pascal  [Select]
  1. ...uses... Windows...
  2.  
  3.  
  4. procedure ComboDDWidth( ComboBox : TComboBox; DDWidth: longint);
  5. begin
  6.   sendMessage(ComboBox.Handle, CB_SETDROPPEDWIDTH, DDWidth, 0);
  7. end;  
Лазар 1,8,2;W7 64bit or XP 32bit;FPC3,0,4;rev 57369

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus