473,785 Members | 2,349 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

detecting when focus leaves a form

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 "applicatio n 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
Dec 21 '05 #1
1 1689
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 "applicatio n 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
Dec 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2734
by: Erik Bethke | last post by:
Hello All, I am trying to clean up some polish bugs with the Shanghai game I am working on and I am currently stuck on trying to get the right event for detecting when the user has changed the desktop resolution. I have tried trapping the following events: 1) SDL_ACTIVEEVENT 2) SDL_VIDEOEXPOSE
1
10165
by: Rod Early | last post by:
I need to know when the select element's dropdown list is opened (as when the user clicks on the arrow or does ALT-downarrow from the keyboard). Similarly, I need to known when the dropdown list closes. The closing of the dropdown list can happen without changing the dropdown, hence the onchange event is not a sure way to determine that the dropdown list closed. Is this possible in Internet Explorer?
2
4965
by: Dom Nicholas | last post by:
Hi, My question is this : how do I detect from another window which didn't create a new window whether it exists ? For example, is there a window-id's container of some sort that hangs around that I can interrogate ? I would like to find a better way of doing the following. I have a window (call it Win) that creates a new window (call it Win2) using window.open().
9
35616
by: Fabian | last post by:
Is there a way to detect which object currently has the focus in javascript? "this" comes close, but isnt implemented in netscape. -- -- Fabian Visit my website often and for long periods! http://www.lajzar.co.uk
5
1837
by: needin4mation | last post by:
Hi, I have an asp.net 1.1 application that populates data from a database. When the user changes data, they have to hit a button to update the data. The data entry form (same form that is populated) is from several different tables. To the user, of course, this is not seen. Scenario: After the page is populated, assume a change is made to the form and the user hits update. The page then goes back, reads the database for that record...
1
2822
by: Oenone | last post by:
We have a little piece of JavaScript in one of our client's application which automatically sets the input focus to the first control on the HTML form. This works very nicely, except for in one circumstance. If the user is partway through entering data into the form, clicks a hyperlink to go to another page, and then clicks the Back button to return to the edit page, the focus is again reset to the first field on the page. Under this...
3
6140
by: Greg | last post by:
The LostFocus event of datagrids is fired when the focus is added to a cell. How do you go about detecting it when the control as a whole has lost focus to another control? Slightly confused by this! Greg.
3
4961
by: Keith Wilby | last post by:
I have a form with 4 subforms on a tab control. How can I detect which sub/tab has the focus from the main form? Many thanks. Keith.
2
4807
by: bobh | last post by:
Hi All, In AccessXP I have a form, it has a form header, detail and footer sections. When done entering text in a txtbox(bxReqst) in the footer the user wants to press the Tab key and have the focus move to a control called bxQues in the Detail section. From the control in the footer how do I detect when a Tab key is pressed and set the focus to the control(bxQues) in the detail section? thanks bobh.
0
9483
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10346
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10157
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8982
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7504
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6742
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5514
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4055
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3658
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.