Recent

Author Topic: [Solved] TComboBox DropDown Width?  (Read 8201 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: 11858
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.

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: 9794
  • Debugger - SynEdit - and more
    • 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: 1082
  • Не съм сигурен, че те разбирам.
    • 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;  
Лазар 3,2 32 bit (sometimes 64 bit); FPC3,2,2; rev: Lazarus_3_0 on Win10 64bit.

 

TinyPortal © 2005-2018