By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,495 Members | 1,225 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,495 IT Pros & Developers. It's quick & easy.

Active Control trigger

P: n/a
On one of my forms I display a histogram representing the status
of jobs in our factory. It's configured as a stacked bar which I
create using labels of different background colors. 75 labels are
arranged in, up to, 15 vertical bars representing different customers.
When the user clicks on one of the labels I display a list box with
details about the data in the bar.

I only want to know which stack and which bar was clicked so I can
display the related data. It is easy enough to create 75 event
handlers to deal with each possible click but I would hope that there
is a more elegant way to handle this. I wanted to use Active Control
to get the name of the Label that was clicked but Active Control is a
Property and not an event. So I need an event that sends me to the
function that will use Active Control to determine the name of the
clicked label and send me to the function that explodes the data.
Thanks,
Hank Reed

Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hank wrote:
On one of my forms I display a histogram representing the status
of jobs in our factory. It's configured as a stacked bar which I
create using labels of different background colors. 75 labels are
arranged in, up to, 15 vertical bars representing different customers.
When the user clicks on one of the labels I display a list box with
details about the data in the bar.

I only want to know which stack and which bar was clicked so I
can display the related data. It is easy enough to create 75 event
handlers to deal with each possible click but I would hope that there
is a more elegant way to handle this. I wanted to use Active Control
to get the name of the Label that was clicked but Active Control is a
Property and not an event. So I need an event that sends me to the
function that will use Active Control to determine the name of the
clicked label and send me to the function that explodes the data.
Thanks,
Hank Reed


Use TextBoxes instead of Labels because Labels cannot receive focus. With a
TextBox you could use Me.ActiveControl or Screen.ActiveControl.
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 13 '05 #2

P: n/a
Or if you wanted to keep labels so that the controls can't be clicked into
and receive the focus (giving the game away of how you achieved your look)
then you could write one function with an argument that determines the bar
that clicked it.
e.g. fActionBar(intBar as integer) and call that directly in the click
event.
i.e. =fActionBar(1), =fActionBar(2) etc etc

(If altering the passed integer for each of the 75 labels seems daunting
then you could write some code to loop through them and enter the function
accordingly - this would require your labels to have a consistent naming
convention of course - but in a situation as you describe I'd imagine you'd
have to do that anyway).

hth
--
---------------------------------------------------------------
Mr Leigh Purvis - Proprietor
Database Development
---------------------------------------------------------------
Email: Le***@DatabaseDevelopment.co.uk
Web: www.DatabaseDevelopment.co.uk
Mobile: 07713 166938
---------------------------------------------------------------
"Hank" <ha********@aol.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
On one of my forms I display a histogram representing the status
of jobs in our factory. It's configured as a stacked bar which I
create using labels of different background colors. 75 labels are
arranged in, up to, 15 vertical bars representing different customers.
When the user clicks on one of the labels I display a list box with
details about the data in the bar.

I only want to know which stack and which bar was clicked so I can
display the related data. It is easy enough to create 75 event
handlers to deal with each possible click but I would hope that there
is a more elegant way to handle this. I wanted to use Active Control
to get the name of the Label that was clicked but Active Control is a
Property and not an event. So I need an event that sends me to the
function that will use Active Control to determine the name of the
clicked label and send me to the function that explodes the data.
Thanks,
Hank Reed

Nov 13 '05 #3

P: n/a
Thanks to Rick and Leigh for their input. I changed the labels to
text boxes. Then I wrote a function that:
1. Determines the active control
2. Parses out the unique part of the control name (No problem Leigh)
3. Calls the function that displays the requested data

I put that Function name in the Click Event field of each text box
(Instead of [Event Procedure]) and now any click on any histogram bar
follows the above path and displays my data. If anyone wants to see
the code, just ask.

Thanks again,
Hank Reed

Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.