473,320 Members | 2,109 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,320 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 3455
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*...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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...

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.