Menu dinâmico em HMG Extended.
Igual fazia em Clipper, igual faço em GTWVG texto, igual faço em GTWVG GUI, igual fiz com HWGUI, mesmo fonte de opções....
Ficou fonte grande porque é infinito... rs
Como CreateMenu() já existe na HMGE, tive que renomear pra MerdaCreateMenu()
MEMVAR fonte_Menu
#include 'minigui.ch'
FUNCTION Main()
LOCAL oMenu // aColors, oMenu
SET AUTOADJUST ON
SET DELETED ON
SET DATE BRITISH
SET CENTURY ON
SET EPOCH TO 1960
SET BROWSESYNC ON
SET TOOLTIPBALLOON ON
SET NAVIGATION EXTENDED
SET CODEPAGE TO portuguese
SET LANGUAGE TO portuguese
define font font_1 fontname 'tahoma' size 10
fonte_menu := GetFontHandle('font_1')
SET MENUSTYLE EXTENDED
SET MENUCURSOR FULL
SET MENUSEPARATOR SINGLE RIGHTALIGN
SET MENUITEM BORDER 3D
DEFINE WINDOW form_main;
width 1024 ;
height 768 ;
title 'TESTE';
windowtype main;
backcolor {0,0,0}
SET CENTERWINDOW RELATIVE DESKTOP
DEFINE IMAGE img_wallpaper
row 000
col 000
height 768
width 1024
picture hb_cwd() + 'wallpaper.jpg'
stretch .T.
END IMAGE
DEFINE MAIN MENU OF form_main
OMenu := MenuCria()
MerdaCreateMenu( oMenu, 1 )
END MENU
ON KEY ESCAPE ACTION thiswindow.release
END WINDOW
CENTER WINDOW form_main
form_main.activate
RETURN NIL
FUNCTION MerdaCreateMenu( oMenu, nLevel )
LOCAL oElement
FOR EACH oElement IN oMenu
IF Len( oElement[ 2 ] ) > 0
IF nLevel == 1
DEFINE POPUP oElement[ 1 ]
ELSE
DEFINE POPUP oElement[ 1 ] image hb_cwd() + "jose.bmp"
ENDIF
MerdaCreateMenu( oElement[ 2 ], nLevel + 1 )
END POPUP
ELSE
IF nLevel == 1
MENUITEM oElement[ 1 ] ACTION NIL font fonte_menu
ELSE
MENUITEM oElement[ 1 ] ACTION NIL font fonte_menu image hb_cwd() + 'jose.bmp'
ENDIF
ENDIF
NEXT
RETURN NIL
A criação das opções que não estão no fonte:
É o meu fonte de sempre....
A LIB tem que trabalhar pra mim, e não eu trabalhar pra ela....
https://github.com/JoseQuintas/JoseQuintas/blob/master/source/jpa_menu.prg