gpt4 book ai didi

delphi - TActionList中的 Action 可以在Delphi XE IDE中排序吗?

转载 作者:行者123 更新时间:2023-12-03 18:19:33 27 4
gpt4 key购买 nike

当 DXE IDE 中的 Action 数量增加时,在单个 Action 列表中,很快就很难找到您要检查或更改的 Action 。

没有像组件那样的搜索/过滤框,并且操作不会自动排序。在代码中对 Action 声明进行排序不会改变它们在 Action 列表编辑器中的显示顺序。

甚至增量搜索都不起作用:如果您聚焦操作列表 Pane 并开始键入,则按键会转到对象检查器(并且您无意中更改了某些属性或其他)。主要烦恼!

是否可能存在隐藏设置、注册表破解(Delphi 有很多),或者第三方扩展可以保持操作排序?

最佳答案

编写一个小型 IDE 插件,用排序选项扩展 TActionList 的上下文菜单。要对操作列表进行排序,您可以使用以下代码:

procedure SortActions(ActionList: TActionList);
var
act: TContainedAction;
arr: TArray<TContainedAction>;
I: Integer;
begin
SetLength(arr, ActionList.ActionCount);
for I := 0 to ActionList.ActionCount - 1 do begin
arr[I] := ActionList[I];
end;
TArray.Sort<TContainedAction>(arr,
TDelegatedComparer<TContainedAction>.Create(
function(const Left, Right: TContainedAction): Integer
begin
result := CompareText(Left.Name, Right.Name);
end));
for I := 0 to High(arr) do
arr[I].Index := I;
end;

关于delphi - TActionList中的 Action 可以在Delphi XE IDE中排序吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7456003/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com