Menu dinâmico HMG Extended

Projeto MiniGui - Biblioteca visual para Harbour/xHarbour

Moderador: Moderadores

Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

Menu dinâmico HMG Extended

Mensagem por JoséQuintas »

Só pra não perder o fonte.... rs

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()

Código: Selecionar todos


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
hmge.png
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/JoseQuin ... a_menu.prg
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

Menu dinâmico HMG Extended

Mensagem por JoséQuintas »

Meu hbp, incluindo coisas pra testes:
test.prg
menu.prg
test.rc
-otest
hmge.hbc
-lxhb
-gtwvg
-lhbwin
-mt
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

Menu dinâmico HMG Extended

Mensagem por JoséQuintas »

Faltou acrescentar.....
Como é meu menu de sempre, então a configuração de senhas/acessos já está pronta.
O menu vai ser conforme a senha do usuário.

Uma próxima etapa é acrescentar um elemento no array para o ícone, isso se a HMGE aceitar resource.
Provavelmente vai ser outra caçada em manuais, changelog, fontes, perguntas no fórum, etc. pra ver se isso é possível....
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
MSDN
Usuário Nível 4
Usuário Nível 4
Mensagens: 741
Registrado em: 28 Nov 2003 15:55
Localização: CWB
Contato:

Menu dinâmico HMG Extended

Mensagem por MSDN »

Aceita resource sim, basta indicar o nome da imagem exatamente como definido no arquivo .rc
Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

Menu dinâmico HMG Extended

Mensagem por JoséQuintas »

Porque não já fazer logo 5 menus independentes de uma vez..... rs

Notas:
Acho que só usei meus HBP/HBC e a HMGE normal
Vai abrir uma encima da outra, precisa movimentar as janelas pra ver todas.
Harbour 3.4 + mingw 7.1 + HMGE 17.12
Não que exista utilidade prática pra vários menus.... rs
Precisa das imagens na pasta do EXE, pelo menos por enquanto
menu.png
test.zip
(779.87 KiB) Baixado 149 vezes
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

Menu dinâmico HMG Extended

Mensagem por JoséQuintas »

Pra ficar bom...

Só falta algum expert em HMG me dizer porque 5 janelas exatamente iguais, numa delas não funciona o ESC.

A menos que coloque o foco, tire o foco, coloque o foco... aí sim, o ESC funciona....
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Responder