| Field | Type | R/W | Default |
|
|
|
|
| BackColor | LONG | RW | clMenu |
| Set the
color of the Menu item background
|
| Count | INTEGER | R | |
| Count returns the number of images
used
|
| DisabledColor | LONG | RW | system
default |
| Color of a
disabled Menu Item
|
| ForeColor | INTEGER | R | system
default |
|
Set the color of the Menu item text
|
| HighLightColor | LONG | R | system
default |
| Color when
the mouse highlights Menu Item
|
| HighLightTextColor | LONG | R | True |
| Font | QFONT | R/W | |
| Use the
SetFontSize Method for size
|
| FontSize | INTEGER | RW | |
| You will
need to set ownerDraw properties to all QMenuItems in order to work
consistently
|
| Height | INTEGER | R/W | auto | W |
| Outline | INTEGER | RW | False |
| specifies an
outline drawn around the Menu image
|
| Transparent | INTEGER | RW | True |
| Specifies whether the
image on the menu contains transparent or non-transparent images.
|
| TransparentColor | INTEGER | RW | 0 |
| The color in the
image that will be transparent
|
| Width | INTEGER | RW | |
| Method | Type | Params |
|
|
|
|
AddBMPFile
| SUB (MenuItem AS QMENUITEM, FileName$) | 1 |
|
Add BMP file to the menu item
|
|
AddICOFile
| SUB (MenuItem AS
QMENUITEM, FileName$) | 1 |
|
Add icon resource handle, must be followed by
an AddDescription command
|
|
AddDescription
| SUB (MenuItem AS
QMENUITEM,
descript AS STRING) | 1 |
| Give a sub-caption to each
QMenuItem, ie, update this string in a status bar in a OnMouseHover event
No bitmap will be assigned.
|
|
DelBitmap
| SUB (Menuitem as Qmenuitem) | 1 |
| delete
an image from the sub-menuitem of the Parent menu
|
| MenuModify | SUB
(MenuItem AS QMENUITEM, Image AS QBITMAP, description AS
STRING) | 4 |
| Add Subitems to MenuItem
|
|
Parent
| SUB (TheMenuParent AS
QMENUITEM) | 1 |
| Images
can only be assigned to sub-menuitems. Use this to specify the Parent menu
|
| Init | SUB
(Form AS QFORM) | 1 |
| The
parent form. with the menus. You MUST specify the QFORM
|
| Close | VOID
stop
drawing bitmaps and free up memory | 0 |
QMenuEx Example$INCLUDE "RapidQ2.inc"
$RESOURCE New_bmp as "\rapidQ\icon\New.bmp"
$RESOURCE Open_bmp as "\rapidQ\icon\Open.bmp"
$RESOURCE Save_bmp as "\rapidQ\icon\Save.bmp"
$RESOURCE Exit_bmp as "\rapidQ\icon\Exit.bmp"
$RESOURCE Cut_bmp as "\rapidQ\icon\Cut.bmp"
$RESOURCE Copy_bmp as "\rapidQ\icon\Copy.bmp"
$RESOURCE Paste_bmp as "\rapidQ\icon\Paste.bmp"
$RESOURCE Empty_bmp as "\rapidQ\icon\Empty.bmp"
Declare Sub FormClose (Action As integer)
Declare Sub NewItemClick (Sender As QMENUITEM)
Declare Sub ExitItemClick (Sender As QMENUITEM)
Declare SUB MnuShowDescription(Xpos AS LONG, Ypos AS LONG, Descript AS STRING)
CREATE Form2 As QFORM
Caption = "New Form"
Width = 200
Height = 100
Center
END CREATE
CREATE Form As QForm
Width = 400
Center
Caption = "Ownerdraw Menus"
onClose = FormClose
CREATE MainMenu As QMainMenu
CREATE FileMenu As QMenuItem
Caption = "&File"
CREATE NewItem As QMenuItem
Caption = "&New"
Hint = "New"
onclick = NewItemClick
END CREATE
CREATE OpenItem As QMenuItem
Caption = "&Open..."
Hint = "Open"
ShortCut = "Ctrl+O"
END CREATE
CREATE SaveItem As QMenuItem
Caption = "&Save"
Hint = "Save"
END CREATE
CREATE SaveASItem As QMenuItem
Caption = "Sa&ve as..."
Hint = "Save as"
END CREATE
CREATE BreakItem As QMenuItem
Caption = "-"
END CREATE
CREATE ExitItem As QMenuItem
Caption = "E&xit"
onclick = ExitItemClick
END CREATE
END CREATE
CREATE EditMenu As QMenuItem
Caption = "&Edit"
CREATE CutItem As QMenuItem
Caption = "&Cut Ctrl+X"
ShortCut = "Ctrl+X"
END CREATE
CREATE CopyItem As QMenuItem
Caption = "&Copy Ctrl+C"
END CREATE
CREATE PasteItem As QMenuItem
Caption = "&Paste Ctrl+V"
Checked = true 'no effect with bmp
END CREATE
END CREATE
CREATE SearchMenu As QMenuItem
Caption = "&Search"
CREATE FindItem As QMenuItem
Caption = "&Find"
END CREATE
CREATE ReplaceItem As QMenuItem
Caption = "&Replace"
END CREATE
END CREATE
END CREATE
CREATE StatusBar As QStatusBar
AddPanels "QMenuEx Demo",""
panel(0).Width = 170
END CREATE
END CREATE
DIM pic AS QIMAGE
DIM MenuX as QMenuEx
WITH MenuX
.Transparent = False 'default is True
.Parent(FileMenu)
pic.bmphandle= New_bmp
.MenuModify NewItem, pic, "Creates a new document"
pic.BMPhandle= Open_bmp
.MenuModify OpenItem, pic, "Opens a Document"
pic.BMPhandle= Save_bmp
.MenuModify SaveItem, pic, "Save Document"
.MenuModify SaveAsItem, pic, "Save Document as"
pic.BMPhandle= Exit_bmp
.MenuModify ExitItem, pic, "Exits Program"
.Parent(EditMenu)
pic.BMPhandle= Cut_bmp
.MenuModify CutItem, pic, "Cuts Selection to Clipboard"
pic.BMPhandle= Copy_bmp
.MenuModify CopyItem, pic, "Copies Selection to Clipboard"
pic.BMPhandle= Paste_bmp
.MenuModify PasteItem, pic, "Pastes Contents of Clipboard"
.Parent (SearchMenu)
.AddDescription FindItem, "Search for a text string"
.AddDescription ReplaceItem, "Replace a character string by another"
.OnMouseHover = MnuShowDescription
' ** Add effects, best if all items have a bmp assigned
' .FontSize = 12
' .BackColor = RGB(32, 32, 255)
' .ForeColor = RGB(255, 255, 32)
'default is to draw transparently, use this for no transparency
.Init Form 'must do this to work
END WITH
Form.ShowModal
SUB MnuShowDescription(Xpos AS LONG, Ypos AS LONG, Descript AS STRING)
StatusBar.Panel(1).Caption = Descript
END SUB
SUB NewItemClick (Sender AS QMENUITEM)
Form2.ShowModal
end Sub
SUB ExitItemClick (Sender AS QMENUITEM)
Form.close
end Sub
sub FormClose (Action as integer)
MenuX.Close
end Sub