|
-
Nov 17th, 2000, 04:33 PM
#1
Thread Starter
New Member
Okay, because nobody read my last Question I will have a new try:
I want to ignore a MouseEvent with a first control. Instead a second control, that lays under the first, should get this Event.
In C++ its called to 'sink' an Event, but I need this in VisualBasic.
Thanx for your attention.
-
Nov 17th, 2000, 04:49 PM
#2
Add the following to a Form with a PictureBox and CommandButton. Make sure the PictureBox overlaps the CommandButton.
Code:
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Print "Mouse moved over button"
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If (X + Picture1.Left) > Command1.Left And (Y + Picture1.Top) < (Command1.Height + Command1.Top) Then
Print "Mouse movd over button (through PictureBox)"
End If
End Sub
-
Nov 17th, 2000, 04:59 PM
#3
Thread Starter
New Member
Nice trick, Megatron, but it doesn't solve my problem.
I have about 30 Frame-Objects and about 20 Picture-Boxes on the form and every single Picture can be dragged into a frame.
When the frame gets an DragDrop-Event, it checks, if this picture is allowed to enter and then moves the picture.
Now if I drag on of the pictures over another picture, the PictureBox-Object gets the DragDrop-Event that should be handled by the Frame-Object.
I would prefer the elegant solution to sink the DragDrop-Event to the frame instead of working around.
-
Nov 17th, 2000, 05:03 PM
#4
Fanatic Member
Here is an updated Picture1_MouseMove that should be a bit more accurate:
Code:
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Form1.Cls
If (X + Picture1.Left > Command1.Left And Y + Picture1.Top > Command1.Top) And _
(X + Picture1.Left < Command1.Left + Command1.Width) And _
(Y + Picture1.Top < Command1.Top + Command1.Height) Then
Print "Mouse moved over button (through PictureBox)"
Else
Print "Mouse Moved over Picturebox"
End If
End Sub
Nifty Idea on how to handle this problem though.
-
Nov 17th, 2000, 07:44 PM
#5
Or:
Code:
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If (X + Picture1.Left) > Command1.Left And (Y + Picture1.Top) < (Command1.Height + Command1.Top) Then
Print "Mouse movd over button (through PictureBox)"
Exit Function
End If
Print "Mouse moved over PictureBox"
End Sub
-
Nov 19th, 2000, 03:00 PM
#6
Thread Starter
New Member
Yes, but I do not want to recognize MouseMove.
I want to perform a DragDrop-Operation on Command1 and by the way, Picture1 is in front of Command1 and is always 100% inside of Command1.
Its a bit tricky thats why I am looking for any way to ignore picture1 completly when an DragDrop-Event occurs.
For now I made Command1 big enough to perform my operation outside picture1, but its only a dirty trick.
-
Nov 19th, 2000, 03:26 PM
#7
transcendental analytic
I'm not sure what youre doing, but i guess youre dragging the picture1 with the mouse, and not using the implemented Drag methods. Am i correct? Then you want to fire the mousemove event on the parent control?
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 19th, 2000, 05:43 PM
#8
Thread Starter
New Member
I am dragging a Picture2 with the implemented Drag methods. The Command1 sets a zone within where droping Pictures is allowed. But when I drop a Picture3 over Picture1, Picture1 gets the DragDrop-Event instead of Command1.
I want Picture1 to ignore the event and/or send it to Command1.
-
Nov 19th, 2000, 05:52 PM
#9
transcendental analytic
Maybe you could just pass the parameters to the command button drop event instead
Code:
Private Sub Picture1_DragDrop(Source As Control, X As Single, Y As Single)
Command1_DragDrop Source, X, Y
End Sub
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 19th, 2000, 06:06 PM
#10
Thread Starter
New Member
Sure, but my Command-Controls (I have got 30 of them) are initialized at RunTime and I must address them like
Picture1.Container.
-
Nov 19th, 2000, 08:20 PM
#11
transcendental analytic
Why don't you create a control array instead? You could as well use load statement to create the rest 29 of them if you have the first item, and you wlil have the same event
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 23rd, 2000, 03:34 PM
#12
Thread Starter
New Member
Solved, thanx to all
Okay, thanx to everyone who helped.
I was so hard trying to find an gobal Ignore-Statement that I haven`t thought about calling the implemented function in my class. I had to make it public
Now the call looks like:
Code:
call spielfeld.spiel.raeume _(Picture.Container.Tag).Raumhandle_DragDrop(Source, X, Y)
'Picture.container.Tag contains the number of the Room (Frame-Object) which contains the picture.
Raumhandle is the variable for the frame within the Rooms.
Its not elegant but it works. In my second project I will think a bit longer about the structure of my classes 
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
|