omsec
asked on
Active Form
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
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
omsec
you can use this code snippet...
procedure TForm1.FormMouseMove(Sende r: 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
you can use this code snippet...
procedure TForm1.FormMouseMove(Sende
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
ASKER
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 :)
--------
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 :)
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
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
ASKER
YAY this is exactly what i was lookin for. d_kiernan, you may get the points, send it again as answer
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
yeah, for all those, who will read this question later from the archieve, the answer is quite simple :
Form2.ShowModal;
:)
Form2.ShowModal;
:)
ASKER
yeah, for all those, who will read this question later from the archieve, the answer is quite simple :
Form2.ShowModal;
:)
Form2.ShowModal;
:)
Please give some sample of the code you are using to display the form.
regards
Donagh