Page 1 of 1

Menu and Popupmenu

Posted: Fri Oct 19, 2007 8:21 pm
by Thomas II
Hello,
im new here in this forum (usually I'm in the German Forum) ... :)

Do you know how I can create a Menu and a Popupmenu like the PB-Editor?

(with Icons and bigger)

Posted: Sat Jan 19, 2008 4:29 am
by Hroudtwolf
Hi,

Such menus are only possible if you create it by using API.

Example:

Code: Select all

; Author: Hroudtwolf
; Date: 19. January 2008
; OS: Windows
; Demo: No

OpenWindow(0, 100, 150, 195, 260, "Menu with icons")

CreateMenu(0, WindowID(0))
MenuTitle("File")
   MenuItem( 1, "&Load...")
   MenuItem( 2, "Save")
   MenuItem( 3, "Save As...")

; Use a bitmap-handle instead of "LoadBitmap_()"
SetMenuItemBitmaps_(MenuID(0) , 1 , #MF_BYCOMMAND , LoadBitmap_(#Null , #OBM_COMBO) , LoadBitmap_(#Null , #OBM_CHECK)) 
SetMenuItemBitmaps_(MenuID(0) , 2 , #MF_BYCOMMAND , LoadBitmap_(#Null , #OBM_CLOSE) , LoadBitmap_(#Null , #OBM_CHECK)) 
SetMenuItemBitmaps_(MenuID(0) , 3 , #MF_BYCOMMAND , LoadBitmap_(#Null , #OBM_ZOOM) , LoadBitmap_(#Null , #OBM_CHECK)) 

Repeat
 Select WaitWindowEvent()
   Case #PB_Event_CloseWindow
   End
 EndSelect
ForEver
Best regards

Wolf

Posted: Sat Jan 19, 2008 11:37 am
by Trond
CreateImageMenu()

Posted: Sat Jan 19, 2008 1:41 pm
by Hroudtwolf
You are living in the future ^^.
This function isn't available in the current stable version.
It is just availabe in purebasic 4.2x.


Best regards

Wolf

Posted: Sat Jan 19, 2008 4:59 pm
by Fluid Byte
LoadBitmap_() is limited to 16x16 images. If want to use larger images or icons you need to go for owner draw menus. There are plenty of examples on the forum.