* Fixed setting itemindex=-1 without handle

* Fixed selchange events during combo destoy 

git-svn-id: trunk@9043 -
This commit is contained in:
marc 2006-03-29 19:21:18 +00:00
parent 47fb489c2e
commit 116d6521cf
2 changed files with 19 additions and 12 deletions

View File

@ -789,21 +789,23 @@ procedure TCustomComboBox.SetItemIndex(Val : integer);
begin
//if CompareText(Name,'TextToFindComboBox')=0 then
// debugln('TCustomComboBox.SetItemIndex A ',DbgSName(Self),' Text="',Text,'"');
if Val=GetItemIndex then exit;
if (Val>=Items.Count) and (not (csLoading in ComponentState)) then exit;
if Val = GetItemIndex then exit;
if Val < -1 then Exit;
if (Val >= Items.Count) and (not (csLoading in ComponentState)) then exit;
FItemIndex:= Val;
if not (csLoading in ComponentState) then begin
//if (FItemIndex>=0) and (not (csLoading in ComponentState)) then
// Text:=FItems[FItemIndex];
if HandleAllocated then begin
TWSCustomComboBoxClass(WidgetSetClass).SetItemIndex(Self, FItemIndex);
Select;
end else begin
// remember text, in case one reads text without creating handle
Text := FItems.Strings[FItemIndex];
end;
if csLoading in ComponentState then Exit;
if HandleAllocated then begin
TWSCustomComboBoxClass(WidgetSetClass).SetItemIndex(Self, FItemIndex);
Select;
end else begin
// remember text, in case one reads text without creating handle
if Val = -1
then Text := ''
else Text := FItems.Strings[FItemIndex];
end;
//if CompareText(Name,'TextToFindComboBox')=0 then
// debugln('TCustomComboBox.SetItemIndex END ',DbgSName(Self),' Text="',Text,'"');
end;

View File

@ -4143,7 +4143,12 @@ begin
// childs
if GtkWidgetIsA(Widget,GTK_COMBO_GET_TYPE) then begin
g_signal_handlers_destroy(PGtkObject(PGtkCombo(Widget)^.Entry));
g_signal_handlers_destroy(PGtkObject(PGtkCombo(Widget)^.List));
SetComboBoxText(PGtkCombo(Widget),nil);
// MWE:
// TODO: Check: Why is there widgetinfo on subwidgets ???
FreeWidgetInfo(PGtkCombo(Widget)^.Entry);
FreeWidgetInfo(PGtkCombo(Widget)^.Button);
end;