Display another form...

I have Form1 opened.
I would like to display (open) Form2 by
typing a sequence of letters let us say: OPEN.
Meaning,when I type OPEN form1 hides and form2 opens (Letters are not case sensitive,meaning user can
type in small or big letters).
Do not want a pop up menu but a on key down
procedure…something like that….
Just to see how it works…
EnejAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

simonetCommented:
Here you go:

type
  TForm1 = class(TForm)
    ListView1: TListView;
    TreeView1: TTreeView;
    procedure FormKeyPress(Sender: TObject; var Key: Char);
  private
        StringTyped : string;
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses Unit1;

{$R *.DFM}

procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
begin
      if not(uppercase(Key)[1] in ['O', 'P', 'E', 'N']) then
            StringTyped := ''
  else
  begin
        StringTyped := StringTyped + Key;
     if uppercase(StringTyped)='OPEN' then
     begin
               FrmColl := TFrmColl.create(application);
              FrmColl.show;
     end;
  end;
end;

Also make sure you set Form1.KeyPreview to TRUE.

Yours,

Alex
0
EnejAuthor Commented:
Not what I want!
What has :
ListView1: TListView;
TreeView1: TTreeView;
to do with calling a form...
How is Form1 supposed to know that
OPEN was typed and auto-react,showing
Form2?
Do not want (Frm2 create App) just
show it...
Anyway,I tried the sugg. (for the record)
with no result whatsoever...
0
simonetCommented:
The ListView and TreeView have nothing to do with what you want. It simply was sitting in the form I used for writing the program for you.

If you don't want Form2 (which I am calling FrmColl), simply delete the line:

FrmColl := TFrmColl.create(application);

Now, in order for it to work, you have to bind the code above to the form's OnKeyPress event (wasn't that already understood when I sent you the code?).

>How is Form1 supposed to know that
>OPEN was typed and auto-react,showing

See the code I posted. It's all there.

Alex

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

IndefreiCommented:
Alex,
enjoy it with a B
Indi
0
EnejAuthor Commented:
Indi:
"No expert-learning all my life..."
Sound familiar???
0
EnejAuthor Commented:
Upppsss....
Sorry,I messed up.The forms were the same size and changed so fast that me,
the idiot,did not see the difference.
(After night shift...hugh)
Thanx!
0
EnejAuthor Commented:
Upppsss....
Sorry,I messed up.The forms were the same size and changed so fast that me,
the idiot,did not see the difference.
(After night shift...hugh)
Thanx!
0
simonetCommented:
>enjoy it with a B

What do you mean? If you have a better solution, post it here or keep such kinda of comments for yourself.

The answer I gave was perfectly good and deserved an A.

>the idiot,did not see the difference.

I am glad we got that part cleared up.



0
EnejAuthor Commented:
Simonet:
Did anybody tell you you have an
'attitude problem" ???
0
IndefreiCommented:
Alex,
sure your answer deserves an A
but have a look at Enej's profile
this guy here belongs to, what you mentioned in your tiny, little proggy discussion.too...
You should see some of his q's and how he handles them

regards
Indi

0
simonetCommented:
>Did anybody tell you you have an
>'attitude problem" ???

No, and I don't need someone like you to tell me that. If you aren't able to understand a very simple and easy answer, don't blame it on me.

I'd rather have an attitude problem than an intelligence problem.
0
EnejAuthor Commented:
Hopeless case...
0
EnejAuthor Commented:
Indefrei:
>>sure your answer deserves an A
-By whose standard?
>>but have a look at Enej's profile
-???I am a begginner and not a shame of
it...Post a Q and give fair points for A.Something wrong?
>>this guy here belongs to...
-Who are you to tell me where I belong?
>>You should see some of his q's ...
-Not worth commenting...
You people are amazing really....
People ask questions because they want
to learn,and what we get...a guy with an
attitude problem and one with similar symptoms...

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.