Jump to content

Recommended Posts

Posted

Hi,

I'm writing an application and want to add a status bar. I know how to create a working status bar, however, I don't know how to have one that updates when a mouse houvers over a menu item. (eg if in some applications if you houver your mouse over a menu iem like File|Save, a message appears in the status bar like "Save current document")

Does anyone know how I might do this?

Thanks

Radsam

Posted (edited)

GuiGetCursorInfo should do it i think

Edited by Xenogis

[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Posted

I've already experimented with that. The function doesn't recognize when the mouse is over a menu control. It works for over controls great and I've used it to create hyperlinks, however it just doesn't work in menu controls.

Radsam

Posted

then all i can think of is creating fake menus that look the same...

[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Posted

i don't have enough time to write an example, it will probably require images or lots of graphic controls

[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Posted

I had the brilliant idea of using PixelGetColor to detect the proper menu color.

However, whenever a menu is open, it appears that Adlib and other message processing is blocked :):D:D

You would need to put my Adlib stuff in a second script, if you wanted the following to work.

#include <GUIConstants.au3>
Opt("PixelCoordMode", 2);relative to client area!
;Opt("MouseCoordMode", 2)

AdLibEnable("updateStatusBar")

Global $X = 5
Global $MENU_HEIGHT = _MenuHeight()
Global $SEP_HEIGHT = $MENU_HEIGHT / 2 ;guesstimate
Global $MENU_COLOR = _MenuHilightColor()


GUICreate("My GUI menu",300,200)

$filemenu = GUICtrlCreateMenu ("&File")
    $fileitem = GUICtrlCreateMenuitem ("Open",$filemenu)
     GUICtrlSetState(-1,$GUI_DEFBUTTON)
$helpmenu = GUICtrlCreateMenu ("?")
    $saveitem = GUICtrlCreateMenuitem ("Save",$filemenu)
     GUICtrlSetState(-1,$GUI_DISABLE)
    $infoitem = GUICtrlCreateMenuitem ("Info",$helpmenu)
    $exititem = GUICtrlCreateMenuitem ("Exit",$filemenu)
$recentfilesmenu = GUICtrlCreateMenu ("Recent Files",$filemenu,1)
$separator1 = GUICtrlCreateMenuitem ("",$filemenu,2); create a separator line
$viewmenu = GUICtrlCreateMenu("View",-1,1); is created before "?" menu
    $viewstatusitem = GUICtrlCreateMenuitem ("Statusbar",$viewmenu)
     GUICtrlSetState(-1,$GUI_CHECKED)

$statuslabel = GUICtrlCreateLabel ("NULL",0,165,300,16,BitOr($SS_SIMPLE,$SS_SUNKEN))

GUISetState ()
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    
WEnd
Exit


Func updateStatusBar()
    
    ToolTip("Is Adlib called? " & @MIN & ":" & @SEC, 0, 0)

    If PixelGetColor(5, 10) = $MENU_COLOR Then
        GuiCtrlSetData($statuslabel, "Open menu item...")
    ElseIf PixelGetColor(5, 20) = $MENU_COLOR Then
        GuiCtrlSetData($statuslabel, "Recent menu item...")
    ElseIf PixelGetColor(5, 50) = $MENU_COLOR Then
        GuiCtrlSetData($statuslabel, "Save menu item...")
    ElseIf PixelGetColor(5, 50) = $MENU_COLOR Then
        GuiCtrlSetData($statuslabel, "Exit menu item...")
    Else
        GuiCtrlSetData($statuslabel, "NULL")
    EndIf
    
EndFunc

; Pixel color to look for when a menu item is selected
Func _MenuHilightColor()
    Local $tuple = RegRead("HKEY_CURRENT_USER\Control Panel\Colors", "Hilight")
    If @error Then
        SetError(1)
        Return 664682 ;fail-safe color is a dark blue....
    EndIf
; For example, registry key is '255 255 255' if white
    Local $t = StringSplit($tuple, ' ')
    Return Dec( Hex($t[1],2) & Hex($t[2],2) & Hex($t[3],2) )
EndFunc


Func _MenuHeight()
    Local $temp = DllCall("user32.dll", "int", "GetSystemMetrics", "int", 15)
    If IsArray($temp) Then
        Return $temp[0]
    Else
        SetError(1)
    EndIf
EndFunc
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...