Topic: combo box

Hello MVD!

In my project i have text field defined which has a long text input and it should be displayed in the combo box. Is the a way to stretch the long fields to fit in the combo box? Please help!

Thanks!

Re: combo box

procedure Form1_ComboBox1_OnDropDown (Sender: TObject);
var
  i, L, mWidth: integer;
begin
  mWidth:=0;
  for i := 0 to Form1.ComboBox1.Items.Count - 1 do
     if (Form1.Canvas.TextWidth(Form1.ComboBox1.Items[i]) > mWidth) then mWidth := Form1.Canvas.TextWidth(Form1.ComboBox1.Items[i])+20;

  SendMessage(Form1.ComboBox1.Handle, $0160, mWidth, 0);
end;

Re: combo box

Thanks sibprogsistem,

What about to fit in multiline?

Thanks!

4 (edited by sibprogsistem 2019-11-18 12:20:10)

Re: combo box

http://www.delphibasics.co.uk/RTL.asp?N … dCode2=Yes
 
wraptext  sad

Re: combo box

sibprogsistem
Nice example! Thanks.

Dmitry.