xHarbour Reference Documentation > Class Reference (textmode) xHarbour Developers Network  

Popup()

Creates a new Popup menu object.

Syntax

PopUp():new( [<nTop>]   , ;
             [<nLeft>]  , ;
             [<nBottom>], ;
             [<nRight>]   ) --> oPopUpMenu

Arguments

<nTop> and <nLeft>
Numeric values indicating the screen coordinates for the upper left corner of the Popup menu. The default value for <nTop> and <nLeft> is -1. These values are assigned to the instance variables :top and :left.
<nBottom> and <nRight>
Numeric values indicating the screen coordinates for the lower right corner of the Popup menu. The default value for <nBottom> and <nRight> is -1. These values are assigned to the instance variables :bottom and :right.

Return

Function Popup() creates a new Popup menu object, and method :new() initializes the object.

Description

The Popup class provides objects maintaining pop-up or pull-down menus. After creation of a Popup object, one or more MenuItem() objects must be added with method :addItem(). They contain information on the menu items to display in a pop-up menu. A Popup menu object is made visible with its :open() method, which maintains a rectangular area on the screen where the menu items are displayed. The :close() method hides the menu.

Popup menu objects are designed to be integrated into a TopBarMenu() object for creating a complete menu system consisting of a horizontal top bar menu that includes a series of (nested) pull-down menus. If a Popup menu object is added to TopBarMenu object, the screen coordinates for the Popup menu are calculated automatically for proper display. In this case, no screen coordinates are required for method :new().

Note:  refer to the example of the TopBarMenu() class for using Popup menu objects.

Instance variables

:border
Character string for thesurrounding border.
:bottom
Numeric bottom screen row for display.
:cargo
Instance variable for user-defined purposes.
:colorSpec
Color string for the Popup menu display.
:current
Currently selected menu item.
:itemCount
Number of menu items.
:left
Numeric left screen column for display.
:right
Numeric right screen column for display.
:top
Numeric top screen row for display.
:width
Numeric width for display.

Menu item methods

:addItem( <oMenuItem> ) --> self
Adds a MenuItem object to a Popup menu object.
:delItem( <nItemPos> ) --> self
Deletes a MenuItem object from a Popup object.
:getFirst() --> nFirstMenuItemPos
Retrieves the ordinal position of the first selectable menu item.
:getItem( <nItemPos> ) --> oMenuItem
Retrieves a MenuItem object from a Popup object.
:getLast() --> nLastMenuItemPos
Retrieves the ordinal position of the last selectable menu item.
:getNext() --> nNextMenuItemPos
Retrieves the ordinal position of the next selectable menu item.
:getPrev() --> nPrevMenuItemPos
Retrieves the ordinal position of the previous selectable menu item.
:insItem( <nItemPos>, <oMenuItem> ) --> self
Inserts a MenuItem object into a Popup object.
:setItem( <nItemPos>, <oMenuItem> ) --> self
Replaces a MenuItem object in a Popup object.

Menu display and selection

:close() --> self
Hides a visible Popup menu.
:display() --> self
Displays a Popup menu.
:getAccel( <nKey> ) --> nMenuItemPos
Determines if a key code identifies an accelerator key.
:getShortct( <nKey> ) --> mMenuItemPos
Determines if a key code identifies a shortcut key.
:hitTest( <nMouseRow>, <nMouseCol> ) --> nMenuItemPos
Checks if a menu item is clicked with the mouse.
:isOpen() --> lIsOpen
Checks if a Popup menu is visible.
:open() --> self
Opens a Popup menu.
:select( <nItemPos> ) --> nMenuItemPos
Changes the currently selected menu item.

Info

See also:@...GET, MenuItem(), MenuModal(), TopBarMenu(), SetColor()
Category: Get system , Object functions
Header:Box.ch, Button.ch
Source:rtl\tpopup.prg
LIB:xhb.lib
DLL:xhbdll.dll


Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe