Menu and Popupmenu

Windows specific forum
Thomas II
User
User
Posts: 17
Joined: Tue Oct 16, 2007 3:47 pm
Location: Germany
Contact:

Menu and Popupmenu

Post 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)
User avatar
Hroudtwolf
Addict
Addict
Posts: 803
Joined: Sat Feb 12, 2005 3:35 am
Location: Germany(Hessen)
Contact:

Post 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
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

CreateImageMenu()
User avatar
Hroudtwolf
Addict
Addict
Posts: 803
Joined: Sat Feb 12, 2005 3:35 am
Location: Germany(Hessen)
Contact:

Post 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
User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

Post 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.
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
Post Reply