Results 1 to 3 of 3

Thread: Determing the control selected with a Popup Menu

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Posts
    13

    Question


    Here's the scoop:

    I have six controls on my form - three text boxes and
    three label boxes. I also have a menu defined and
    call it as a popup menu when the user _LEFT clicks_
    on the textboxes and _RIGHT clicks_ on the label
    boxes. It's an early lab for a client/server class.
    The problem is - when a user selects a choice on the
    popup menu, I need to know what control he/she just
    clicked on to bring up the popup menu in the first place.
    This way I will only affect the textboxes or the
    labels but not both. Since labels cannot get
    focus, the textboxes are always the "active control"
    so TypeOf(form.ActiveControl) doesn't work in my case.
    Any suggestions? I can be more specific if necessary.

    Thanks!!!!

    -K. L. Aelspear

  2. #2
    Lively Member
    Join Date
    Jul 2000
    Posts
    94
    Theres probably a better way but you could catch the click messages inside of each control, and put your menu stuff there. That way you would know where they clicked.

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Posts
    13

    Thumbs up One possible answer I found

    A co-worker and I came up with a solution and I thought I'd post it here in case anyone was interested :

    Declare a public variable to hold a string, then whenever
    the click or mouseup event fires, save the control that it fired from in that string variable. Use if...then statements to check the string and a for...each statement to find all the controls of that particular control type.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width