procedure THIComboBox.Init;
var Flags:TComboOptions;
begin
Flags := [{coNoIntegralHeight}];
if (_prop_ReadOnly = 0) then include(Flags,coReadOnly);
if _prop_Sort then include(Flags,coSort);
if ManFlags and $8 > 0 then include(Flags,coOwnerDrawFixed);
Control := NewCombobox(FParent,Flags);
Control.OnMeasureItem:= _OnMeasureItem;
// === DropDownCount === //
if (GetComCtlVersion and $FFFF0000) shr 16 >= 6 then
Control.Perform(CB_SETMINVISIBLE, _prop_DropDownCount, 0)
else
Control.OnDropDown := _OnDropDown;
// === ============ === //
inherited;
SetStrings(_prop_Strings);
with Control{$ifndef F_P}^{$endif} do
begin
if (_prop_ReadOnly <> 0) then OnChange := _OnChange;
Text := _prop_Text;
OnSelChange := _OnClick;
if ManFlags and $8 > 0 then OnDrawItem := _OnDrawItem;
if (Count > 0) and (_prop_ReadOnly = 0) then CurIndex := 0;
end;
end;
// === DropDownCount === //
procedure THIComboBox._OnDropDown( Sender: PObj );
var
CB: PControl;
IC: Integer;
H: Integer;
begin
CB := PControl( Sender );
IC := CB.Count;
if IC > _prop_DropDownCount then IC := _prop_DropDownCount;
if IC < 1 then IC := 1;
H := CB.Perform(CB_GETITEMHEIGHT, 0, 0);
MoveWindow(CB.Handle, CB.Left, CB.Top, CB.Width, H * (IC + 2) + 2, false);
end;
procedure THIComboBox._work_doDropDownCount;
begin
_prop_DropDownCount := ToInteger(_Data);
if (GetComCtlVersion and $FFFF0000) shr 16 >= 6 then
Control.Perform(CB_SETMINVISIBLE, _prop_DropDownCount, 0);
end;
Netspirit писал(а):
Но если уж на то пошло, то это свойство можно было бы прямо в KOL вписатьНеее, KOL мы трогать не будем