PC Review


Reply
Thread Tools Rate Thread

detecting when focus leaves a form

 
 
Dean Slindee
Guest
Posts: n/a
 
      21st Dec 2005
In my application there is a main form with a tabcontrol. On each page in
the tabcontrol is a panel upon which is painted a "sub" form. The main form
acts as the "application host", while the subforms are where data values
contained in underlying tables are displayed, inserted, updated or deleted.


I don't make the user press an "Edit" button to enable the textboxes on the
subforms. Rather, the subforms and their textboxes are always in edit mode.
However, the user must remember to press the Update, Insert or Delete button
to make any changes keyed into the subform affect the underlying database.


Simple enough, but not completely foolproof given inept or careless users.
Therefore, I would like to implement a reminder process using a dialog box.
So that, when the user makes a change to any "data-enabled" control
(textbox, checkbox, combobox, etc), a form-level boolean variable becomes
"dirty". This code I have written and tested ok.

My problem is in detecting when the user has decided to move off the "dirty"
form. I thought that I could detect this action in code placed in the
form_LostFocus event. Problem is, the code is in the LostFocus event, but
the event is not being fired. Is this normal? Is there another way to
detect moving off a form?

Thanks in advance,

Dean Slindee


 
Reply With Quote
 
 
 
 
Chris
Guest
Posts: n/a
 
      21st Dec 2005
Dean Slindee wrote:
> In my application there is a main form with a tabcontrol. On each page in
> the tabcontrol is a panel upon which is painted a "sub" form. The main form
> acts as the "application host", while the subforms are where data values
> contained in underlying tables are displayed, inserted, updated or deleted.
>
>
> I don't make the user press an "Edit" button to enable the textboxes on the
> subforms. Rather, the subforms and their textboxes are always in edit mode.
> However, the user must remember to press the Update, Insert or Delete button
> to make any changes keyed into the subform affect the underlying database.
>
>
> Simple enough, but not completely foolproof given inept or careless users.
> Therefore, I would like to implement a reminder process using a dialog box.
> So that, when the user makes a change to any "data-enabled" control
> (textbox, checkbox, combobox, etc), a form-level boolean variable becomes
> "dirty". This code I have written and tested ok.
>
> My problem is in detecting when the user has decided to move off the "dirty"
> form. I thought that I could detect this action in code placed in the
> form_LostFocus event. Problem is, the code is in the LostFocus event, but
> the event is not being fired. Is this normal? Is there another way to
> detect moving off a form?
>
> Thanks in advance,
>
> Dean Slindee
>
>


Do you actually have a form residing inside a panel on a tab control?
Have you tried using the Panel.LostFocus event? If it is actually a
form, look at using the Deactivate event.

How do you "paint a "sub" form"?

Chris
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Detecting and setting focus Jake Microsoft Access VBA Modules 3 20th Apr 2009 06:46 PM
User input focus detecting? Pieter Breed Microsoft Dot NET Framework Forms 3 5th Jul 2006 05:24 PM
Detecting which application currently has focus... Paul Aspinall Microsoft Dot NET Framework 1 1st Dec 2005 08:01 PM
Detecting which application currently has focus... Paul Aspinall Microsoft C# .NET 1 1st Dec 2005 08:01 PM
Detecting focus target Atlas Microsoft Access Form Coding 3 28th May 2004 10:09 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:43 AM.