Results 1 to 20 of 20

Thread: MouseUp event signature

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2001
    Location
    USA
    Posts
    1,026

    MouseUp event signature

    Ok... The following won't work because it says that the arguments I added are not in the "signature" of the .MouseUp event...

    VB Code:
    1. Private Sub lstItems_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs, [b]ByVal f As System.Windows.Forms.KeyEventArgs[/b]) Handles lstItems.MouseUp

    I added the bolded part...

    Where can I go or what can I do to override this signature? Is it possible?

    Thanks,

    Squirrelly1
    Now happily married and still crankin' away at the keyboard. Life is grand for a coder, no?

  2. #2
    Hyperactive Member
    Join Date
    Mar 2004
    Location
    Prato - Tuscany - Italy
    Posts
    461
    I'm not an expert, but signature need the due respect, I know.
    It seems you are trying to mix a mouse event with KeyUp or KeyDown event.....what are you trying to do?
    Try to explain me your problem and <<< PERHAPS >>> I'll be able to help you. Ah.....don't use strange words, my english is weak!
    Live long and prosper (Mr. Spock)

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2001
    Location
    USA
    Posts
    1,026
    It is explained here...

    http://www.vbforums.com/showthread.p...85#post1722985

    Thanks,

    squirrelly1
    Now happily married and still crankin' away at the keyboard. Life is grand for a coder, no?

  4. #4
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949

    Re: MouseUp event signature

    Originally posted by squirrelly1
    VB Code:
    1. Private Sub lstItems_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs, [b]ByVal f As System.Windows.Forms.KeyEventArgs<b>Ok...  The following won't work because it says that the arguments I added are not in the "signature" of the .MouseUp event...
    2.  
    3. </b>) Handles lstItems.MouseUp

    I added the bolded part...

    Where can I go or what can I do to override this signature? Is it possible?

    Thanks,

    Squirrelly1 [/B]
    I would be interested to know where you got the idea you could do this. Look up the MSDN Help and you will find no indication that you can have more that one argument (as opposed to Handles or Parameters) in an event handler. Anyway, why do you need it?
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2001
    Location
    USA
    Posts
    1,026
    I was experimenting...

    How can you know what you can and can't do (without reading LONGWINDED MSDN articles) unless you try...


    Read the thread I linked to in one of my previous threads to understand why I need this...

    Squirrelly1
    Now happily married and still crankin' away at the keyboard. Life is grand for a coder, no?

  6. #6
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    Why all this? Just use the e variable.
    \m/\m/

  7. #7

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2001
    Location
    USA
    Posts
    1,026
    Perhaps telling me how this...

    ByVal e As System.Windows.Forms.MouseEventArgs

    can give me the information from this...

    System.Windows.Forms.KeyEventArgs

    would be a little more useful of a post response...

    I am assuming (and I must assume because you were neither descriptive nor difinitive in your post) from what you have said that it is possible... (Though I doubt it)

    Squirrelly1
    Now happily married and still crankin' away at the keyboard. Life is grand for a coder, no?

  8. #8
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Originally posted by squirrelly1
    I was experimenting...

    Hope you don't experiment on your car by disconnecting the brakes and then ask a mechanic why it wouldn't stop

    It appears to me that:

    1. you are allowed only one ....args statement in any event handler.

    2. certain events only work with certain ....args

    3. you can only override something if it is stated to be overridable in it's base container.
    Last edited by taxes; Jun 26th, 2004 at 06:11 PM.
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  9. #9

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2001
    Location
    USA
    Posts
    1,026
    LOL... no, I only do experiments like that on other people's cars... (what do you drive?)



    No really, I figure it can't hurt anything to try something... I might even learn from it (as I did in this case)... what I have learned I still have to figure out exactly, but I've got a brief idea... (don't screw with the VB IDE)


    Anyways... anyone got any answers on how I can do this? I just need to make a listbox selectively multi-selecting... lol... I want to choose when the listbox will select mulitiple items and I would prefer that it be when a user is holding down a particular key...

    Squirrelly1
    Now happily married and still crankin' away at the keyboard. Life is grand for a coder, no?

  10. #10

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2001
    Location
    USA
    Posts
    1,026
    BTW... nice disclaimer there..
    Now happily married and still crankin' away at the keyboard. Life is grand for a coder, no?

  11. #11
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Hi,

    "LOL... no, I only do experiments like that on other people's cars... (what do you drive?)
    "


    Normally, people up the wall

    O.K. Well in the mouse down event can't you check to see which key is being depressed? I've forgotten the actual code but you can get VB.NET to keep an eye on what is happening outside of a sub, whilst that sub is running.
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  12. #12
    Frenzied Member <ABX's Avatar
    Join Date
    Jul 2002
    Location
    Canada eh...
    Posts
    1,622
    Best think i can think of is setting a Declaration Level private variable when the keyUp/KeyDown events are fired if its the control key....

    and then when MouseUp Event is fired check the Variable to see the state....
    Tips:
    • Google is your friend! Search before posting!
    • Name your thread appropriately... "I Need Help" doesn't cut it!
    • Always post your code!!!! We can't read your mind!!! (well, at least most of us!)
    • Allways Include the Name and Line of the Exception (if one is occuring!)
    • If it is relevant state the version of Visual Studio/.Net Framwork you are using (2002/2003/2005)


    If you think I was helpful, rate my post
    IRC Contact: Rizon/xous ChakraNET/xous Freenode/xous

  13. #13

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2001
    Location
    USA
    Posts
    1,026
    You know, that's not a bad idea

    Squirrelly1
    Now happily married and still crankin' away at the keyboard. Life is grand for a coder, no?

  14. #14
    Hyperactive Member
    Join Date
    Mar 2004
    Location
    Prato - Tuscany - Italy
    Posts
    461
    Good morning to everyone, dear friends. I have to admit I'm not sure what exactly you need Squirrelly (It's a my problem, not yours ), I think you have to obtain something of two separate group of selected Items. In the Thread you started this argument, you had some suggestions by the always clean and sharp Brown Monkey. He suggested, I think, you can tag an item in a proper way if you are able to decide if it has to be included in group1 or group2. If the problem is to decide in which group you have to store the item, with the minimum possible effort, why don't you test if the mouse button pressed was the right one or the left one.? You can obtain this info in mouseup event. Something like this:
    VB Code:
    1. Private Sub Lsw1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Lsw1.MouseUp
    2.         If e.Button = MouseButtons.Left Then
    3.             Debug.WriteLine("Sinistro")
    4.         Else
    5.             Debug.WriteLine("Altro bottone")
    6.         End If
    7.     End Sub
    If this is not the problem....forget all
    Live long and prosper (Mr. Spock)

  15. #15
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Originally posted by squirrelly1
    You know, that's not a bad idea

    Squirrelly1
    What is??
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  16. #16
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Originally posted by squirrelly1
    BTW... nice disclaimer there..
    Yes. While, you can't be too careful. I don't know about US law but in the UK anyone who gives advice can be sued by someone who relies on that advice and looses out - even if the advice is gratuitous when it might be slightly negligent.

    I would have preferred to see such a general disclaimer inserted by the Forum administrators applicable to all threads, then I could say something more amusing.
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  17. #17

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2001
    Location
    USA
    Posts
    1,026
    Best think i can think of is setting a Declaration Level private variable when the keyUp/KeyDown events are fired if its the control key....

    and then when MouseUp Event is fired check the Variable to see the state....
    That's not a bad idea... Don't know why I didn't think of it before..


    Alextyx,

    Thanks for the idea, but I already attempted to use the right mouse button for this... Let me try to clear it up for you...

    I have one listbox. At times, my user only needs to select a single item in that listbox, at other times (like deleting multiple items), my user needs to be able to select multiple items from that same listbox.

    I would rather have it so that my user has to hold down a button on the keyboard instead of selecting a checkbox for "multiple select"...

    As far as the right mouse button is concerned, I've tried to have it select multiple when you select with it, but to no avail... just doesn't want to work


    Everyone else,

    Thanks for the help guys, I really appreciate the time you all take to assist others. I'm going to try to try and impliment the variable idea, and trust me, you all will know if I run into probs

    Later,

    Squirrelly1
    Now happily married and still crankin' away at the keyboard. Life is grand for a coder, no?

  18. #18
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Hi,

    Flash of inspiration

    Use the doubleclick event

    VB Code:
    1. Private Sub LstViewScore_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles LstViewScore.DoubleClick
    2.         LstViewScore.MultiSelect = True
    3.     End Sub

    You can then select multiple items in the normal way by holding the Ctrl key down.

    Reset the MultiSelect property to false when you carry out the deletion or you could use the doublelick simply to change the multiselect property

    VB Code:
    1. Private Sub LstViewScore_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles LstViewScore.DoubleClick
    2.         If LstViewScore.MultiSelect = True then
    3.            LstViewScore.Multiselect = False
    4.         Else
    5.            LstViewScore.MultiSelect = True
    6.         End If
    7.     End Sub
    Last edited by taxes; Jun 27th, 2004 at 06:33 PM.
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  19. #19

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2001
    Location
    USA
    Posts
    1,026
    Yet another great idea... A little much for my users to have to do, but not a bad idea... it will work for now...


    Thanks,

    Squirrelly1
    Now happily married and still crankin' away at the keyboard. Life is grand for a coder, no?

  20. #20
    Hyperactive Member
    Join Date
    Mar 2004
    Location
    Prato - Tuscany - Italy
    Posts
    461
    If it useful for you, you can detect the right click in this way:

    Press the right button
    Holding it pressed, press also the left one and then use this code:

    VB Code:
    1. Private Sub Lsw1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Lsw1.MouseUp
    2.         If e.Button = MouseButtons.Right Then
    3.             MessageBox.Show("Right one")
    4.         Else
    5.             MessageBox.Show("Left one")
    6.         End If
    7.     End Sub
    Live long and prosper (Mr. Spock)

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