473,808 Members | 2,885 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Identifying what was clicked

Hey again -

I have a bunch of similar controls on a form (A2000), and I'm calling the
same code (with an argument as to what was clicked) when any one of them is
clicked. I'd like to generalize the code without having to modify EACH one
with a self-specific parameter in the call. That is, instead of calling...

called_when_cli cked ("A1")

I just want to run:

called_when_cli cked (my own control name)

....without the parentheses of course. Then I could use the same exact line
of code for all the controls, and decide what to do in the called routine
(table lookups built from the control name). I have tried using
ActiveControl, but since the controls themselves are on a tab page, all I
get is the name of the tab control. And of course, "Me" refers to the form
they're all on. Is there an equivalent for the control itself?

(What I'd REALLY like would be a way to use an object-oriented approach, and
have the CLASS of control defined to make this call automagically, without
having to create a separate event procedure for every one...)

Armando
Nov 13 '05 #1
4 4763
Armando wrote:
Hey again -

I have a bunch of similar controls on a form (A2000), and I'm calling the
same code (with an argument as to what was clicked) when any one of them is
clicked. I'd like to generalize the code without having to modify EACH one
with a self-specific parameter in the call. That is, instead of calling...

called_when_cli cked ("A1")

I just want to run:

called_when_cli cked (my own control name)

...without the parentheses of course. Then I could use the same exact line
of code for all the controls, and decide what to do in the called routine
(table lookups built from the control name). I have tried using
ActiveControl, but since the controls themselves are on a tab page, all I
get is the name of the tab control. And of course, "Me" refers to the form
they're all on. Is there an equivalent for the control itself?

(What I'd REALLY like would be a way to use an object-oriented approach, and
have the CLASS of control defined to make this call automagically, without
having to create a separate event procedure for every one...)

Armando

Check out the ActiveControl property in help. See also ActiveForm property.

Nov 13 '05 #2

"Salad" <oi*@vinegar.co m> wrote in message
news:Sv******** ********@newsre ad2.news.pas.ea rthlink.net...
Armando wrote:
Hey again -

I have a bunch of similar controls on a form (A2000), and I'm calling the same code (with an argument as to what was clicked) when any one of them is clicked. I'd like to generalize the code without having to modify EACH one with a self-specific parameter in the call. That is, instead of calling...
called_when_cli cked ("A1")

I just want to run:

called_when_cli cked (my own control name)

...without the parentheses of course. Then I could use the same exact line of code for all the controls, and decide what to do in the called routine (table lookups built from the control name). I have tried using
ActiveControl, but since the controls themselves are on a tab page, all I get is the name of the tab control. And of course, "Me" refers to the form they're all on. Is there an equivalent for the control itself?

(What I'd REALLY like would be a way to use an object-oriented approach, and have the CLASS of control defined to make this call automagically, without having to create a separate event procedure for every one...)

Armando

Check out the ActiveControl property in help. See also ActiveForm

property.


I always list the things I've tried before asking the group to help. That
way we save posts to read through, and makes it clear that I'm not out for a
free answer, but actually expended some effort first. It's my way of
showing appreciation for the help, beforehand.

Anyway, I did try ActiveControl - and I get the name of the Tab control. I
can't see into it any deeper, unless there's another command.
Nov 13 '05 #3
Armando wrote:
"Salad" <oi*@vinegar.co m> wrote in message
news:Sv******** ********@newsre ad2.news.pas.ea rthlink.net...
Armando wrote:

Hey again -

I have a bunch of similar controls on a form (A2000), and I'm calling
the
same code (with an argument as to what was clicked) when any one of them
is
clicked. I'd like to generalize the code without having to modify EACH
one
with a self-specific parameter in the call. That is, instead of
calling...
called_when_ clicked ("A1")

I just want to run:

called_when_ clicked (my own control name)

...without the parentheses of course. Then I could use the same exact
line
of code for all the controls, and decide what to do in the called
routine
(table lookups built from the control name). I have tried using
ActiveContro l, but since the controls themselves are on a tab page, all
I
get is the name of the tab control. And of course, "Me" refers to the
form
they're all on. Is there an equivalent for the control itself?

(What I'd REALLY like would be a way to use an object-oriented approach,
and
have the CLASS of control defined to make this call automagically,
without
having to create a separate event procedure for every one...)

Armando


Check out the ActiveControl property in help. See also ActiveForm


property.
I always list the things I've tried before asking the group to help. That
way we save posts to read through, and makes it clear that I'm not out for a
free answer, but actually expended some effort first. It's my way of
showing appreciation for the help, beforehand.

Anyway, I did try ActiveControl - and I get the name of the Tab control. I
can't see into it any deeper, unless there's another command.

I have a table, Table1 with the fields Test1 and Test2. I created a
form and dropped a tab control onto it and then dropped Test1 and Test2
onto the Tab1.

Here is my code for Test1
Private Sub Test1_GotFocus( )
MsgBox "Focus " & Screen.ActiveCo ntrol.Name
End Sub

Private Sub Test1_Click()
MsgBox "Clicked " & Screen.ActiveCo ntrol.Name
End Sub

Private Sub TabCtl0_Click()
MsgBox "Tab " & Screen.ActiveCo ntrol.Name
End Sub

WHen I run it, the message box say Test1 as I expected. I can set focus
to or click in Test1 and I get a message. I can click into Test2 and
click the tab control and Access echoes Test2. So...I'm sorry I can't
help you out with your problem. You might want to run a test like mine,
see if you get the same results.
Nov 13 '05 #4

"Salad" <oi*@vinegar.co m> wrote in message
news:G6******** **********@news read1.news.pas. earthlink.net.. .
...
...
WHen I run it, the message box say Test1 as I expected. I can set focus
to or click in Test1 and I get a message. I can click into Test2 and
click the tab control and Access echoes Test2. So...I'm sorry I can't
help you out with your problem. You might want to run a test like mine,
see if you get the same results.


Thanks for the second reply - I'll play with it some more.

Armando
Nov 13 '05 #5

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

Similar topics

5
4695
by: Mark | last post by:
I have an application that uses PHP to access a MySQL table and extract rows which match the user's search entry. Data from the matching rows are loaded into an HTML selection list, and the user can scan the list and highlight a selected item. My question: In PHP, what is the syntax for identifying which row is highlighted? My goal is to pass the unique row ID of the selected item to a subsequent form where all the fields will be...
1
6165
by: David | last post by:
I know that identifying the user IP address with HTTP_SERVER_VARS; is reliant on the browser agent but I have stumpled upon the following code which I have tried to understand but failed! // // Obtain and encode users IP //
1
5187
by: hokiegal99 | last post by:
This is not really a Python-centric question, however, I am using Python to solve this problem (as of now) so I thought it appropiate to pose the question here. I have some functions that search for files that contain certian strings and if the files found to have these string do not already have a filename extension (such as '.doc' or '.xls') the function will append that to the files and rename them. So, if a file named 'report' was...
1
2764
by: monika | last post by:
I move from one form to another when I click to a radio button. I can identify which radio button I clicked by trapping its value. but my problem is that there are a set of radio buttons followed by values being displayed from a join table. I want to know the values displayed from the table. so that based on which I can do my further processing. Like the radio button is showing the name of student, his id, story id...and 2-3 more things....
0
1547
by: Joshua Beall | last post by:
Hi All, I've been taking a look at DB Designer 4, and looking through the documentation (http://www.fabforce.net/dbdesigner4/doc/index.html) I am a little unclear on some of their nomenclature: '1:1' - Ok, one to one. Got it. '1:1 generalization' - Don't know this. Obviously different somehow from one to one, but how? '1:n' - One to many, I assume.
1
1301
by: Adelio Stevanato | last post by:
I am an experienced VB 3-6 developer moving to .NET. In VB 6 i could go through the form controls collection , find all the menu items and using security information set- up I could enable/dissable menu items based on their name. DOT NOT has appeared to complicate this no end. 1. menuitem & toolbatbutton controls do not expose a name. 2. context menus are Container.Components
3
2134
by: Christopher Weaver | last post by:
I want to set a value in a specific field in the current row of a DataSet. This seems like the most basic thing to do but I can't find the syntax for identifying the current row. IOW, I can do this: SomeRow = 'value'; But how do I set SomeRow to the row that the user is currently viewing?
10
4518
by: Frankie | last post by:
It appears that System.Random would provide an acceptable means through which to generate a unique value used to identify multiple/concurrent asynchronous tasks. The usage of the value under consideration here is that it is supplied to the AsyncOperationManager.CreateOperation(userSuppliedState) method... with userSuppliedState being, more or less, a taskId. In this case, the userSuppliedState {really taskId} is of the object type,...
3
2333
by: Michael Powe | last post by:
Hello, Here is my problem: I have a site that uses urls of this format to submit forms: <a id="1_1_2_0" href="Javascript:if(validate)submitForm(...)">Submit</a> I'm just a third-party programmer, I have no control over this
0
9721
marktang
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9600
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
10374
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...
1
10374
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
10114
tracyyun
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9196
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...
0
6880
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();...
1
4331
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
3
3011
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.