Active Control trigger

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Hank

    #1

    Active Control trigger

    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

  • Rick Brandt

    #2
    Re: Active Control trigger

    Hank wrote:[color=blue]
    > 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[/color]

    Use TextBoxes instead of Labels because Labels cannot receive focus. With a
    TextBox you could use Me.ActiveContro l or Screen.ActiveCo ntrol.


    --
    I don't check the Email account attached
    to this message. Send instead to...
    RBrandt at Hunter dot com


    Comment

    • Leigh P

      #3
      Re: Active Control trigger

      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(intB ar 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: Leigh@DatabaseD evelopment.co.u k
      Web: www.DatabaseDevelopment.co.uk
      Mobile: 07713 166938
      ---------------------------------------------------------------
      "Hank" <hankrunner@aol .com> wrote in message
      news:1113996876 .091757.72650@z 14g2000cwz.goog legroups.com...[color=blue]
      > 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
      >[/color]


      Comment

      • Hank

        #4
        Re: Active Control trigger

        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

        Comment

        Working...