mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2026-02-19 18:36:42 +01:00
lcl: redo fixing issue #0016354, don't set ItemIndex = -1 after loading
git-svn-id: trunk@25095 -
This commit is contained in:
parent
db018c3342
commit
f82013575c
@ -42,15 +42,17 @@ begin
|
|||||||
FItems.Free;
|
FItems.Free;
|
||||||
end;
|
end;
|
||||||
// and use the interface based list
|
// and use the interface based list
|
||||||
FItems:= NewStrings;
|
FItems := NewStrings;
|
||||||
|
|
||||||
TWSCustomComboBoxClass(WidgetSetClass).SetItemIndex(Self, FItemIndex);
|
if FItemIndex <> -1 then
|
||||||
|
TWSCustomComboBoxClass(WidgetSetClass).SetItemIndex(Self, FItemIndex);
|
||||||
TWSCustomComboBoxClass(WidgetSetClass).SetStyle(Self, FStyle);
|
TWSCustomComboBoxClass(WidgetSetClass).SetStyle(Self, FStyle);
|
||||||
TWSCustomComboBoxClass(WidgetSetClass).SetArrowKeysTraverseList(Self, FArrowKeysTraverseList);
|
TWSCustomComboBoxClass(WidgetSetClass).SetArrowKeysTraverseList(Self, FArrowKeysTraverseList);
|
||||||
TWSCustomComboBoxClass(WidgetSetClass).SetReadOnly(Self, FReadOnly);
|
TWSCustomComboBoxClass(WidgetSetClass).SetReadOnly(Self, FReadOnly);
|
||||||
TWSCustomComboBoxClass(WidgetSetClass).SetMaxLength(Self, FMaxLength);
|
TWSCustomComboBoxClass(WidgetSetClass).SetMaxLength(Self, FMaxLength);
|
||||||
|
|
||||||
if FSelStart <> FSelLength then begin
|
if FSelStart <> FSelLength then
|
||||||
|
begin
|
||||||
ASelStart:= FSelStart;
|
ASelStart:= FSelStart;
|
||||||
ASelLength:= FSelLength;
|
ASelLength:= FSelLength;
|
||||||
SelStart:= ASelStart;
|
SelStart:= ASelStart;
|
||||||
@ -898,10 +900,10 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TCustomComboBox.GetItemIndex : integer;
|
function TCustomComboBox.GetItemIndex : integer;
|
||||||
begin
|
begin
|
||||||
if not (csDestroying in ComponentState)
|
if not (csDestroying in ComponentState) and
|
||||||
and not (csDestroyingHandle in ControlState) and HandleAllocated then
|
not (csDestroyingHandle in ControlState) and HandleAllocated then
|
||||||
FItemIndex:= TWSCustomComboBoxClass(WidgetSetClass).GetItemIndex(Self);
|
FItemIndex:= TWSCustomComboBoxClass(WidgetSetClass).GetItemIndex(Self);
|
||||||
Result:=FItemIndex;
|
Result := FItemIndex;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -375,10 +375,14 @@ begin
|
|||||||
// restore text in edit box
|
// restore text in edit box
|
||||||
UpdateComboHeight;
|
UpdateComboHeight;
|
||||||
TWin32WSCustomComboBox.SetText(FSender, EditText);
|
TWin32WSCustomComboBox.SetText(FSender, EditText);
|
||||||
lItemIndex := IndexOf(EditText);
|
if EditText = '' then
|
||||||
|
lItemIndex := -1
|
||||||
|
else
|
||||||
|
lItemIndex := IndexOf(EditText);
|
||||||
if lItemIndex <> -1 then
|
if lItemIndex <> -1 then
|
||||||
TWin32WSCustomComboBox.SetItemIndex(TCustomComboBox(FSender), lItemIndex);
|
TWin32WSCustomComboBox.SetItemIndex(TCustomComboBox(FSender), lItemIndex);
|
||||||
end else
|
end
|
||||||
|
else
|
||||||
inherited Assign(Source);
|
inherited Assign(Source);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
@ -858,12 +858,6 @@ end;
|
|||||||
class function TWin32WSCustomComboBox.GetItemIndex(const ACustomComboBox: TCustomComboBox): integer;
|
class function TWin32WSCustomComboBox.GetItemIndex(const ACustomComboBox: TCustomComboBox): integer;
|
||||||
begin
|
begin
|
||||||
Result := SendMessage(ACustomComboBox.Handle, CB_GETCURSEL, 0, 0);
|
Result := SendMessage(ACustomComboBox.Handle, CB_GETCURSEL, 0, 0);
|
||||||
if Result = LB_ERR Then
|
|
||||||
Begin
|
|
||||||
Assert(False, 'Trace:[TWin32WidgetSet.IntSendMessage3] Could not retrieve item index '+
|
|
||||||
'via LM_GETITEMINDEX; try selecting an item first');
|
|
||||||
Result := -1;
|
|
||||||
End;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TWin32WSCustomComboBox.GetMaxLength(const ACustomComboBox: TCustomComboBox): integer;
|
class function TWin32WSCustomComboBox.GetMaxLength(const ACustomComboBox: TCustomComboBox): integer;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user