Jump to content

MenuCreateItem: third level not working


c.haslam
 Share

Recommended Posts

Consider the following script:

#include 
#include 
GUICreate("Annotate pictures", 887, 685, -1, -1, BitOR($WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW,$WS_BORDER,$WS_CLIPSIBLINGS))
Global $mnuDir = GUICtrlCreateMenu("&Directory")
$mnuDirOpen = GUICtrlCreateMenuItem("Open", $mnuDir)
Global $mnuDirOpenMyComputer = GUICtrlCreateMenuItem("On this computer", $mnuDirOpen)
Global $mnuDirOpenNetwork = GUICtrlCreateMenuItem("On the network", $mnuDirOpen)
Global $mnuDirSave = GUICtrlCreateMenuItem("Save", $mnuDir)
Global $mnuDirExit = GUICtrlCreateMenuItem("Exit", $mnuDir)
Global $mnuTools = GUICtrlCreateMenu("Tools")
Global $mnuToolsLoadAllInDir = GUICtrlCreateMenuItem("Load all .jpgs in directory", $mnuTools)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
        Exit
    EndSwitch
WEnd

I expect to see:

Directory
      Open
         On the computer
         On the network
      Save
      Exit
   Tools
      Load all .jpgs in directory

but what I see is:

Directory
      Open
      On the computer
      On the network
      Save
      Exit
   Tools
    Load all .jpgs in directory

Do I not understand how to call MenuCreateItem(), or is there a bug in AutoIt?

...chris

Spoiler

CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard

 

Link to comment
Share on other sites

#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>

GUICreate("Annotate pictures", 887, 685, -1, -1, BitOR($WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW,$WS_BORDER,$WS_CLIPSIBLINGS))
Global $mnuDir = GUICtrlCreateMenu("&Directory")
$mnuDirOpen = GUICtrlCreateMenu("Open", $mnuDir) ;******************** changed this line
Global $mnuDirOpenMyComputer = GUICtrlCreateMenuItem("On this computer", $mnuDirOpen)
Global $mnuDirOpenNetwork = GUICtrlCreateMenuItem("On the network", $mnuDirOpen)
Global $mnuDirSave = GUICtrlCreateMenuItem("Save", $mnuDir)
Global $mnuDirExit = GUICtrlCreateMenuItem("Exit", $mnuDir)
Global $mnuTools = GUICtrlCreateMenu("Tools")
Global $mnuToolsLoadAllInDir = GUICtrlCreateMenuItem("Load all .jpgs in directory", $mnuTools)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
        Exit
    EndSwitch
WEnd

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...