|
-
April 19th, 2001, 09:53 AM
#1
Status Bar
How Can I change the text in the status bar while the mouse is over a buttom or a text field?
FatMan
-
April 19th, 2001, 11:17 AM
#2
Re: Status Bar
Here is some sample code. I am using a StatusBar with 3 panels called sbrSystemStatus:
option Explicit
private Sub Command1_MouseMove(Button as Integer, Shift as Integer, X as Single, Y as Single)
'//Update Status Bar
sbrSystemStatus.Panels(1).Text = "This is Panel 1"
sbrSystemStatus.Panels(2).Text = "This is Panel 2"
sbrSystemStatus.Panels(3).Text = "This is Panel 3"
End Sub
private Sub Text1_MouseMove(Button as Integer, Shift as Integer, X as Single, Y as Single)
'//Update Status Bar
sbrSystemStatus.Panels(1).Text = "Change Text for Panel 1"
sbrSystemStatus.Panels(2).Text = "Change Text for Panel 2"
sbrSystemStatus.Panels(3).Text = "Change Text for Panel 3"
End Sub
Kris
Software Engineer
Phoenix,AZ
Kris
Software Engineer
Phoenix, AZ USA
-
April 23rd, 2001, 04:05 AM
#3
Re: Status Bar
The problem with that is that the text is changed and stays that way. I want it to change back as soon as I am not over the mouse.
FatMan
-
April 23rd, 2001, 04:16 AM
#4
Re: Status Bar
So, put your default text in a variable.
On mouse move over the button, change it.
On mouse move over the form or any else control, restore the default.
Special thanks to Lothar "the Great" Haensler. Come back soon, you Guru.
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
-
April 23rd, 2001, 06:38 AM
#5
Re: Status Bar
A better method than to write the same code on the form and all the neighboring controls is to detect when the mouse actually gets out of the control. Here's a code that demonstrates this. It is applicable to all controls that have a hWnd (most controls except the lightweight ones - the imagebox and the label have it)
private Declare Function ReleaseCapture Lib "user32" () as Long
private Declare Function SetCapture Lib "user32" (byval hwnd as Long) as Long
private Sub Picture1_MouseMove(Button as Integer, Shift as Integer, X as Single, Y as Single)
SetCapture (Picture1.hwnd)
If X < 0 Or Y < 0 Or X > Picture1.ScaleWidth Or Y > Picture1.ScaleHeight then
MsgBox "The mouse got out"
ReleaseCapture
End If
End Sub
private Sub Command1_MouseMove(Button as Integer, Shift as Integer, X as Single, Y as Single)
SetCapture (Command1.hwnd)
If X < 0 Or Y < 0 Or X > Command1.Width Or Y > Command1.Height then
MsgBox "The mouse got out"
ReleaseCapture
End If
End Sub
-
April 23rd, 2001, 07:07 AM
#6
Re: Status Bar
Great.
Special thanks to Lothar "the Great" Haensler. Come back soon, you Guru.
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
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
|