mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 20:39:14 +02:00
MG: fixed TComboBox and InvalidateControl
git-svn-id: trunk@3258 -
This commit is contained in:
parent
3e9ae9aac4
commit
5e4938af5d
@ -31,11 +31,9 @@ var NewStrings : TStrings;
|
|||||||
begin
|
begin
|
||||||
inherited CreateHandle;
|
inherited CreateHandle;
|
||||||
|
|
||||||
// create an interface based item list
|
// get the interface based item list
|
||||||
NewStrings:= TStrings(Pointer(CNSendMessage(LM_GETITEMS, Self, nil)));
|
NewStrings:= TStrings(Pointer(CNSendMessage(LM_GETITEMS, Self, nil)));
|
||||||
// copy the values
|
// then delete internal list
|
||||||
NewStrings.Assign(FItems);
|
|
||||||
// delete internal list
|
|
||||||
FItems.Free;
|
FItems.Free;
|
||||||
// and use the interface based list
|
// and use the interface based list
|
||||||
FItems:= NewStrings;
|
FItems:= NewStrings;
|
||||||
@ -170,8 +168,6 @@ end;
|
|||||||
procedure TCustomComboBox.Loaded;
|
procedure TCustomComboBox.Loaded;
|
||||||
begin
|
begin
|
||||||
inherited Loaded;
|
inherited Loaded;
|
||||||
if FItemIndex>=0 then
|
|
||||||
SetItemIndex(FItemIndex);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -407,6 +403,8 @@ begin
|
|||||||
fCompStyle := csComboBox;
|
fCompStyle := csComboBox;
|
||||||
SetBounds(1,1,100,25);
|
SetBounds(1,1,100,25);
|
||||||
FItems := TStringlist.Create;
|
FItems := TStringlist.Create;
|
||||||
|
FItemIndex:=-1;
|
||||||
|
FDropDownCount:=8;
|
||||||
// FItems:= TComboBoxStrings.Create;
|
// FItems:= TComboBoxStrings.Create;
|
||||||
// TComboBoxStrings(FItems).ComboBox := Self;
|
// TComboBoxStrings(FItems).ComboBox := Self;
|
||||||
end;
|
end;
|
||||||
@ -474,16 +472,11 @@ end;
|
|||||||
if no item is currently selected.
|
if no item is currently selected.
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TCustomComboBox.GetItemIndex : integer;
|
function TCustomComboBox.GetItemIndex : integer;
|
||||||
var
|
|
||||||
CacheText : string;
|
|
||||||
begin
|
begin
|
||||||
// ToDo: ask the interface
|
if HandleAllocated then
|
||||||
|
Result:= CNSendMessage(LM_GETITEMINDEX, Self, nil)
|
||||||
{ I am not sure whether the item remains selected after the user pressed the item }
|
else
|
||||||
{ Result:= CNSendMessage(LM_GETITEMINDEX, Self, nil);}
|
Result:=FItemIndex;
|
||||||
CacheText := Text;
|
|
||||||
Result:= Items.Count-1;
|
|
||||||
while (Result>=0) and (Items[Result]<>CacheText) do dec(Result);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -497,6 +490,8 @@ procedure TCustomComboBox.SetItemIndex(Val : integer);
|
|||||||
begin
|
begin
|
||||||
if FItemIndex=Val then exit;
|
if FItemIndex=Val then exit;
|
||||||
FItemIndex:=Val;
|
FItemIndex:=Val;
|
||||||
|
if (FItemIndex>=0) and (not (csLoading in ComponentState)) then
|
||||||
|
Text:=FItems[FItemIndex];
|
||||||
if HandleAllocated then
|
if HandleAllocated then
|
||||||
CNSendMessage(LM_SETITEMINDEX, Self, Pointer(FItemIndex));
|
CNSendMessage(LM_SETITEMINDEX, Self, Pointer(FItemIndex));
|
||||||
end;
|
end;
|
||||||
@ -515,6 +510,9 @@ end;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.10 2002/08/29 00:07:01 lazarus
|
||||||
|
MG: fixed TComboBox and InvalidateControl
|
||||||
|
|
||||||
Revision 1.9 2002/08/27 18:45:13 lazarus
|
Revision 1.9 2002/08/27 18:45:13 lazarus
|
||||||
MG: propedits text improvements from Andrew, uncapturing, improved comobobox
|
MG: propedits text improvements from Andrew, uncapturing, improved comobobox
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user