Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 20th, 2004, 11:53 AM
Authorized User
 
Join Date: Aug 2003
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Kaustav Send a message via Yahoo to Kaustav
Default Menu help in Status Bar.panel(1).text

You may have observed that when you move your mouse over any menu item in any microsoft application then you get a note on the status bar about the menu item over which your mouse is standing. But as soon as you leave the menu item it changes.

I want to do the same in my application. How can i? PLease tell me if it can be done with any API calls and how?
Bye

------------------
Kaustav
__________________
------------------
Kaustav
 
Old January 20th, 2004, 05:08 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yuo have two choices.
First, put some code in MouseMove event of *every* component for which you want to display some information. This has the problem that the status bar does not "reset" if the cursor is in some component with no Move event, or it goes outside the window.
Second, in a timer event (1 second should be enough) use the GetCursorPos API to get the mouse position and the ChildWindowFromPoint to get the window where the mouse is. Now loop through all the controls in your form until you find the control with the right Hwnd. If found, display something, otherwise reset the status bar.
Marco
 
Old January 31st, 2004, 03:06 AM
Authorized User
 
Join Date: Aug 2003
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Kaustav Send a message via Yahoo to Kaustav
Default

thanx marcostraf.
But this is not the thing i wanted. I wanted to know that how can i isplay a string in the status bar when i am on a specific menu item .

That is if i click on "file" menu and highlight the "New" menu item but do not click on it i get to see "Opends the new Dialog box" message on my status bar.

PLz help.
bye

------------------
Kaustav
 
Old February 2nd, 2004, 08:30 AM
Authorized User
 
Join Date: Jun 2003
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This is a Sub I use in my MDI form to do this. I hope this helps.

    Private Sub HandleSelect(ByVal sender As Object, ByVal e As System.EventArgs) _
     Handles mnuStatusBar.Select, mnuAbout.Select, mnuCascade.Select, mnuExit.Select, _
     mnuOpen.Select, mnuTileHorizontal.Select, mnuTileVertical.Select, mnuFile.Select, _
     mnuView.Select, mnuWindow.Select, mnuHelp.Select
        Dim strText As String

        If sender Is mnuStatusBar Then
            strText = "Toggle display of the status bar"
        ElseIf sender Is mnuAbout Then
            strText = "Display the About dialog box"
        ElseIf sender Is mnuCascade Then
            strText = "Cascade child windows"
        ElseIf sender Is mnuExit Then
            strText = "Exit"
        ElseIf sender Is mnuOpen Then
            strText = "Create new child window"
        ElseIf sender Is mnuTileHorizontal Then
            strText = "Tile windows horizontally"
        ElseIf sender Is mnuTileVertical Then
            strText = "Tile windows vertically"
        Else
            strText = String.Empty
        End If

        WriteToStatusBar(strText)
    End Sub
 
Old February 2nd, 2004, 02:59 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This will work in .NET only...

The VB standard menu exposes only the click event, thus we are out of luck. It is possible to do it subclassing the form (well, you can do everything subclassing!) but it is a messy business and you need a lot of code. A third party component that exposes the MenuItemEnter and MenuItemLeave events (like the ActiveBar control by Data Dynamics) can do the trick.

Marco

Quote:
quote:Originally posted by nbryson
 This is a Sub I use in my MDI form to do this. I hope this helps.

    Private Sub HandleSelect(ByVal sender As Object, ByVal e As System.EventArgs) _
 
Old February 3rd, 2004, 02:03 AM
Authorized User
 
Join Date: Aug 2003
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Kaustav Send a message via Yahoo to Kaustav
Default

Dear nbryson,
Thanx for your help . But can you tell me plz where to place this sub function and how to call it. PLz give the full details.

Bye

------------------
Kaustav
 
Old February 3rd, 2004, 02:08 AM
Authorized User
 
Join Date: Aug 2003
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Kaustav Send a message via Yahoo to Kaustav
Default

dear Marcostraf,
PLz tell me hw can i do the same with subclassing. Provide the full step. Since i have less knowledge in subclassing.

bye

------------------
Kaustav
 
Old February 3rd, 2004, 05:55 AM
Authorized User
 
Join Date: Jun 2003
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by Kaustav
 Dear nbryson,
Thanx for your help . But can you tell me plz where to place this sub function and how to call it. PLz give the full details.

Bye

------------------
Kaustav
What environment are you using?. The code I send was using VB.Net.
 
Old February 3rd, 2004, 03:03 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Dear Kaustav,

subclassing is a messy business and I suggest you to try only if you have a lot of time and patience. It is a too big of a subject for a post, try searching the web (careful, 90% is junk, as all the internet is). Start with 'good' we sites like the developers exchange www.dex.com and the VBPJ archives www.fawcette.com/archives/magazines/vsm

Marco


Quote:
quote:Originally posted by Kaustav
 dear Marcostraf,
PLz tell me hw can i do the same with subclassing. Provide the full step. Since i have less knowledge in subclassing.

bye

------------------
Kaustav
 
Old February 5th, 2004, 01:14 AM
Authorized User
 
Join Date: Aug 2003
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Kaustav Send a message via Yahoo to Kaustav
Default

i use VB 6.0 on windows XP

------------------
Kaustav





Similar Threads
Thread Thread Starter Forum Replies Last Post
Status Bar ironchef Java GUI 0 October 26th, 2006 09:19 PM
How do disable Menu bar & address bar for browser bekim HTML Code Clinic 2 January 7th, 2005 12:33 AM
Change Status bar qazi_nomi HTML Code Clinic 1 July 10th, 2004 04:28 PM
Status Bar soccers_guy10 Pro VB.NET 2002/2003 3 August 12th, 2003 11:48 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.