Phantom Documentation

[Help Home] [Phantom Home]
Menu Functions

The following function is for use with the Menu type class.  Note that the MainWin functions do not apply to the Menu class unless otherwise stated.

            Select
            IsEnabled
            IsChecked
            IsSeparator
            GetMenuText
            GetMenuCount

Example Code

# Include Phantom Target Declarations
use "PhantomTarget.dec";
System("PhantomTarget.exe");

window Event = MainWin("Phantom Target Event", "#32770");

# Enable Messages
PhantomTarget.TypeKeys("<ALT-o>me");

# Get the state of the Menus.Cascade.Item1 menu
disp(PhantomTarget._Menus._Cascade.Item_1.IsEnabled());
disp(PhantomTarget._Menus._Cascade.Item_1.IsChecked());

# Select the menu and click its event response
PhantomTarget._Menus._Cascade.Item_1.Select();
Sleep(0.5);
if(Exists(Event)){
  Event.Close();
  disp("Event detected for menu Cascade.Item1");
}else{
  disp("No event for menu Cascade.Item1");
}

# Get the enabled state of the disabled menu
disp(PhantomTarget._Menus._Disabled.IsEnabled());
# Try to select a disabled menu
PhantomTarget._Menus._Disabled.Select();
Sleep(0.5);
if(Exists(Event)){
  Event.Close();
  disp("Event detected for menu Disabled");
}else{
  disp("No event for menu Disabled");
}

# Get the check state of the checked menu
disp(PhantomTarget._Menus.C_hecked.IsChecked());

# Get the Menus child count
int iCount = PhantomTarget._Menus.GetMenuCount();
disp(iCount);

# Get the Accel menu text and separator state
disp(PhantomTarget._Menus._Accel.GetMenuText());
disp(PhantomTarget._Menus._Accel.IsSeparator());

# Exit out
PhantomTarget.Close();



See Also: Menu Class, MenuItem Class



Copyright 2000-2011 Phantom Automated Solutions