Go Back   Winamp Forums > Community Center > General Discussions

Reply
Thread Tools Search this Thread Display Modes
Old 19th October 2004, 00:09   #1
squakMix
wwwyzzerdd
(Forum King)
 
squakMix's Avatar
 
Join Date: May 2003
Posts: 3,458
Visual basic...

I'm using this code to detect right mouse up on a command button:

code:
Private Sub cmdTopLeft_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbRightButton Then MsgBox "Right Button released"
End Sub



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?


"Oh BTW. How do you say 'stop throwing shit at the side of my house' in spanish?"
Check out my music
squakMix is offline   Reply With Quote
Old 19th October 2004, 02:56   #2
yenerich
Banned
 
Join Date: Sep 2004
Posts: 295
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.
yenerich is offline   Reply With Quote
Old 19th October 2004, 03:12   #3
squakMix
wwwyzzerdd
(Forum King)
 
squakMix's Avatar
 
Join Date: May 2003
Posts: 3,458
I need a specific set of things to happen on a right click.


"Oh BTW. How do you say 'stop throwing shit at the side of my house' in spanish?"
Check out my music
squakMix is offline   Reply With Quote
Old 19th October 2004, 03:21   #4
CaboWaboAddict
Forum Sot
(Major Dude)
 
CaboWaboAddict's Avatar
 
Join Date: Mar 2004
Location: Marietta, Ga. U.S.A.
Posts: 3,915
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?

Idiot's Advocate
My site (under construction)
CaboWaboAddict is offline   Reply With Quote
Old 19th October 2004, 03:22   #5
squakMix
wwwyzzerdd
(Forum King)
 
squakMix's Avatar
 
Join Date: May 2003
Posts: 3,458
Yes, exactly (sorry if it wasnt clear).


"Oh BTW. How do you say 'stop throwing shit at the side of my house' in spanish?"
Check out my music
squakMix is offline   Reply With Quote
Old 19th October 2004, 03:24   #6
CaboWaboAddict
Forum Sot
(Major Dude)
 
CaboWaboAddict's Avatar
 
Join Date: Mar 2004
Location: Marietta, Ga. U.S.A.
Posts: 3,915
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?

Idiot's Advocate
My site (under construction)
CaboWaboAddict is offline   Reply With Quote
Old 19th October 2004, 03:25   #7
squakMix
wwwyzzerdd
(Forum King)
 
squakMix's Avatar
 
Join Date: May 2003
Posts: 3,458
Ok... thanks for the help

(yep, vb 6.)


"Oh BTW. How do you say 'stop throwing shit at the side of my house' in spanish?"
Check out my music
squakMix is offline   Reply With Quote
Old 19th October 2004, 03:28   #8
yenerich
Banned
 
Join Date: Sep 2004
Posts: 295
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? %)
yenerich is offline   Reply With Quote
Old 19th October 2004, 03:31   #9
CaboWaboAddict
Forum Sot
(Major Dude)
 
CaboWaboAddict's Avatar
 
Join Date: Mar 2004
Location: Marietta, Ga. U.S.A.
Posts: 3,915
I was wondering that too. I suggest if this is for others to use, that you document in detail any 'unusual' behavior like this.

Idiot's Advocate
My site (under construction)
CaboWaboAddict is offline   Reply With Quote
Old 19th October 2004, 03:36   #10
yenerich
Banned
 
Join Date: Sep 2004
Posts: 295
However the solution is the same i put before: detect righclick, do something, THEN trigger the button click.
yenerich is offline   Reply With Quote
Old 19th October 2004, 03:40   #11
CaboWaboAddict
Forum Sot
(Major Dude)
 
CaboWaboAddict's Avatar
 
Join Date: Mar 2004
Location: Marietta, Ga. U.S.A.
Posts: 3,915
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.

Idiot's Advocate
My site (under construction)
CaboWaboAddict is offline   Reply With Quote
Old 19th October 2004, 03:41   #12
squakMix
wwwyzzerdd
(Forum King)
 
squakMix's Avatar
 
Join Date: May 2003
Posts: 3,458
Quote:
Originally posted by yenerich
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? %)
It's for a game.

Edit: I'm thinking now, I could just use something like:

code:
Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbRightButton Then
Command1.Picture = LoadPicture("c:\MyPicture.jpg")
ElseIf Button = vbLeftButton Then
'Display anoter picture maybe?
End If
End Sub



...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?


"Oh BTW. How do you say 'stop throwing shit at the side of my house' in spanish?"
Check out my music
squakMix is offline   Reply With Quote
Old 19th October 2004, 03:53   #13
CaboWaboAddict
Forum Sot
(Major Dude)
 
CaboWaboAddict's Avatar
 
Join Date: Mar 2004
Location: Marietta, Ga. U.S.A.
Posts: 3,915
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.

Idiot's Advocate
My site (under construction)
CaboWaboAddict is offline   Reply With Quote
Old 19th October 2004, 03:57   #14
squakMix
wwwyzzerdd
(Forum King)
 
squakMix's Avatar
 
Join Date: May 2003
Posts: 3,458
Eh. I want to steer away from stuff like that.

Same reason my code isnt backed with goto statements


"Oh BTW. How do you say 'stop throwing shit at the side of my house' in spanish?"
Check out my music
squakMix is offline   Reply With Quote
Old 19th October 2004, 04:01   #15
CaboWaboAddict
Forum Sot
(Major Dude)
 
CaboWaboAddict's Avatar
 
Join Date: Mar 2004
Location: Marietta, Ga. U.S.A.
Posts: 3,915
What about the ActiveX? Nuttin' wrong with that.

Idiot's Advocate
My site (under construction)
CaboWaboAddict is offline   Reply With Quote
Old 19th October 2004, 04:01   #16
yenerich
Banned
 
Join Date: Sep 2004
Posts: 295
This is the code to trigger the left click:

code:

Private Sub Command1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbRightButton Then
Dim pt As POINTAPI, curX As Long, curY As Long
Dim dstX As Long, dstY As Long
ScaleMode = vbPixels
pt.X = Command2.Width / 2
pt.Y = Command2.Height / 2
ClientToScreen Command1.hwnd, pt
dstX = pt.X * 65535 / ScaleX(Screen.Width, vbTwips, vbPixels)
dstY = pt.Y * 65535 / ScaleY(Screen.Height, vbTwips, vbPixels)
mouse_event MOUSEEVENTF_ABSOLUTE + MOUSEEVENTF_MOVE + _
MOUSEEVENTF_LEFTDOWN + MOUSEEVENTF_LEFTUP, dstX, _
dstY, 0, 0
End If

End Sub

yenerich is offline   Reply With Quote
Old 19th October 2004, 04:07   #17
squakMix
wwwyzzerdd
(Forum King)
 
squakMix's Avatar
 
Join Date: May 2003
Posts: 3,458
Quote:
Originally posted by CaboWaboAddict
What about the ActiveX? Nuttin' wrong with that.


"Oh BTW. How do you say 'stop throwing shit at the side of my house' in spanish?"
Check out my music
squakMix is offline   Reply With Quote
Old 19th October 2004, 04:09   #18
CaboWaboAddict
Forum Sot
(Major Dude)
 
CaboWaboAddict's Avatar
 
Join Date: Mar 2004
Location: Marietta, Ga. U.S.A.
Posts: 3,915
OK serious question...

I suggest using an ActiveX and you react to it as if its noob shit. Why?

Idiot's Advocate
My site (under construction)
CaboWaboAddict is offline   Reply With Quote
Old 19th October 2004, 04:21   #19
squakMix
wwwyzzerdd
(Forum King)
 
squakMix's Avatar
 
Join Date: May 2003
Posts: 3,458
nono, it's nothing. Somewhat of a personal joke I guess.

btw: I dont know how to make/use activeX.


"Oh BTW. How do you say 'stop throwing shit at the side of my house' in spanish?"
Check out my music
squakMix is offline   Reply With Quote
Old 19th October 2004, 16:56   #20
yenerich
Banned
 
Join Date: Sep 2004
Posts: 295
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).
yenerich is offline   Reply With Quote
Old 20th October 2004, 19:46   #21
CaboWaboAddict
Forum Sot
(Major Dude)
 
CaboWaboAddict's Avatar
 
Join Date: Mar 2004
Location: Marietta, Ga. U.S.A.
Posts: 3,915
Quote:
Originally posted by yenerich
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).
Not quite, you can do a lot of things really easily using an ActiveX that would be very cumbersome using in-line code.

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).

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.
Attached Files
File Type: zip custom button.zip (3.2 KB, 70 views)

Idiot's Advocate
My site (under construction)
CaboWaboAddict is offline   Reply With Quote
Old 10th November 2004, 15:10   #22
Nolita
Senior Member
 
Join Date: Sep 2004
Posts: 101
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.
Nolita is offline   Reply With Quote
Old 10th November 2004, 15:17   #23
mysterious_w
Forum King
 
mysterious_w's Avatar
 
Join Date: Dec 2003
Location: Good ol' Britain
Posts: 2,749
There's only one thing I know how to do in VB, and that's this Word Macro

code:

do until 1 = 2
beep
loop






mysterious_w is offline   Reply With Quote
Old 10th November 2004, 15:24   #24
CaboWaboAddict
Forum Sot
(Major Dude)
 
CaboWaboAddict's Avatar
 
Join Date: Mar 2004
Location: Marietta, Ga. U.S.A.
Posts: 3,915
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?

Idiot's Advocate
My site (under construction)
CaboWaboAddict is offline   Reply With Quote
Old 10th November 2004, 23:23   #25
squakMix
wwwyzzerdd
(Forum King)
 
squakMix's Avatar
 
Join Date: May 2003
Posts: 3,458
Eh, I figured out a work around


"Oh BTW. How do you say 'stop throwing shit at the side of my house' in spanish?"
Check out my music
squakMix is offline   Reply With Quote
Old 12th November 2004, 09:47   #26
Bizzeh
Forum Pirate
Beta Team
 
Bizzeh's Avatar
 
Join Date: Oct 2001
Posts: 2,032
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
Bizzeh is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Community Center > General Discussions

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump