473,379 Members | 1,235 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Trust the Activate and Deactivate events????

I remember when I checked NewGroups for comments about the VB6 Activate
event and found that many thought it was not a reliable way to keep track of
which form has focus. There was enough bad press that I avoided it.

I now have a project with MDI child forms and non-MDI child forms coming and
going as the user selects different options. I need to know which form is
the active one and thought that I could use the Activate and Deactivate
events to maintain a global variable that could be checked as needed.

Before I put forth the effort I thought I'd check to see if anyone had
experience using those events and/or had any helpful suggestions.
Cal
Nov 20 '05 #1
3 3463
Hello, active:

The Activate event occurs before the former object has lost the focus.
You can understand how and when a control gets and losts the focus in the Enter event topic:
http://msdn.microsoft.com/library/de...entertopic.asp.

Although its not perfectly explained, I think. I understand it means:
(NewControl is the control that receives the focus, OldControl is the one that looses it)
<PASTE>
When you change the focus by using the keyboard (TAB, SHIFT+TAB, and so on), by calling the Select or SelectNextControl methods, or by setting the ContainerControl.ActiveControl property to the current form, focus events occur in the following order:

1.. NewControl.Enter or Activated
2.. NewControl.GotFocus
3.. OldControl.Leave or Deactivate
4.. OldControl.Validating
5.. OldControl.Validated
6.. OldControl.LostFocus
When you change the focus by using the mouse or by calling the Focus method, focus events occur in the following order:

1.. NewControl.Enter or Activated
2.. NewControl.GotFocus
3.. OldControl.LostFocus
4.. OldControl.Leave or Deactivate
5.. OldControl.Validating
6.. OldControl.Validated
If the CausesValidation property is set to false for OldControl, the Validating and Validated events are suppressed.

</PASTE>
Regards.
" active" <ac****@REMOVEa-znet.com> escribió en el mensaje news:%2****************@tk2msftngp13.phx.gbl...
| I remember when I checked NewGroups for comments about the VB6 Activate
| event and found that many thought it was not a reliable way to keep track of
| which form has focus. There was enough bad press that I avoided it.
|
| I now have a project with MDI child forms and non-MDI child forms coming and
| going as the user selects different options. I need to know which form is
| the active one and thought that I could use the Activate and Deactivate
| events to maintain a global variable that could be checked as needed.
|
| Before I put forth the effort I thought I'd check to see if anyone had
| experience using those events and/or had any helpful suggestions.
|
|
| Cal
|
|
Nov 20 '05 #2
Thanks

Cal

"José Manuel Agüero" <jmaguero_vodafone.es> wrote in message
news:e0**************@TK2MSFTNGP12.phx.gbl...
Hello, active:

The Activate event occurs before the former object has lost the focus.
You can understand how and when a control gets and losts the focus in the
Enter event topic:
http://msdn.microsoft.com/library/de...entertopic.asp.

Although its not perfectly explained, I think. I understand it means:
(NewControl is the control that receives the focus, OldControl is the one
that looses it)
<PASTE>
When you change the focus by using the keyboard (TAB, SHIFT+TAB, and so on),
by calling the Select or SelectNextControl methods, or by setting the
ContainerControl.ActiveControl property to the current form, focus events
occur in the following order:

1.. NewControl.Enter or Activated
2.. NewControl.GotFocus
3.. OldControl.Leave or Deactivate
4.. OldControl.Validating
5.. OldControl.Validated
6.. OldControl.LostFocus
When you change the focus by using the mouse or by calling the Focus method,
focus events occur in the following order:

1.. NewControl.Enter or Activated
2.. NewControl.GotFocus
3.. OldControl.LostFocus
4.. OldControl.Leave or Deactivate
5.. OldControl.Validating
6.. OldControl.Validated
If the CausesValidation property is set to false for OldControl, the
Validating and Validated events are suppressed.

</PASTE>
Regards.
" active" <ac****@REMOVEa-znet.com> escribió en el mensaje
news:%2****************@tk2msftngp13.phx.gbl...
| I remember when I checked NewGroups for comments about the VB6 Activate
| event and found that many thought it was not a reliable way to keep track
of
| which form has focus. There was enough bad press that I avoided it.
|
| I now have a project with MDI child forms and non-MDI child forms coming
and
| going as the user selects different options. I need to know which form is
| the active one and thought that I could use the Activate and Deactivate
| events to maintain a global variable that could be checked as needed.
|
| Before I put forth the effort I thought I'd check to see if anyone had
| experience using those events and/or had any helpful suggestions.
|
|
| Cal
|
|
Nov 20 '05 #3
That's good to know. I probable would have set a variable to Nothing in
Deactivate and to the form in Activate, but I can see now I better do
nothing in Deactivate or check to make sure the variable is referencing the
form deactivating before I set it to Nothing.

The Activate event occurs before the former object has lost the focus.
You can understand how and when a control gets and losts the focus in the

Enter event >topic:
Nov 20 '05 #4

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

Similar topics

2
by: Michel | last post by:
I like to show a inbetween selfmade menu when rightclicking the page. So on the first line I want to add "Default right-click menu". So first I need to capture it, then I need to stop the...
1
by: Daniel Chou | last post by:
Hello, I have two questions about "not logged initially": 1. Before using "alter table tbname activate not logged initially", should the table be created with "not logged initially"? 2....
1
by: June Homer | last post by:
I have a form which has its activate event set to maximise the form. This used to work but no long does. I have put a breakpoint in the Activate event and it is never trapped. The form is opened...
5
by: Jonas | last post by:
Can you activate and deactivate the Windows Toolbar function "QuickLaunch" programatically?
0
by: henrycortezwu | last post by:
Hi, I would like to inquire on how to make an event that will simulate the browser loosing focus, or the browser deactivate or inactive state event. Like in Windows Form, there are several events...
2
by: dominic.martin | last post by:
Hi, I'm no javascript programmer but I found a really good piece of javascript at http://www.isdntek.com/tagbot/zipzoom.htm that magnifies areas of an image. It's just what I want but their...
0
by: ofzer | last post by:
Hi .. I wrote a windows application in perl/tk. I would like to deactivate parent windows when I open new one. for example : lets say I am in the main window now and I press on the...
2
by: CGatto | last post by:
Hi, I have Windows Form with several User Controls embedded within. Only one user control is visible at any one time. The user moves through the various user controls by clicking Previous and...
7
by: Andrus | last post by:
I have UserControls in MDI child forms containing TextBoxes and other controls. When user re-activates form, I need that Control which was last activated is activated again. Currently *first*...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.