Delphi没有显示对象/组件的“提示”。当我睡觉时 [英] Delphi not showing object/component "hints" when I am codding

查看:160
本文介绍了Delphi没有显示对象/组件的“提示”。当我睡觉时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我没记错的话,在插入组件名称后跟。后,delphi可以显示选项列表。 (点)在更多参数之前。

If i'm not mistaken delphi has the ability to show a list of options after you insert a component name followed by the "." (dot) that precedes more arguments.

我的delphi 7不在。之后显示此列表。

My delphi 7 is not showing this list after the "."

例如:当我输入

form1.edit1.

它应显示 TEdit组件的选项列表。

It should show a list of options for an "TEdit" component. Not happening, what's wrong?

代码:

unit Banri;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Clipbrd;

type
  TForm1 = class(TForm)
    EditTexto: TEdit;
    ButtonGO: TButton;
    procedure ButtonGOClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  SL: TStringList;
  Count: Integer;
  Appwin : hWnd;

implementation

{$R *.dfm}

  var
  TextoCompleto: String;



begin
  TextoCompleto:= EditTexto.Text;
  Appwin:= FindWindow(PChar(0),'Banrisul');
  if Appwin <> 0 then
  begin
      StringReplace(TextoCompleto, '.', '', [rfReplaceAll, rfIgnoreCase]);

      SL:= TStringList.Create;
      try
        ExtractStrings([' '], [], PChar(TextoCompleto), SL);
        WriteLn(SL.Text);
        ReadLn;
      finally
        SL.Free;
  end;
      Count:= 0;
      while Count <> SL.Count - 1 do
        begin
          Clipboard.AsText:= SL[Count];; //place text in clipboard
          //if Clipboard.HasFormat(CF_TEXT) then
          //do something with text
          ShowMessage(Clipboard.AsText);
          Clipboard.AsText:= SL[Count + 1];; //place next line text in clipboard
          //if Clipboard.HasFormat(CF_TEXT) then
          //do something with text
          inc(Count);
        end; //while Count <> SL.Count - 1 do
      SL.Free;
  end; //if Appwin <> 0 then


end.


推荐答案

您将两种不同的Delphi单元样式混合在一起一。您正在使用的单位是表单后面的单位( .pas )文件。但是,项目主文件( .dpr )具有不同的样式。

You have the two different Delphi unit styles mixed up into one. The unit which you're working with is the unit (.pas) file behind a form. However, a project main file (.dpr) has a different style.

项目的主文件是唯一的其中应包含 begin..end。部分。另一方面,其余单元必须具有实施部分,其中实际代码位于多个功能/过程/方法等中。

The Project's main file is the only one which should include a begin..end. section. On the other hand, the rest of the units must have an implementation section where the actual code resides for multiple functions/procedures/methods etc.

因此,在您的情况下,您需要保持默认表单的单位保持默认状态。

So in your case, you need to keep your default form's unit in-tact how it was created by default.

新的Delphi 主项目文件如下所示:

A new Delphi main project file looks something like this:

program Project1;

uses
  Vcl.Forms,
  Unit1 in 'Unit1.pas' {Form1};

{$R *.res}

begin
  Application.Initialize;
  Application.MainFormOnTaskbar := True;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.

一个新的Delphi 标准单位文件如下所示:

And a new Delphi standard unit file looks something like this:

unit Unit2;

interface

implementation

end.

一个新的Delphi vcl表单单元文件如下所示:

And a new Delphi vcl form unit file looks something like this:

unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs;

type
  TForm1 = class(TForm)
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

end.

如果您实现任何代码...

And if you implement any code...

unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs;

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    procedure DoSomething;
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
  Form1.DoSomething;
end;

procedure TForm1.DoSomething;
begin
  //Do Something...

end;

end.

您可能犯的一个错误是,您添加到表单单位的原始代码在表单中示例控制台应用程序的代码,与VCL Forms应用程序不同。控制台应用程序主要基于命令提示符,这在演示示例代码时似乎很常见。但是,永远不要将这种代码样式与任何其他标准单元样式混合使用。

One mistake you probably made was that the original code that you added to your form's unit was in the form of a sample console application, which is different from a VCL Forms Application. A Console Application is primarily based from a command prompt, which seems to be very common for demonstrating sample code. However, you should never mix up that code style with that of any other standard unit style.

这篇关于Delphi没有显示对象/组件的“提示”。当我睡觉时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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