mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 10:19:12 +02:00
ideintf: objectinspector: reduced updating combobox
git-svn-id: trunk@27854 -
This commit is contained in:
parent
8d4edbc7fc
commit
0f581e002a
@ -400,7 +400,7 @@ type
|
|||||||
procedure SetSubPropertiesColor(const AValue: TColor);
|
procedure SetSubPropertiesColor(const AValue: TColor);
|
||||||
procedure SetReadOnlyColor(const AValue: TColor);
|
procedure SetReadOnlyColor(const AValue: TColor);
|
||||||
procedure UpdateScrollBar;
|
procedure UpdateScrollBar;
|
||||||
procedure FillComboboxItems;
|
function FillComboboxItems: boolean; // true if something changed
|
||||||
function EditorFilter(const AEditor: TPropertyEditor): Boolean;
|
function EditorFilter(const AEditor: TPropertyEditor): Boolean;
|
||||||
protected
|
protected
|
||||||
procedure CreateParams(var Params: TCreateParams); override;
|
procedure CreateParams(var Params: TCreateParams); override;
|
||||||
@ -971,11 +971,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TOICustomPropertyGrid.FillComboboxItems;
|
function TOICustomPropertyGrid.FillComboboxItems: boolean;
|
||||||
var
|
var
|
||||||
ExcludeUpdateFlag: boolean;
|
ExcludeUpdateFlag: boolean;
|
||||||
CurRow: TOIPropertyGridRow;
|
CurRow: TOIPropertyGridRow;
|
||||||
begin
|
begin
|
||||||
|
Result:=false;
|
||||||
ExcludeUpdateFlag:=not (pgsUpdatingEditControl in FStates);
|
ExcludeUpdateFlag:=not (pgsUpdatingEditControl in FStates);
|
||||||
Include(FStates,pgsUpdatingEditControl);
|
Include(FStates,pgsUpdatingEditControl);
|
||||||
ValueComboBox.Items.BeginUpdate;
|
ValueComboBox.Items.BeginUpdate;
|
||||||
@ -985,15 +986,18 @@ begin
|
|||||||
CurRow.Editor.GetValues(@AddStringToComboBox);
|
CurRow.Editor.GetValues(@AddStringToComboBox);
|
||||||
if FNewComboBoxItems<>nil then begin
|
if FNewComboBoxItems<>nil then begin
|
||||||
FNewComboBoxItems.Sorted:=paSortList in CurRow.Editor.GetAttributes;
|
FNewComboBoxItems.Sorted:=paSortList in CurRow.Editor.GetAttributes;
|
||||||
if not ValueComboBox.Items.Equals(FNewComboBoxItems) then begin
|
if ValueComboBox.Items.Equals(FNewComboBoxItems) then exit;
|
||||||
ValueComboBox.Items.Assign(FNewComboBoxItems);
|
ValueComboBox.Items.Assign(FNewComboBoxItems);
|
||||||
end;
|
|
||||||
//debugln('TOICustomPropertyGrid.FillComboboxItems "',FNewComboBoxItems.Text,'" Cur="',ValueComboBox.Items.Text,'" ValueComboBox.Items.Count=',dbgs(ValueComboBox.Items.Count));
|
//debugln('TOICustomPropertyGrid.FillComboboxItems "',FNewComboBoxItems.Text,'" Cur="',ValueComboBox.Items.Text,'" ValueComboBox.Items.Count=',dbgs(ValueComboBox.Items.Count));
|
||||||
|
end else if ValueComboBox.Items.Count=0 then begin
|
||||||
|
exit;
|
||||||
end else begin
|
end else begin
|
||||||
ValueComboBox.Items.Text:='';
|
ValueComboBox.Items.Text:='';
|
||||||
ValueComboBox.Items.Clear;
|
ValueComboBox.Items.Clear;
|
||||||
//debugln('TOICustomPropertyGrid.FillComboboxItems FNewComboBoxItems=nil Cur="',ValueComboBox.Items.Text,'" ValueComboBox.Items.Count=',dbgs(ValueComboBox.Items.Count));
|
//debugln('TOICustomPropertyGrid.FillComboboxItems FNewComboBoxItems=nil Cur="',ValueComboBox.Items.Text,'" ValueComboBox.Items.Count=',dbgs(ValueComboBox.Items.Count));
|
||||||
end;
|
end;
|
||||||
|
Result:=true;
|
||||||
|
//debugln(['TOICustomPropertyGrid.FillComboboxItems CHANGED']);
|
||||||
finally
|
finally
|
||||||
FreeAndNil(FNewComboBoxItems);
|
FreeAndNil(FNewComboBoxItems);
|
||||||
ValueComboBox.Items.EndUpdate;
|
ValueComboBox.Items.EndUpdate;
|
||||||
@ -2930,6 +2934,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TOICustomPropertyGrid.ValueComboBoxGetItems(Sender: TObject);
|
procedure TOICustomPropertyGrid.ValueComboBoxGetItems(Sender: TObject);
|
||||||
|
{ This event is called whenever the widgetset updates the list.
|
||||||
|
On gtk the list is updated just before the user popups the list.
|
||||||
|
Other widgetsets need the list always, which is bad, as this means collecting
|
||||||
|
all items even if the dropdown never happens.
|
||||||
|
}
|
||||||
var
|
var
|
||||||
CurRow: TOIPropertyGridRow;
|
CurRow: TOIPropertyGridRow;
|
||||||
MaxItemWidth, CurItemWidth, i, Cnt: integer;
|
MaxItemWidth, CurItemWidth, i, Cnt: integer;
|
||||||
@ -2939,7 +2948,6 @@ var
|
|||||||
begin
|
begin
|
||||||
Include(FStates,pgsGetComboItemsCalled);
|
Include(FStates,pgsGetComboItemsCalled);
|
||||||
if (FItemIndex>=0) and (FItemIndex<FRows.Count) then begin
|
if (FItemIndex>=0) and (FItemIndex<FRows.Count) then begin
|
||||||
//debugln('TOICustomPropertyGrid.ValueComboBoxDropDown A');
|
|
||||||
ExcludeUpdateFlag:=not (pgsUpdatingEditControl in FStates);
|
ExcludeUpdateFlag:=not (pgsUpdatingEditControl in FStates);
|
||||||
Include(FStates,pgsUpdatingEditControl);
|
Include(FStates,pgsUpdatingEditControl);
|
||||||
ValueComboBox.Items.BeginUpdate;
|
ValueComboBox.Items.BeginUpdate;
|
||||||
@ -2947,7 +2955,7 @@ begin
|
|||||||
CurRow:=Rows[FItemIndex];
|
CurRow:=Rows[FItemIndex];
|
||||||
|
|
||||||
// Items
|
// Items
|
||||||
FillComboboxItems;
|
if not FillComboboxItems then exit;
|
||||||
|
|
||||||
// Text and ItemIndex
|
// Text and ItemIndex
|
||||||
CurValue:=CurRow.Editor.GetVisualValue;
|
CurValue:=CurRow.Editor.GetVisualValue;
|
||||||
@ -3167,7 +3175,6 @@ begin
|
|||||||
if TypeKind in [tkEnumeration, tkBool, tkSet] then
|
if TypeKind in [tkEnumeration, tkBool, tkSet] then
|
||||||
begin
|
begin
|
||||||
// set value to next value in list
|
// set value to next value in list
|
||||||
FillComboboxItems;
|
|
||||||
if ValueComboBox.Items.Count = 0 then Exit;
|
if ValueComboBox.Items.Count = 0 then Exit;
|
||||||
if ValueComboBox.ItemIndex < (ValueComboBox.Items.Count - 1) then
|
if ValueComboBox.ItemIndex < (ValueComboBox.Items.Count - 1) then
|
||||||
ValueComboBox.ItemIndex := ValueComboBox.ItemIndex + 1
|
ValueComboBox.ItemIndex := ValueComboBox.ItemIndex + 1
|
||||||
|
Loading…
Reference in New Issue
Block a user