Solved

Active Form

Posted on 1998-09-29
8
148 Views
Last Modified: 2010-04-06
I have a Form, which has disabled System Menu and two buttons. It is REQUIRED to click on one of these buttons to close the query. But if the User clicks outside of this form, it will vanish. So how to let the Program or Windows
beep/ding, if the User have clicked somewhere else, bot not on this form ? Comparing, it's like the DING if you click outside an Application.MessageBox for example.
thanx
0
Comment
Question by:omsec
  • 4
  • 2
  • 2
8 Comments
 

Expert Comment

by:d_kiernan
ID: 1341201
The form needs to be displayed using ShowModal. This means that this window must be clicked away before anything else in your application can continue. You will still be able to click on other applications to activate them.

Please give some sample of the code you are using to display the form.

regards
Donagh

0
 
LVL 4

Expert Comment

by:BoRiS
ID: 1341202
omsec

you can use this code snippet...


            procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
              Y: Integer);
            begin
              If GetCapture = 0 then
                SetCapture(Form1.Handle);
              if PtInRect(Rect(Form1.Left,
                               Form1.Top,
                               Form1.Left + Form1.Width,
                               Form1.Top + Form1.Height),
                               ClientToScreen(Point(x, y))) then
              Form1.Caption := 'Mouse is over form' else
              MessageBeep(word(-1));
            end;

You just need to place it on the formmousedown event, you may need to modify alittle

Later
BoRiS
0
 
LVL 2

Author Comment

by:omsec
ID: 1341203
Boris : this does not work like i need it.
--------

Perhaps i should try to explain my problem in different words:

Think, I have a main form, that is full-size-maximized. Now i used simply Form2.Show to display temporarly a Dialog-Form, which is SMALLER than the main form. This Form 2 does not have the system menu _ [ ] X. It only has two Buttons. It is required for the program that the user does a decision here. So if you click somewhere outside this Form2, on Form1, the active Form (Form2) will disappear. Many programs do also use such Queries, like my Form2, but Windows always "beeps" (or play ding.wav) by default, and Form2 STAYS still on the screen and is still active, until the user clicked on one of these two buttons.

If this, seems to be a big problem, i will increase points.

thank you, Gentlemen :)

0
Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
LVL 4

Expert Comment

by:BoRiS
ID: 1341204
omsec

It seems you need to set the form2 modal as d_kiernan mentioned...

Form2.ShowModal;

if this works then the points should be giving to d_kiernan...

Later
BoRiS

0
 
LVL 2

Author Comment

by:omsec
ID: 1341205
YAY this is exactly what i was lookin for. d_kiernan, you may get the points, send it again as answer
0
 

Accepted Solution

by:
d_kiernan earned 10 total points
ID: 1341206
POINTS FOR ME, THANK YE

The form needs to be displayed using ShowModal. This means that this window must be clicked away before anything else in your application can continue. You will still be able to click on other applications to activate them.

Please give some sample of the code you are using to display the form.

regards
Donagh
0
 
LVL 2

Author Comment

by:omsec
ID: 1341207
yeah, for all those, who will read this question later from the archieve, the answer is quite simple :

Form2.ShowModal;

:)
0
 
LVL 2

Author Comment

by:omsec
ID: 1341208
yeah, for all those, who will read this question later from the archieve, the answer is quite simple :

Form2.ShowModal;

:)
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question