Package com.ms.ui Previous
Previous
Contents
Contents
Index
Index
Next
Next

Class UIPopup

Constructors , Methods

public class UIPopup extends UIWindow implements TimerListener
{
  // Constructors
  public UIPopup(Frame parent);

  // Methods
  public void launch(IUIMenuLauncher ml);
  public void launchMenu(IUIMenuLauncher sub);

  public void end();
  public void end(Object obj);

  public Color getBackground();
  public Color getForeground();
  public IUIMenuLauncher getLauncher();
  public int getRoleCode();

  public boolean action(Event e, Object o);
  public boolean handleEvent(Event e);
  public boolean gotFocus(Event e, Object o);
  public boolean lostFocus(Event e, Object o);
  public boolean keyDown(Event e, int key);
  public boolean keyUp(Event e, int key);
  public boolean mouseExit(Event e, int x, int y);

  public void timeTriggered(TimerEvent te);

}

A class that implements a pop-up menu container. A UIPopup object is a top-level window that is used internally by UIApplet, UIFrame, and UIWindow to handle the launching and cancelling of a pop-up menu. Typically, you'll use UIMenuList for the content of the pop-up menu; UIPopup provides the container for the UIMenuList control.

Each UIPopup window is associated with a menu launcher to manage the contained pop-up menu. UIMenuButton objects and UIMenuItem objects are common menu launchers.


Constructors


UIPopup

public UIPopup(Frame parent);

Creates a pop-up menu container using the specified Frame.

ParameterDescription
parent The parent container of the control.


Methods


action

public boolean action(Event e, Object o);

Cancels the menu associated with the pop-up menu container when a menu item is selected.

Return Value:

Always returns false.

ParameterDescription
e The event posted to the control.
o The object that posted the event.


end

public void end();

Cancels the menu associated with the pop-up menu container.

Return Value:

No return value.


end

public void end(Object obj);

Cancels the menu associated with the pop-up menu container when the specified menu item is selected.

Return Value:

No return value.

ParameterDescription
obj The menu item that was selected.


getBackground

public Color getBackground();

Retrieves the background color of the associated menu launcher.

Return Value:

Returns the Color object containing the menu launcher's background color.


getForeground

public Color getForeground();

Retrieves the foreground color of the associated menu launcher.

Return Value:

Returns the Color object containing the menu launcher's foreground color.


getLauncher

public IUIMenuLauncher getLauncher();

Retrieves the menu launcher that is currently associated with the pop-up menu container.

Return Value:

Returns the current menu launcher.


getRoleCode

public int getRoleCode();

Retrieves the role of the pop-up menu container.

Return Value:

Returns the ROLE_SYSTEM code that best describes the role of the pop-up container.

Remarks:

This method returns the ROLE_SYSTEM_MENUPOPUP code.


gotFocus

public boolean gotFocus(Event e, Object o);

Reacts to the pop-up menu container receiving focus.

Return Value:

Returns true if the event was handled; otherwise, returns false.

ParameterDescription
e The event posted to the control.
o The object that posted the event (always null).


handleEvent

public boolean handleEvent(Event e);

Reacts to an item in the associated pop-up menu being selected; if the menu item is a menu launcher, then its associated menu is launched.

Return Value:

Returns true if the event was handled; otherwise, returns false.

ParameterDescription
e The event.


keyDown

public boolean keyDown(Event e, int key);

Handles keyboard navigation for the pop-up menu container.

Return Value:

Returns true if the event was handled; otherwise, returns false.

ParameterDescription
e The event posted to the control.
key The key that has been pressed.

Remarks:

This method is called when the pop-up menu container has focus and a key is pressed. keyDown responds to the following key values.

Key Description
ESC, ENTER Cancels the associated pop-up menu.
UP ARROW, DOWN ARROW Navigates through the list of items in the associated pop-up menu.
RIGHT ARROW If a menu item is a menu launcher, its associated pop-up menu is laucnhed.
LEFT ARROW Cancels the pop-up menu launched from a menu item.


keyUp

public boolean keyUp(Event e, int key);

Reacts to a key being released over the pop-up menu container.

Return Value:

Returns true if the event was handled; otherwise, returns false.

ParameterDescription
e The event posted to the control.
key The key that has been pressed.


launch

public void launch(IUIMenuLauncher ml);

Associates the specified menu launcher with the pop-up menu container.

Return Value:

No return value.

ParameterDescription
ml The menu launcher to be associated with the pop-up menu container.

Remarks:

This method sets the pop-up menu container's content to the menu controlled by the specified menu launcher. This menu launcher is now associated with the pop-up container.


launchMenu

public void launchMenu(IUIMenuLauncher sub);

Launches the menu controlled by the specified menu launcher. Any previously launched menu is cancelled.

Return Value:

No return value.

ParameterDescription
sub The menu launcher that is requesting the launch.


lostFocus

public boolean lostFocus(Event e, Object o);

Reacts to the pop-up menu container losing focus.

Return Value:

Returns true if the event was handled; otherwise, returns false.

ParameterDescription
e The event posted to the control.
o The object that posted the event (always null).

Remarks:

If focus is lost to another item within the associated pop-up menu, the menu remains launched; otherwise, the menu is cancelled.


mouseExit

public boolean mouseExit(Event e, int x, int y);

Reacts to the mouse leaving the pop-up menu container by clearing any menu item that may be selected.

Return Value:

Returns true if the event was handled; otherwise, returns false.

ParameterDescription
e The event posted to the control.
x The x coordinate of the event.
y The y coordinate of the event.


timeTriggered

public void timeTriggered(TimerEvent te);

Launches or cancels the associated pop-up menu.

Return Value:

No return value.

ParameterDescription
te A TimerEvent object that describes the timer event.

Remarks:

This method implements timeTriggered in the TimerListener interface. timeTriggered is invoked when a menu item is selected or when focus is lost to an object other than an item in the pop-up menu.



Top© 1997 Microsoft Corporation. All rights reserved. Legal Notices.