|
-
Aug 17th, 2000, 06:40 AM
#1
Thread Starter
Lively Member
I have created rollover effect using few picture boxes. the problem is that there is not way to find when the lostfocus of a picturebox was triggered. As there is no event called lostfocus for picturebox, is there any way that this can be done using some APIs. any api gurus who know this. please help me
-
Aug 17th, 2000, 06:47 AM
#2
_______
<?>
...a shot in the dark
Could you use the mouse-move event...
on the picture one event on the form the other event
Ie..when on form the picture is red
....when on the picture the picture is blue
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Aug 17th, 2000, 06:50 AM
#3
Try putting a Label in the picturebox, and resize it to fit the PictureBox exactly. Set it's Backstyle property to 0 - Transparent. The label has the GotDocus, LostFocus events.
I can't think of any other way.
Hope this helps.
-
Aug 17th, 2000, 08:37 AM
#4
Actually, there is a LostFocus event.
Code:
Private Sub Picture1_LostFocus()
MsgBox ("LOST FOCUS")
End Sub
-
Aug 17th, 2000, 08:54 AM
#5
Megatron! Congrats for reaching 3000 posts! 
And FYI, there's no LostFocus event to a PictureBox.
-
Aug 17th, 2000, 09:52 AM
#6
transcendental analytic
Actually there is, At least there is in Vb5
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.
-
Aug 17th, 2000, 09:56 AM
#7
Sorry, my mistake.
There is a LostFocus event.
-
Aug 17th, 2000, 10:02 AM
#8
Sc0rp: Thanks. In VB4, 5 and 6 there are LostFocus events. Try this example. Make a Form with a CommandButton and a PictureBox. Insert this code into it.
Code:
Private Sub Picture1_LostFocus()
MsgBox ("LOST FOCUS")
End Sub
Try clicking the PictureBox then clicking the CommandButton (so it loses focus). The MessageBox should pop up.
-
Aug 17th, 2000, 10:17 AM
#9
New Member
I once had the same problem. I think the actual problem is not the losing the focus, but losing the mouse_over. I think what you need is a mouse_out. That one does not exist. You could try to use the Form_MouseMove.
[code]Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Picture1.BackColor = &HC0FFFF
End Sub
Private Sub Picture1_LostFocus()
MsgBox ("lost focus")
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Picture1.BackColor = &H8080FF
End Sub
The problem is that Form_MouseMove has a short delay. It triggers only every somewhat milliseconds, that could couse that i seems like it did not work (when you move your move real quickly). In that case: also use the mouse_move of other objects...
[Edited by JeroenA on 08-17-2000 at 11:20 AM]
-
Aug 17th, 2000, 10:20 AM
#10
_______
<?>
I'm sure tppradeep18 got image box mixed with picture box
Though the picture box has a lost focus event, it won't work for the purpose of this question.
To engage the lostfocus event of the picture box you have to click something not just move off the image.
The way to go is the mouse_move events as suggested above.
use the mouse-move event...
on the picture one event on the form the other event
Ie..when on form the picture is red
....when on the picture the picture is blue
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
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
|