|
-
Jun 25th, 2004, 12:44 PM
#1
Thread Starter
Frenzied Member
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:
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?
-
Jun 25th, 2004, 04:42 PM
#2
Hyperactive Member
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)
-
Jun 26th, 2004, 10:09 AM
#3
Thread Starter
Frenzied Member
Now happily married and still crankin' away at the keyboard.  Life is grand for a coder, no?
-
Jun 26th, 2004, 12:30 PM
#4
PowerPoster
Re: MouseUp event signature
Originally posted by squirrelly1
VB Code:
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...
</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.
-
Jun 26th, 2004, 01:32 PM
#5
Thread Starter
Frenzied Member
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?
-
Jun 26th, 2004, 02:26 PM
#6
yay gay
Why all this? Just use the e variable.
\m/  \m/
-
Jun 26th, 2004, 02:48 PM
#7
Thread Starter
Frenzied Member
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?
-
Jun 26th, 2004, 05:46 PM
#8
PowerPoster
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.
-
Jun 26th, 2004, 06:11 PM
#9
Thread Starter
Frenzied Member
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?
-
Jun 26th, 2004, 06:12 PM
#10
Thread Starter
Frenzied Member
BTW... nice disclaimer there..
Now happily married and still crankin' away at the keyboard.  Life is grand for a coder, no?
-
Jun 26th, 2004, 06:19 PM
#11
PowerPoster
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.
-
Jun 26th, 2004, 06:25 PM
#12
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
-
Jun 27th, 2004, 01:00 AM
#13
Thread Starter
Frenzied Member
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?
-
Jun 27th, 2004, 03:53 AM
#14
Hyperactive Member
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:
Private Sub Lsw1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Lsw1.MouseUp
If e.Button = MouseButtons.Left Then
Debug.WriteLine("Sinistro")
Else
Debug.WriteLine("Altro bottone")
End If
End Sub
If this is not the problem....forget all
Live long and prosper (Mr. Spock)
-
Jun 27th, 2004, 04:16 AM
#15
PowerPoster
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.
-
Jun 27th, 2004, 05:08 AM
#16
PowerPoster
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.
-
Jun 27th, 2004, 11:01 AM
#17
Thread Starter
Frenzied Member
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?
-
Jun 27th, 2004, 06:26 PM
#18
PowerPoster
Hi,
Flash of inspiration
Use the doubleclick event
VB Code:
Private Sub LstViewScore_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles LstViewScore.DoubleClick
LstViewScore.MultiSelect = True
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:
Private Sub LstViewScore_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles LstViewScore.DoubleClick
If LstViewScore.MultiSelect = True then
LstViewScore.Multiselect = False
Else
LstViewScore.MultiSelect = True
End If
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.
-
Jun 27th, 2004, 10:54 PM
#19
Thread Starter
Frenzied Member
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?
-
Jun 29th, 2004, 01:16 AM
#20
Hyperactive Member
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:
Private Sub Lsw1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Lsw1.MouseUp
If e.Button = MouseButtons.Right Then
MessageBox.Show("Right one")
Else
MessageBox.Show("Left one")
End If
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|