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
@ -44,13 +44,15 @@ begin
|
||||
// and use the interface based list
|
||||
FItems := NewStrings;
|
||||
|
||||
if FItemIndex <> -1 then
|
||||
TWSCustomComboBoxClass(WidgetSetClass).SetItemIndex(Self, FItemIndex);
|
||||
TWSCustomComboBoxClass(WidgetSetClass).SetStyle(Self, FStyle);
|
||||
TWSCustomComboBoxClass(WidgetSetClass).SetArrowKeysTraverseList(Self, FArrowKeysTraverseList);
|
||||
TWSCustomComboBoxClass(WidgetSetClass).SetReadOnly(Self, FReadOnly);
|
||||
TWSCustomComboBoxClass(WidgetSetClass).SetMaxLength(Self, FMaxLength);
|
||||
|
||||
if FSelStart <> FSelLength then begin
|
||||
if FSelStart <> FSelLength then
|
||||
begin
|
||||
ASelStart:= FSelStart;
|
||||
ASelLength:= FSelLength;
|
||||
SelStart:= ASelStart;
|
||||
@ -898,8 +900,8 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
function TCustomComboBox.GetItemIndex : integer;
|
||||
begin
|
||||
if not (csDestroying in ComponentState)
|
||||
and not (csDestroyingHandle in ControlState) and HandleAllocated then
|
||||
if not (csDestroying in ComponentState) and
|
||||
not (csDestroyingHandle in ControlState) and HandleAllocated then
|
||||
FItemIndex:= TWSCustomComboBoxClass(WidgetSetClass).GetItemIndex(Self);
|
||||
Result := FItemIndex;
|
||||
end;
|
||||
|
||||
@ -375,10 +375,14 @@ begin
|
||||
// restore text in edit box
|
||||
UpdateComboHeight;
|
||||
TWin32WSCustomComboBox.SetText(FSender, EditText);
|
||||
if EditText = '' then
|
||||
lItemIndex := -1
|
||||
else
|
||||
lItemIndex := IndexOf(EditText);
|
||||
if lItemIndex <> -1 then
|
||||
TWin32WSCustomComboBox.SetItemIndex(TCustomComboBox(FSender), lItemIndex);
|
||||
end else
|
||||
end
|
||||
else
|
||||
inherited Assign(Source);
|
||||
end;
|
||||
|
||||
|
||||
@ -858,12 +858,6 @@ end;
|
||||
class function TWin32WSCustomComboBox.GetItemIndex(const ACustomComboBox: TCustomComboBox): integer;
|
||||
begin
|
||||
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;
|
||||
|
||||
class function TWin32WSCustomComboBox.GetMaxLength(const ACustomComboBox: TCustomComboBox): integer;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user