Home > Back-end >  Delphi hotkey tip can't find the form
Delphi hotkey tip can't find the form

Time:09-24

This matter is,
I is more form interface, use the DLL + exe design, found that use hotkeys can tip can't find the form now, consult everybody a great god what to do, what method???????
Thought for a night,,, if it is to the current form of setfoucs or? The great god, do you think?

CodePudding user response:

Kneeling,

CodePudding user response:

 unit Unit1; 

Interface

USES the
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

Type
TForm1=class (TForm)
Btn1: TButton;
Btn2: TButton;
Procedure btn1Click (Sender: TObject);
Private
{Private declarations}
Public
{Public declarations}
end;

Var
Form1: TForm1;

Implementation

{$R *. DFM}

Procedure TForm1. Btn1Click (Sender: TObject);
The begin
Btn2. SetFocus;
end;

End.



The above code btn2 Enabled:=False; And then set btn2. SetFocus; Pops out that mistake

The following will not
 
Procedure TForm1. Btn1Click (Sender: TObject);
The begin
If btn2. CanFocus then
Btn2. SetFocus;
end;

Specific reasons myself feel more say you are lazy

CodePudding user response:

May be I can't express clearly,, sorry


 
Procedure Tfrm_mainform. BaseFrmEnter (mForm: TForm);
Var
Brought by: TRzTabSheet;
Index: integer;
AClass: TPersistentClass;
The begin
AClass:=GetClass (mForm. ClassName);
If aClass=nil then
The begin
Showmessage (' can't find the ClassName: '+ mForm. ClassName);
Exit;
end;
If not aClass. InheritsFrom (TForm) then
The begin
Showmessage (mForm ClassName + 'is not a window).
Exit;
end;
Brought by:=nil;
Index:=findpage (mform. Caption);
If the index=1 then
The begin
Brought by:=TRZTabSheet. Create (pagecontrol1);
Brought by the Caption:=mForm. Caption;
Brought by the PageControl:=pagecontrol1;
Pagecontrol1. ActivePage:=brought;
Mform:=TForm (aClass. NewInstance);
Mform. Create (Application);
Mform. Parent:=Self. Pagecontrol1. ActivePage;
Mform. ManualDock (brought);
Mform. Align:=alclient;
Mform. BorderStyle:=bsnone;
Mform. Show;
Mform. SetFocus;
Caption:="your current in - [' + brought. The Caption + '] '.
end;
end;


The function Tfrm_mainform. Findpage (scaption: string) : integer;
Var
I: integer;
IsExists: Boolean;
The begin
IsExists:=false;
For I:=0 to pagecontrol1. Do PageCount - 1
The begin
If pagecontrol1. Pages [I]. Caption=scaption then
The begin
Pagecontrol1. ActivePage:=pagecontrol1. Pages [I];
IsExists:=true;
Result:=I;
break;
end;
end;
If not isExists then
Result:=1;
end;


Many pages open by rz controls processing
Open in is called regular DLL call


Set hotkeys will appear after this form can not find,,,
Can't use rz controls?

Use the code to the onclick will pop up a window to,

CodePudding user response:




And many a interface, but not shown we understood as a property
  • Related