Results 1 to 12 of 12

Thread: [Solved] Objects on Click..

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2018
    Posts
    23

    Question [Solved] Objects on Click..

    Hello Everyone
    look, for example I have 2 command buttons and a textbox, I want to make the Text property of Textbox is the NAME OF THE CONTROL TOOL where mouse pointer is on it. for example mouse pointer is above Command1, the Text property of Text1 will be"Command1"

    Thanks for all who helped me and who tried to help
    Last edited by Eng27; Feb 4th, 2018 at 02:53 PM. Reason: Type mistake..
    Eng.27

  2. #2
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,145

    Re: [Vb6] Objects on Click..

    You wanna be a bit more specific as to WHY you want this?

    If, for example, you have this:

    Code:
    Private Sub Command1_Click()
        MsgBox Command1.Name
    End Sub
    It returns, OF COURSE, "Command1"

    Same with a TextBox (don't know what a textbook is other than what I used in college decades (many) ago.)

    If you have an ARRAY of command buttons or textboxes, and you want to know which one was clicked, you'd refer to its index as well as its name.

    So, what are you really looking for, and why?

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jan 2018
    Posts
    23

    Re: [Vb6] Objects on Click..

    Sorrry it is TextBox (but the keyboard has changed the word to textbook)
    I am not looking for know things I know already, I will explain :
    I have 3 Objects: Command, TextBox and Slider for example. I want to know what user clicks, in other words, I need to get the name of the object which the user click.... Do you know how?
    Eng.27

  4. #4
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,145

    Re: [Vb6] Objects on Click..

    What are the names of each of your three objects?

  5. #5
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,145

    Re: [Vb6] Objects on Click..

    How do you want to 'save' the information (the controls' names)? Why? Is this a homework assignment?

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Jan 2018
    Posts
    23

    Re: [Vb6] Objects on Click..

    Quote Originally Posted by SamOscarBrown View Post
    How do you want to 'save' the information (the controls' names)? Why? Is this a homework assignment?
    The names of them are: Command1, TextBox1, slider1 :|
    It is not homework, I want to improve my projects, I want to control everything the user do.. Can you?
    Eng.27

  7. #7
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,853

    Re: [Vb6] Objects on Click..

    Eng27,

    You're being very vague. Sam basically told you how to do it in post#2. You want to "control everything the user do"? You need to be a lot more specific than that. What do you mean "control" it? You want to prevent it from happening? Hmmm, well, I can give you a procedure to do a global keyboard and mouse lock, but I don't think that's what you mean at all.

    You must be clear with your specifications before we can help you.

    Good Luck,
    Elroy
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  8. #8

    Thread Starter
    Junior Member
    Join Date
    Jan 2018
    Posts
    23

    Re: [Vb6] Objects on Click..

    Quote Originally Posted by Elroy View Post
    Eng27,

    You're being very vague. Sam basically told you how to do it in post#2. You want to "control everything the user do"? You need to be a lot more specific than that. What do you mean "control" it? You want to prevent it from happening? Hmmm, well, I can give you a procedure to do a global keyboard and mouse lock, but I don't think that's what you mean at all.

    You must be clear with your specifications before we can help you.

    Good Luck,
    Elroy
    oh, I am not good in English so that I always fail in explaining
    anyhow
    I will explain again and change the example
    (if I fail again in explaining what I need just don't reply )
    look, for example I have 2 command buttons and a textbox
    I want to make the Text property of Textbox is the NAME OF THE CONTROL TOOL where mouse pointer is on it.
    for example mouse pointer is above Command1, the Text property of Text1 will be "Command1"
    get it?!
    Eng.27

  9. #9
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,853

    Re: [Vb6] Objects on Click..

    Hmm, it sounds a bit like you want the SPY project that's been floating around for years. I've heavily modified mine, and I'm not sure where to get a copy of the original, but I've attached a copy of the one I use.

    You can certainly use that program to get the control name of anything you're hovering over.

    Good Luck,
    Elroy
    Attached Files Attached Files
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  10. #10
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,997

    Re: [Vb6] Objects on Click..

    Quote Originally Posted by Eng27 View Post
    oh, I am not good in English so that I always fail in explaining
    anyhow
    I will explain again and change the example
    (if I fail again in explaining what I need just don't reply )
    look, for example I have 2 command buttons and a textbox
    I want to make the Text property of Textbox is the NAME OF THE CONTROL TOOL where mouse pointer is on it.
    for example mouse pointer is above Command1, the Text property of Text1 will be "Command1"
    get it?!
    That's different from your original requirement, but it's easier.
    Nevertheless, it uses some API's.
    See the project attached.
    Attached Files Attached Files

  11. #11

    Thread Starter
    Junior Member
    Join Date
    Jan 2018
    Posts
    23

    Re: [Vb6] Objects on Click..

    Quote Originally Posted by Elroy View Post
    Hmm, it sounds a bit like you want the SPY project that's been floating around for years. I've heavily modified mine, and I'm not sure where to get a copy of the original, but I've attached a copy of the one I use.

    You can certainly use that program to get the control name of anything you're hovering over.

    Good Luck,
    Elroy
    Tnx a lot Elroy
    Eng.27

  12. #12

    Thread Starter
    Junior Member
    Join Date
    Jan 2018
    Posts
    23

    Re: [Vb6] Objects on Click..

    Quote Originally Posted by Eduardo- View Post
    That's different from your original requirement, but it's easier.
    Nevertheless, it uses some API's.
    See the project attached.
    Oh sorry about my bad explaining
    and thank you for the file, it will be very useful
    Eng.27

Tags for this Thread

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