Steve,

The OnExit event is called if the control loses the focus to another control
on the same form.  The WM_KILLFOCUS message is handled by the base class and
if the above condition is met, it fires off the OnExit event.  Like all
Windows applications, you will encounter problems if you cause the focus to
change in the WM_KILLFOCUS event.

When you display the MessageDlg in the event, in effect, you cause the focus
to be changed from the radio button to the message dialog.  This is the
cause of your problem.

I suggest the following solution:

1.  In you OnExit event set a flag to indicate that you need to display a
message.

2.  Hook the OnUpdate event of an action on the form (if you don't use
actions, now is a good time to start).

3.  Check for the flag in the action and display the dialog.  Don't forget
to unset the flag.

Regards,
Dennis.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, 25 September 2001 11:10
To: Multiple recipients of list delphi
Subject: [DUG]: RadioButton requires 2 clicks


I posted this problem yesterday but got no response so I have attempted to
explain it better.

I have a D6 application.

When I move out of a TEdit by clicking on a TRadioButton or TCheckBox, the
OnExit code for the TEdit executes and the focus moves to the TRadioButton
or TCheckBox but the OnClick event for the TRadioButton or TCheckBox does
not execute - the button initially appears grayed, but reverts to the normal
colour and remains unchecked as soon as the mouse is moved. To make the
TRadioButton or TCheckBox checked you need to click it a second time - even
if you want to close the form you need to click the close button twice.

The problem only arises when the OnExit event from the TEdit displays a
MessageDlg - there is no problem if the MessageDlg does not get displayed,
so I suspect the problem lies with MessageDlg.

I have tried putting Application.ProcessMessages and forcing a click using
SendMessage in various places without success.

Anyone got any ideas on how to fix this problem?

Regards
Steve Galyer

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to