![]() |
Visual basic...
I'm using this code to detect right mouse up on a command button:
code: I'm trying to make right click look the same as normal click on a cmd button, but with this the button doesnt physically look like it's getting pressed. Is there any way that I can make the button display it's buttonDown image? |
What you have to do is to make that the rightclick trigger the click, i mean, the righclick should make the button is pushed, then you will get it looks like a normal click.
|
I need a specific set of things to happen on a right click.
|
Let me see if I have the idea...
You want the button to depress when you right click just like it does when you left click. You also want different events to fire so you can do different things for left and right clicks. Is this correct? |
Yes, exactly (sorry if it wasnt clear).
|
I don't have my tools here - besides its getting late. I'll try to play with this a little tomorrow. I'll let you know if I come up with something.
edit : is it VB 6? |
Ok... thanks for the help :)
(yep, vb 6.) |
AFAIK a program must be intuitive, what means that has to works as windows uses to work, then the user could easily understand how to use it... then, using a rightclick in a button is quite strange... why use a RC in a button? %)
|
I was wondering that too. I suggest if this is for others to use, that you document in detail any 'unusual' behavior like this.
|
However the solution is the same i put before: detect righclick, do something, THEN trigger the button click.
|
If you just trigger the button click event at the end, then you will get:
left click => left event right click => right event then left event. He doesn't want the left event to happen in the second case. He just wants the button to appear depressed. |
Quote:
Edit: I'm thinking now, I could just use something like: code: ...and replace it with an image of the button pressed ( a screenshot taken). well, if there is text on the button that wont work too well... Maybe I will use your idea. Btw: How would I trigger click? Isnt the click sub only what happends when it is clicked? |
Its not good programming practice, but you can *cough* call the click event yourself.
edit: why not try making your own ActiveX control? Its not very difficult at all and then you can define all of the button's behavior. |
Eh. :down: I want to steer away from stuff like that.
Same reason my code isnt backed with goto statements :p |
What about the ActiveX? Nuttin' wrong with that.
|
This is the code to trigger the left click:
code: |
Quote:
|
OK serious question...
I suggest using an ActiveX and you react to it as if its noob shit. Why? |
nono, it's nothing. Somewhat of a personal joke I guess.
btw: I dont know how to make/use activeX. |
But an activex is finally just some code, so if you find a way to achieve it, its the same using an activex or directly the code.
ActiveX is some kind of library (something like a dll, but Object Oriented). |
1 Attachment(s)
Quote:
Squak, I made a demo in VB6 of what you wanted using an ActiveX DLL that I made up. The whole thing took about 15 minutes from start to finish (including a phone interruption:D). I used a button but you could use an image control instead and place your own images in place the exact same way that I did with the text. Hope this helps. |
I don't want to be super snarky or anything, as I myself am only just starting to learn programming languages, but have you considerred buying a book? I have Core's book for learning Visual Basic 5. It's a really big book, and like I said I'm just starting out. I only came here because I'm trying to see how visual basic could be used to make visualisations for winamp. I'm probably being silly, but the answers you got to this question really are answerred in this book I have, and because it's for an older version, I got it dirt cheap, like five bucks.
My point is, you don't have to shell out big bucks to get the info you need. And I think a book would actually save you time, because if there's something you can't figure out, flip to the back and look it up in the index. As opposed to asking a question here, then waiting for someone to answer, and hoping that what they came up with works. I just realized I probably sound all preachy. I'm not trying to be, I just think you could save a ton of time with a book is all. |
There's only one thing I know how to do in VB, and that's this Word Macro
code: :p |
squakMix, I agree with the idea of buying a book... You can get books on VB6 real cheap now.
BTW: Did you try the code I posted? |
Eh, I figured out a work around
|
Private Sub Command1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
if Button = vbRightButton Then 'call the button with left, instead of right 'and pass on the other 3 params for good measure Command1_MouseUp vbLeftButton, Shift, X, Y else 'left button stuff end if end sub |
| All times are GMT. The time now is 10:19. |
Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.