Megalog 378
Recognized Expert Contributor
Hey guys, my turn to ask a question =D
Ok here's my situation.. I have a super simple form, which is bound to a table with a single record. All the controls (mostly text boxes, some true/false checkboxes and combos) are bound straight to each field.
Now, in the table itself, each field has it's Description property filled out, instructing the user as to what data belongs in the field. I can pull this data on the form by using each control's .StatusBarText property. What I'd like to do is have a label in the form header, that updates OnEnter in each control, showing the user the full description of the currently selected control. (It does display in the statusbar on the bottom, but it gets cut off usually.)
I -dont- want to plug in the code in each control's Enter/Leave/GotFocus, etc events. I want to auto-populate these on Form Load, or, maybe catch some other type of event when I switch focus between controls and then pass this to a generic function.
If this can be done on form load, I imagine I'd start with something like the following: - Private Sub SetControlEvents()
-
Dim i As Integer
-
-
For i = 0 To Controls.count - 1
-
If Controls(i).ControlType = acTextBox Or Controls(i).ControlType = acComboBox Then
-
'set event for control
-
End If
-
Next
-
-
End Sub
So, can dynamically written events be done like this? I understand I can use a single function to pass the name of the control, etc.. But this is being set up so that an end user can go into the table, enter new fields, type a description, and simply drop the new control onto the form and it'll work without having to enter in any events for it.
6 3072
Since it's a simple form as you say, why not just use the on timer event and check to see which control has the focus. If the focus has changed then change the label text. Something like this - Option Compare Database
-
Public strPreviousField As String
-
-
Private Sub Form_Timer()
-
If strPreviousField = Me.ActiveControl.Name Then
-
Exit Sub
-
End If
-
strPreviousField = Me.ActiveControl.Name
-
Me.Label1.Caption = Me.ActiveControl.StatusBarText
-
End Sub
FishVal 2,653
Recognized Expert Specialist
Hi, Megalog.
I had a same problem when was coding an interface feature based on mouse move over a certain control. The problem was the following - since form was overcrowded with controls, handling Detail_MouseMov e event was not reliable to detect when mouse pointer leaves control. So I've written a class (similar to that in this thread) that "merges" events from all form components.
See the attached demo.
Regards,
Fish.
P.S. Hmm. Unfortunately it seems impossible to attach anything so far. If you are interested to see the code, then PM me your mail.
NeoPa 32,564
Recognized Expert Moderator MVP
How about using the form's BeforeScreenTip event procedure.
If I understand your requirements correctly, you can check within the procedure that the ToolTip is one you're interested in (SourceObject Object) and, if it is, simply set the .Caption property of the label control to the value of the ScreenTipText object.
Megalog 378
Recognized Expert Contributor
Thanks guys
I ended up using a timer, which I normally avoid, since I couldnt find a form event that would work.
Neo, I couldnt get the BeforeScreenTip event to trigger.. I'm not sure what I was doing wrong, I'll try to revisit that event when I get more time. Never knew it existed before. =)
NeoPa 32,564
Recognized Expert Moderator MVP
Did you have a ControlTip Text value set for the control you were testing on?
NeoPa 32,564
Recognized Expert Moderator MVP
My bad.
I did some testing and some further research and found that it's only valid for PivotTables & PivotCharts :(
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Manlio Perillo |
last post by:
Hi.
This post follows "does python have useless destructors".
I'm not an expert, so I hope what I will write is meaningfull and
clear.
Actually in Python there is no possibility to write code that follows
C++ RAII pattern.
Of course Python objects are not statics like in C++, but in C++ the
auto_ptr class is used for enforcing this...
|
by: Glabbeek |
last post by:
I'm changing the layout of my site. Instead of using tables, I will use
DIVs. It's working fine, except for 1 thing: In IE6 some DIVs are not
the correct width. Mozilla and Opera are showing the page the way I
want. Does anybody know a solution for this?
First of all, the code I am using:
CSS
-------
body {
|
by: Robert Downes |
last post by:
I'm using the following in a page that I'm testing in Mozilla:
p.actionLinkBlock {border: 1px #000000 dashed; padding: 0.2cm; width: auto}
But the dashed border is extending to the right-edge of the screen. I
want it to only extend as far as it needs to to nicely contain the
content within (a couple of links).
Is width: auto the wrong...
|
by: Alan Mackenzie |
last post by:
To all those who use (X)Emacs's CC Mode to edit C, C++, Java,
Objective-C, Pike, AWK or IDL:
To help direct the development of CC Mode, it would be useful to find out
how people use the auto-newline "minor mode" facility. If you could
spare a little time, would you answer these questions, please:
o Do you program with auto-newline...
|
by: Vijay Kumar R. Zanvar |
last post by:
Hello,
Unlike register, auto keyword can not be used to
declare formal parameter(s). Is there any specific
reason for this?
Kind regards,
Vijay Kumar R. Zanvar
| |
by: maya |
last post by:
at work they decided to center divs thus:
body {text-align:center}
#content {width: 612px; text-align:left; margin: 0 auto 0 auto; }
this works fine in IE & FF, EXCEPT in FF it doesn't work if I change
'auto' to 0 for left and right margin values; I have to leave those at
'auto'.. so I would like to know what exactly means 'auto' -- what...
|
by: nospam_news |
last post by:
I currently get asked about my usage of "auto". What is it for?
The keyword is clearly superflous here.
In contrast to the huge majority of C/C++ developers I write
definitions very explicitly like that:
int main(char argc, char *argv, char *env) {
try {
auto Exception mainException(1);
mainException.setErrNo(42);
|
by: Piotr K |
last post by:
Hi,
I've encountered a strange problem with Firefox which I don't have any
idea how to resolve. To the point: I've <divelement with a style
"height: auto" and I want to retrieve this value ("auto") in
JavaScript - however instead of getting "auto" value, I get calculated
height. In IE and Opera it simply returns "auto".
Any ideas how to...
|
by: neridaj |
last post by:
Hello,
I've found a few postings of this problem but none of the answers seem to fix my problem. I have a content div wrapped around a left floated image and a right floated table. I want the table to dictate the height to the content div instead of popping out of the bottom of the content div. Seems pretty simple but too complicated for me I...
|
by: JOYCE |
last post by:
Look the subject,that's my problem!
I hope someone can help me, thanks
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
| |
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...
|
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
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...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
| |
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |