如何更新Delphi对象检查器? [英] How to update the Delphi Object Inspector?

查看:55
本文介绍了如何更新Delphi对象检查器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在此问题之后,我最近发布了以下内容:可以组件编辑器可以在多个组件上执行吗?

Following on from this question I recently posted: Can a Component Editor be executed on multiple components?

我为新组件创建了一个ComponentEditor,该组件在执行时会显示一个TOpenDialog以选择配置文件.加载文件后,我读取了数据并将值复制到调用组件(该组件为 Component ,因为它是TComponentEditor).

I have created a ComponentEditor for a new component that when executed shows a TOpenDialog to select a configuration File. When a File is loaded I read the data and copy the values to the calling component (which is Component as this is a TComponentEditor).

根本没有问题,只是对象检查器没有更新以反映新更改的值-仅在单击设计器中的组件时更新.

There are no problems at all, except that the Object Inspector is not updating to reflect the newly changed values - It only updates when clicking back on the component in the Designer.

这似乎没什么大不了的,但是我需要对象检查器以某种方式进行自我更新,以便可以看到属性已成功更改(而不必将焦点切换回控件).

It might not seem like such a big a deal, but I need the Object Inspector to update itself somehow so that I can see the properties have changed successfully (without having to switch focus back to the control).

因此,是否可以通过某种方式让Delphi知道它应该更新/刷新对象检查器?我

So, is there some way of letting Delphi know that it should update/refresh the Object Inspector? I

推荐答案

根据需要修改组件后,组件编辑器需要调用 IDesigner.Modified()方法,例如:

After modifying the component as needed, your component editor needs to call the IDesigner.Modified() method, eg:

procedure TMyComponentEditor.ExecuteVerb(Index: Integer);
var
  Dlg: TOpenDialog;
begin
  ...
  Dlg := TOpenDialog.Create(nil);
  try
    ...
    if Dlg.Execute then
    begin
      ...
      Designer.Modified;
    end;
  finally
    Dlg.Free;
  end;
  ...
end;

这篇关于如何更新Delphi对象检查器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆