Registriert seit: 27. Apr 2003
Ort: Bad Honnef
1.644 Beiträge
Delphi 2009 Professional
|
Re: ComboBox Text beim zuklappen beeinflussen
8. Mär 2004, 15:44
Hallo,
hier kommt mein Vorschlag:
Delphi-Quellcode:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
const
PM_COMBOBOX = WM_APP+1000;
type
TForm1 = class(TForm)
ComboBox1: TComboBox;
Button1: TButton;
procedure ComboBox1Change(Sender: TObject);
private
{ Private-Deklarationen }
procedure PMCOMBOBOX( var Msg : TMessage); message PM_COMBOBOX;
public
{ Public-Deklarationen }
end;
THelpComboBox = class(TComboBox)
public
property EditHandle;
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.ComboBox1Change(Sender: TObject);
begin
// PostMessage wird vom Formualr erst verarbeitet, wenn die
// ComboBox alle Messages verarbeitet hat.
PostMessage( Handle,PM_COMBOBOX,0,0);
end;
procedure TForm1.PMCOMBOBOX( var Msg: TMessage);
var
szBuffer : Array[0..120] of Char;
begin
StrPCopy(szBuffer,Copy(ComboBox1.Items[ComboBox1.ItemIndex],1,Pos(' :',ComboBox1.Items[ComboBox1.ItemIndex])-1));
SendMessage(THelpComboBox(ComboBox1).EditHandle,WM_SETTEXT,0,Integer(@szBuffer));
end;
end.
I come from outer space to save the human race
|
|
Zitat
|