How to set font to menu?

Just starting out? Need help? Post your questions and find answers here.
SkyManager
Enthusiast
Enthusiast
Posts: 339
Joined: Tue Jan 30, 2007 5:47 am
Location: Hong Kong

How to set font to menu?

Post by SkyManager »

I have tried to use setGadgetFont() to change the font.
It works for the List but NOT the menu

Code: Select all

If CreatePopupMenu(2)
  MenuItem(1, "Cut")
  MenuItem(2, "Copy")
  MenuItem(3, "Paste")
  MenuBar()
  OpenSubMenu("Options")
    MenuItem(4, "Window...")
    MenuItem(5, "Gadget...")
  CloseSubMenu()
  MenuBar()
  MenuItem( 6, "Quit")
EndIf
If OpenWindow(0, 100, 100, 300, 260, "PureBasic - PopupMenu Example")
  ListIconGadget(1, 10, 10, 280, 240, "Tools", 200)
    AddGadgetItem(1, -1, "Hammer")
    AddGadgetItem(1, -1, "Screwdriver")
	If LoadFont(3, "Arial", 20)
      SetGadgetFont(2, FontID(3))
      SetGadgetFont(1, FontID(3))
  EndIf
    Repeat
    Select WaitWindowEvent()
      Case #PB_Event_Gadget
        If EventGadget() = 1 And EventType() = #PB_EventType_RightClick
          DisplayPopupMenu(2, WindowID(0))
        EndIf
      Case #PB_Event_Menu
        Select EventMenu()  ; To see which menu has been selected
          Case 1 ; Cut
            MessageRequester("PureBasic", "Cut", 0)
          Case 2 ; Copy
            MessageRequester("PureBasic", "Copy", 0)
          Case 3 ; Paste
            MessageRequester("PureBasic", "Paste", 0)
          Case 6 ; Quit
            Quit = 1
        EndSelect
      Case #PB_Event_CloseWindow
        Quit = 1
    EndSelect
  Until Quit = 1
EndIf
End 
Does anybody give me any clue?
User avatar
RSBasic
Moderator
Moderator
Posts: 1228
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: How to set font to menu?

Post by RSBasic »

Image
Image
SkyManager
Enthusiast
Enthusiast
Posts: 339
Joined: Tue Jan 30, 2007 5:47 am
Location: Hong Kong

Re: How to set font to menu?

Post by SkyManager »

That is complicated.
Does PB have any simple and direct API for it?
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4953
Joined: Sun Apr 12, 2009 6:27 am

Re: How to set font to menu?

Post by RASHAD »

- Any Font
- Any Size
- Any Color

Windows only

Code: Select all

Global i.ICONINFO,curHnd

i\fIcon = #True
LoadFont(0,"MS Sans Serif",16,#PB_Font_Bold)

Procedure SetImage(Menu, index, ico,Text$ ,Color)
CreateImage(10, 120, 30 ,32,#PB_Image_Transparent)
hdc = StartDrawing(ImageOutput(10))
  Box(0,0,120,30,$FFFFFF)
  DrawingMode(#PB_2DDrawing_Transparent )
  DrawingFont(FontID(0))
  DrawText(34,2,Text$,Color)
StopDrawing()

i\hbmMask = ImageID(10)
i\hbmColor = ImageID(10)
curHnd = CreateIconIndirect_(i)

ExtractIconEx_("shell32.dll", ico, 0, @iIcon, 1)
im=CreateImage(#PB_Any, 120, 30,32,#PB_Image_Transparent )
StartDrawing(ImageOutput(im))
  DrawImage(iIcon, 6, 8)
  DrawImage(curHnd, 0, 0)
StopDrawing()
  SetMenuItemBitmaps_(Menu,index,#MF_BYPOSITION, ImageID(im),0)
  DestroyIcon_(iIcon)
EndProcedure

OpenWindow(0, 0, 0, 600, 300, "TEST",#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_SizeGadget)

hMenu = CreatePopupMenu(0)
		MenuItem(0,"")
		MenuItem(1,"")
		sMenu = OpenSubMenu("")
		MenuItem(2,"")
		MenuItem(3,"")
		MenuItem(4,"")
		MenuItem(5,"")
CloseSubMenu()                    

SetImage(hMenu, 0, 4,"Load",$FF0000)
SetImage(hMenu, 1, 130,"Save As",$00FF00)
SetImage(hMenu, 2, 194,"Options",$0000FF)
SetImage(sMenu, 0,4,"Test #1",$EC07F4)
SetImage(sMenu, 1, 43,"Test #2",$EC07F4)
SetImage(sMenu, 2, 10,"Test #3",$EC07F4)
SetImage(sMenu, 3, 90,"Test #4",$EC07F4)

Repeat
    Select WaitWindowEvent()
 
      Case #PB_Event_RightClick
            DisplayPopupMenu(0, WindowID(0))   

      Case #PB_Event_Menu
        Select EventMenu()
          Case 0 : Debug "MenuItem #0"
          Case 1 : Debug "MenuItem #1"
          Case 2 : Debug "MenuItem #2"
          Case 3 : Debug "MenuItem #3"
          Case 4 : Debug "MenuItem #4"
          Case 5 : Debug "MenuItem #5"
          Case 6 : Debug "MenuItem #6"
        EndSelect
       
      Case #PB_Event_CloseWindow
        Quit = 1
       
    EndSelect
Until Quit = 1
Egypt my love
SkyManager
Enthusiast
Enthusiast
Posts: 339
Joined: Tue Jan 30, 2007 5:47 am
Location: Hong Kong

Re: How to set font to menu?

Post by SkyManager »

Thanks Rashad, I have tried your codes which is interesting.
User avatar
Michael Vogel
Addict
Addict
Posts: 2806
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Re: How to set font to menu?

Post by Michael Vogel »

Tried to simplify Rashad's code to allow large text only (without icons), but it seems that I have removed also some important things, now it doesn't work as expected :|

The first time, the text looks (nearly) smooth, but when the menu will be displayed multiple times it looks horrible - so the only enhancement I was able to do use the right hand side of the menu to display shortcuts now...

Code: Select all

#MenuFont=0
#MenuImage=100
#MenuWidth=100
#MenuHeight=30
#MenuOffsetX=4
#MenuOffsetY=-5
#MenuColor=$7B5857
#DrawOpaque=$FF000000

LoadFont(#MenuFont,"Segoe UI",-24,#PB_Font_HighQuality)

Procedure MenuText(menu,index,text.s)

	CreateImage(#MenuImage+index,#MenuWidth,#MenuHeight,32,#PB_Image_Transparent)
	StartDrawing(ImageOutput(#MenuImage+index))
	;DrawingMode(#PB_2DDrawing_AllChannels|#PB_2DDrawing_Transparent)
	DrawingMode(#PB_2DDrawing_AllChannels)
	;DrawingMode(#PB_2DDrawing_Default)
	;Box(0,0,#MenuWidth>>1,#MenuHeight,#White)
	;Box(#MenuWidth>>1,0,#MenuWidth>>1,#MenuHeight,#DrawOpaque|#White)
	DrawingFont(FontID(#MenuFont))
	DrawText(#MenuOffsetX,#MenuOffsetY,text,#DrawOpaque|#MenuColor,0)
	StopDrawing()
	SetMenuItemBitmaps_(menu,index,#MF_BYPOSITION,ImageID(#MenuImage+index),0)

EndProcedure

OpenWindow(0,0,0,600,300,"TEST",#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_SizeGadget)

Menu=CreatePopupMenu(0)
For i=0 To 5
	MenuItem(i,#TAB$+"F"+Chr(i+'1'))
	MenuText(Menu,i,StringField("Load.Save.Love.Run.: ).Quit",i+1,"."))
Next i
MenuText(Menu,2,"Changed")

DisplayPopupMenu(0,WindowID(0))

Repeat
	Select WaitWindowEvent()
	Case #PB_Event_RightClick
		DisplayPopupMenu(0,WindowID(0))
	Case #PB_Event_Menu
		Debug "Menu "+Str(EventMenu())+" clicked..."
	Case #PB_Event_CloseWindow
		quit=1
	EndSelect
Until quit
User avatar
doctorized
Addict
Addict
Posts: 882
Joined: Fri Mar 27, 2009 9:41 am
Location: Athens, Greece

Re: How to set font to menu?

Post by doctorized »

RASHAD wrote:- Any Font
- Any Size
- Any Color

Windows only

....
Hi RASHAD!
I tried you code with using my own icons. The result was no so good.
The code:

Code: Select all

Global i.ICONINFO,curHnd

Enumeration
	#MainWindow
	#MainMenu
	#menu_sxol_etos
	#menu_mathimata
	#menu_mathites
	#menu_test
	#menu_settings
	#menu_save
	#menu_create_backup
	#menu_restore_backup
	#menu_exit	
EndEnumeration

i\fIcon = #True
LoadFont(0,"MS Sans Serif",16,#PB_Font_Bold)

Procedure SetImage(Menu, index, ico,Text$ ,Color)
CreateImage(10, 500, 30 ,32,#PB_Image_Transparent)
hdc = StartDrawing(ImageOutput(10))
  Box(0,0,500,30,$FFFFFF)
  DrawingMode(#PB_2DDrawing_Transparent )
  DrawingFont(FontID(0))
  DrawText(34,2,Text$,Color)
StopDrawing()

i\hbmMask = ImageID(10)
i\hbmColor = ImageID(10)
curHnd = CreateIconIndirect_(i)
;ExtractIconEx_("shell32.dll", ico, 0, @iIcon, 1)
iIcon = ico
im=CreateImage(#PB_Any, 500, 30,32,#PB_Image_Transparent )
StartDrawing(ImageOutput(im))
  DrawImage(iIcon, 6, 8)
  DrawImage(curHnd, 0, 0)
StopDrawing()
  SetMenuItemBitmaps_(Menu,index,#MF_BYPOSITION, ImageID(im),0)
  DestroyIcon_(iIcon)
EndProcedure

OpenWindow(#MainWindow, 0, 0, 600, 300, "TEST",#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_SizeGadget)
ButtonGadget(35,0,0,60,25,"test")
;hMenu = CreatePopupMenu(0)
;		
;      MenuItem(0,"")
;      MenuItem(1,"")
;      sMenu = OpenSubMenu("")
;      MenuItem(2,"")
;      MenuItem(3,"")
;      MenuItem(4,"")
;      MenuItem(5,"")
;CloseSubMenu()                   

;SetImage(hMenu, 0, 4,"Load",$4F0000)
;SetImage(hMenu, 1, 130,"Save As",$00FF00)
;SetImage(hMenu, 2, 194,"Options",$0000FF)
;SetImage(sMenu, 0,4,"Test #1",$EC07F4)
;SetImage(sMenu, 1, 43,"Test #2",$EC07F4)
;SetImage(sMenu, 2, 10,"Test #3",$EC07F4)
;SetImage(sMenu, 3, 90,"Test #4",$EC07F4)

hMenu = CreatePopupMenu(#MainMenu)
      MenuItem(#menu_sxol_etos, "")
		MenuItem(#menu_mathimata, "")
		MenuItem(#menu_mathites, "")
		MenuItem(#menu_test, "")
		MenuBar()
		MenuItem(#menu_settings, "")
		MenuItem(#menu_save, "")
		MenuItem(#menu_create_backup, "")
		MenuItem(#menu_restore_backup, "")
		MenuBar()
		MenuItem(#menu_exit,"")      
	;If CreateImageMenu(#MainMenu, WindowID(#MainWindow))
		YearIcon = CatchImage(#PB_Any, ?YearStart, ?YearEnd - ?YearStart)
		LessonsIcon = CatchImage(#PB_Any, ?LessonsStart, ?LessonsEnd - ?LessonsStart)
		StudentsIcon = CatchImage(#PB_Any, ?StudentsStart, ?StudentsEnd - ?StudentsStart)
		GradesIcon = CatchImage(#PB_Any, ?GradesStart, ?GradesEnd - ?GradesStart)
		SettingsIcon = CatchImage(#PB_Any, ?SettingsStart, ?SettingsEnd - ?SettingsStart)
		ReportsIcon = CatchImage(#PB_Any, ?ReportsStart, ?ReportsEnd - ?ReportsStart)
		BackUpIcon = CatchImage(#PB_Any, ?BackUpStart, ?BackUpEnd - ?BackUpStart)
		RestoreIcon = CatchImage(#PB_Any, ?RestoreStart, ?RestoreEnd - ?RestoreStart)
		ExitIcon = CatchImage(#PB_Any, ?ExitStart, ?ExitEnd - ?ExitStart)
		
		SetImage(hMenu, #menu_sxol_etos, ImageID(YearIcon), "This is long text",$FF0000)
		SetImage(hMenu, #menu_mathimata, ImageID(LessonsIcon),"This is longer text",$FF0000)
		SetImage(hMenu, #menu_mathites, ImageID(StudentsIcon),"An other long text",$FF0000)
		SetImage(hMenu, #menu_test, ImageID(GradesIcon),"Some very very very very very long text",$FF0000)
		SetImage(hMenu, #menu_settings, ImageID(SettingsIcon),"some text",$FF0000)
		SetImage(hMenu, #menu_save, ImageID(ReportsIcon),"some text",$FF0000)
		SetImage(hMenu, #menu_create_backup, ImageID(BackUpIcon),"some very long text here",$FF0000)
		SetImage(hMenu, #menu_restore_backup, ImageID(RestoreIcon),"some text here also",$FF0000)
		SetImage(hMenu, #menu_exit, ImageID(ExitIcon),"Exit",$FF0000)

Repeat
    Select WaitWindowEvent()
 
      Case #PB_Event_RightClick
            DisplayPopupMenu(0, WindowID(0))   

      Case #PB_Event_Menu
        Select EventMenu()
          Case 0 : Debug "MenuItem #0"
          Case 1 : Debug "MenuItem #1"
          Case 2 : Debug "MenuItem #2"
          Case 3 : Debug "MenuItem #3"
          Case 4 : Debug "MenuItem #4"
          Case 5 : Debug "MenuItem #5"
          Case 6 : Debug "MenuItem #6"
        EndSelect
       
      Case #PB_Event_CloseWindow
        Quit = 1
      Case #PB_Event_Gadget
    	Select EventGadget()
    		Case 35
    			X = WindowX(#MainWindow)
				Y = WindowY(#MainWindow)
    			DisplayPopupMenu(#MainMenu,WindowID(0),X+4,Y+53)
    		Default
    			Debug EventGadget()
    	EndSelect
    EndSelect
 Until Quit = 1
 
 DataSection
;menu
	YearStart:
		IncludeBinary "icons\years.ico"
	YearEnd:
	LessonsStart:
		IncludeBinary "icons\lessons.ico"
	LessonsEnd:
	StudentsStart:
		IncludeBinary "icons\students.ico"
	StudentsEnd:
	GradesStart:
		IncludeBinary "icons\test.ico"
	GradesEnd:
	SettingsStart:
		IncludeBinary "icons\settings.ico"
	SettingsEnd:
	ReportsStart:
		IncludeBinary "icons\reports.ico"
	ReportsEnd:	
	BackUpStart:
		IncludeBinary "icons\backup.ico"
	BackUpEnd:
	RestoreStart:
		IncludeBinary "icons\restore.ico"
	RestoreEnd:
	ExitStart:
		IncludeBinary "icons\exit.ico"
		ExitEnd:
EndDataSection
The result:
http://users.sch.gr/arahiotis/other/menu.png
Any help to fix it would be appreciated.
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4953
Joined: Sun Apr 12, 2009 6:27 am

Re: How to set font to menu?

Post by RASHAD »

Hi doctorized
Change to :

Code: Select all

Enumeration
   #MainWindow
   #MainMenu
EndEnumeration

Enumeration
   #menu_sxol_etos
   #menu_mathimata
   #menu_mathites
   #menu_test
   #menu_settings
   #menu_save
   #menu_create_backup
   #menu_restore_backup
   #menu_exit   
EndEnumeration
Egypt my love
User avatar
doctorized
Addict
Addict
Posts: 882
Joined: Fri Mar 27, 2009 9:41 am
Location: Athens, Greece

Re: How to set font to menu?

Post by doctorized »

RASHAD wrote:Hi doctorized
Change to :

Code: Select all

....
This helped a little. MenuBars are not shown and the first MenuBar() leads to #Menu_settings disapperance. It seems that #Menu_Seetings appear on the bottom with no image and text.
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4953
Joined: Sun Apr 12, 2009 6:27 am

Re: How to set font to menu?

Post by RASHAD »

Hi

Code: Select all

Global i.ICONINFO,curHnd

i\fIcon = #True
LoadFont(0,"MS Sans Serif",16,#PB_Font_Bold)

Procedure SetMenuBar(Menu, index, ico,Text$ ,Color)
  im=CreateImage(#PB_Any, 120, 1 ,32);,#PB_Image_Transparent)
  hdc = StartDrawing(ImageOutput(im))
  Box(0,0,120,1,Color)
  StopDrawing()
  SetMenuItemBitmaps_(Menu,index,#MF_BYPOSITION, ImageID(im),0)
EndProcedure

Procedure SetImage(Menu, index, ico,Text$ ,Color)
  CreateImage(10, 120, 30 ,32,#PB_Image_Transparent)
  hdc = StartDrawing(ImageOutput(10))
  Box(0,0,120,30,$FFFFFF)
  DrawingMode(#PB_2DDrawing_Transparent )
  DrawingFont(FontID(0))
  DrawText(34,2,Text$,Color)
  StopDrawing()
  
  i\hbmMask = ImageID(10)
  i\hbmColor = ImageID(10)
  curHnd = CreateIconIndirect_(i)
  
  ExtractIconEx_("shell32.dll", ico, 0, @iIcon, 1)
  im=CreateImage(#PB_Any, 120, 30,32,#PB_Image_Transparent )
  StartDrawing(ImageOutput(im))
  DrawImage(iIcon, 6, 8)
  DrawImage(curHnd, 0, 0)
  StopDrawing()
  SetMenuItemBitmaps_(Menu,index,#MF_BYPOSITION, ImageID(im),0)
  DestroyIcon_(iIcon)
EndProcedure

OpenWindow(0, 0, 0, 600, 300, "TEST",#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_SizeGadget)

hMenu = CreatePopupMenu(0)
MenuItem(0,"")
MenuItem(1,"")
MenuItem(2,"")
sMenu = OpenSubMenu("")
MenuItem(2,"")
MenuItem(3,"")
MenuItem(4,"")
MenuItem(5,"")
CloseSubMenu()
DisableMenuItem(0,2, 1)


SetImage(hMenu, 0, 4,"Load",$FF0000)
SetImage(hMenu, 1, 130,"Save As",$00FF00)
SetMenuBar(hMenu,2, 0,"",$878789)
SetImage(hMenu, 3, 194,"Options",$0000FF)
SetImage(sMenu, 0,4,"Test #1",$EC07F4)
SetImage(sMenu, 1, 43,"Test #2",$EC07F4)
SetImage(sMenu, 2, 10,"Test #3",$EC07F4)
SetImage(sMenu, 3, 90,"Test #4",$EC07F4)

Repeat
  Select WaitWindowEvent()
      
    Case #PB_Event_RightClick
      DisplayPopupMenu(0, WindowID(0))   
      
    Case #PB_Event_Menu
      Select EventMenu()
        Case 0 : Debug "MenuItem #0"
        Case 1 : Debug "MenuItem #1"
        Case 2 : Debug "MenuItem #2"
        Case 3 : Debug "MenuItem #3"
        Case 4 : Debug "MenuItem #4"
        Case 5 : Debug "MenuItem #5"
        Case 6 : Debug "MenuItem #6"
      EndSelect
      
    Case #PB_Event_CloseWindow
      Quit = 1
      
  EndSelect
Until Quit = 1
Egypt my love
User avatar
doctorized
Addict
Addict
Posts: 882
Joined: Fri Mar 27, 2009 9:41 am
Location: Athens, Greece

Re: How to set font to menu?

Post by doctorized »

RASHAD wrote:Hi

Code: Select all

......
This is exactly what I need! Thank you very much!
User avatar
doctorized
Addict
Addict
Posts: 882
Joined: Fri Mar 27, 2009 9:41 am
Location: Athens, Greece

Re: How to set font to menu?

Post by doctorized »

If I have a second menu on the same window (one menu on the left upper corner and one by right clicking on a button) then I have problem with the second menu.
If every menu has its own enumeration, then by clicking any element of the second menu, runs the code from the corresponding item of the first menu.
If the two menus share the same enumeration, then the second menu is blank, no text no image appears.
What should I do?
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4953
Joined: Sun Apr 12, 2009 6:27 am

Re: How to set font to menu?

Post by RASHAD »

Hi

Code: Select all

Global i.ICONINFO,curHnd ,hMenu,hMenu1,menuflag

i\fIcon = #True
LoadFont(0,"MS Sans Serif",16,#PB_Font_Bold)

Procedure SetMenuBar(Menu, index, ico,Text$ ,Color)
  im=CreateImage(#PB_Any, 120, 1 ,32);,#PB_Image_Transparent)
  hdc = StartDrawing(ImageOutput(im))
  Box(0,0,120,1,Color)
  StopDrawing()
  SetMenuItemBitmaps_(Menu,index,#MF_BYPOSITION, ImageID(im),0)
EndProcedure

Procedure SetImage(Menu, index, ico,Text$ ,Color)
  CreateImage(10, 120, 30 ,32,#PB_Image_Transparent)
  hdc = StartDrawing(ImageOutput(10))
  Box(0,0,120,30,$FFFFFF)
  DrawingMode(#PB_2DDrawing_Transparent )
  DrawingFont(FontID(0))
  DrawText(34,2,Text$,Color)
  StopDrawing()
 
  i\hbmMask = ImageID(10)
  i\hbmColor = ImageID(10)
  curHnd = CreateIconIndirect_(i)
 
  ExtractIconEx_("shell32.dll", ico, 0, @iIcon, 1)
  im=CreateImage(#PB_Any, 120, 30,32,#PB_Image_Transparent )
  StartDrawing(ImageOutput(im))
  DrawImage(iIcon, 6, 8)
  DrawImage(curHnd, 0, 0)
  StopDrawing()
  SetMenuItemBitmaps_(Menu,index,#MF_BYPOSITION, ImageID(im),0)
  DestroyIcon_(iIcon)
EndProcedure

Procedure winCB(hWnd, uMsg, wParam, lParam)
  Result = #PB_ProcessPureBasicEvents 
  Select uMsg
    Case #WM_INITMENUPOPUP
        If wParam = hMenu
          menuflag = 0
        ElseIf wParam = hMenu1
          menuflag = 1
        EndIf  
  EndSelect
  ProcedureReturn result
EndProcedure

OpenWindow(0, 0, 0, 600, 300, "TEST",#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_SizeGadget)

hMenu = CreatePopupMenu(0)
MenuItem(0,"")
MenuItem(1,"")
MenuItem(2,"")
sMenu = OpenSubMenu("")
MenuItem(2,"")
MenuItem(3,"")
MenuItem(4,"")
MenuItem(5,"")
CloseSubMenu()
DisableMenuItem(0,2, 1)

hMenu1 = CreatePopupMenu(1)
MenuItem(0,"")
MenuItem(1,"")
MenuItem(2,"")

SetImage(hMenu, 0, 4,"Load",$FF0000)
SetImage(hMenu, 1, 130,"Save As",$00FF00)
SetMenuBar(hMenu,2, 0,"",$878789)
SetImage(hMenu, 3, 194,"Options",$0000FF)
SetImage(sMenu, 0,4,"Test #1",$EC07F4)
SetImage(sMenu, 1, 43,"Test #2",$EC07F4)
SetImage(sMenu, 2, 10,"Test #3",$EC07F4)
SetImage(sMenu, 3, 90,"Test #4",$EC07F4)

SetImage(hMenu1, 0, 4,"1-Load #1",$FF0000)
SetImage(hMenu1, 1, 4,"1-Test #2",$FF0000)
SetImage(hMenu1, 2, 4,"1-Test #3",$FF0000)

ButtonGadget(1,10,270,60,20,"Run 1")
ButtonGadget(2,80,270,60,20,"Run 2")

SetWindowCallback(@winCB())
Repeat
  Select WaitWindowEvent()     
     
    Case #PB_Event_Menu
      Select EventMenu()

        Case 0 : Debug "Menu :"+Str(menuflag)+" item 0"
        Case 1 : Debug "Menu :"+Str(menuflag)+" item 1"
        Case 2 : Debug "Menu :"+Str(menuflag)+" item 2"
        Case 3 : Debug "Menu :"+Str(menuflag)+" item 3"
        Case 4 : Debug "Menu :"+Str(menuflag)+" item 4"
        Case 5 : Debug "Menu :"+Str(menuflag)+" item 5"
        Case 6 : Debug "Menu :"+Str(menuflag)+" item 6"
      EndSelect
      
    Case #PB_Event_Gadget
      Select EventGadget()
        Case 1
          DisplayPopupMenu(0, WindowID(0),WindowX(0)+50,WindowY(0)+50)
        
        Case 2
          DisplayPopupMenu(1, WindowID(0),WindowX(0)+400,WindowY(0)+50)
      EndSelect
     
    Case #PB_Event_CloseWindow
      Quit = 1
     
  EndSelect
Until Quit = 1
Egypt my love
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: How to set font to menu?

Post by IdeasVacuum »

It might actually be easier to DIY your menu in HTML, depending on complexity.... or if a simple drop-down menu with no sub-menus, a Listview or ListIcon in a borderless window.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
doctorized
Addict
Addict
Posts: 882
Joined: Fri Mar 27, 2009 9:41 am
Location: Athens, Greece

Re: How to set font to menu?

Post by doctorized »

RASHAD wrote:Hi

Code: Select all

......
I used the same code and didn't work. Today, I realized that I was using MenuBar() and not MenuItem(#menu_bar_3,"") for the bar. I feel so stupid.
IdeasVacuum wrote:It might actually be easier to DIY your menu in HTML, depending on complexity.... or if a simple drop-down menu with no sub-menus, a Listview or ListIcon in a borderless window.
Sounds very interesting! Let's say I have the html menu with the css needed. How can I show it?

EDIT: I noticed that the icons are not shown as they should be. If I pass the mouse over the items, then the images are corrected.
See the image:http://users.sch.gr/arahiotis/menu2.png
I passed the mouse over the two first items. See their difference with the latest two items.
Post Reply