hwGui, ToolBar, Buttom DropDown Menu
Enviado: 17 Set 2023 22:19
Como criar menu DropDown na ToolBar (PANEL) ?

*Só encontrei opção de OWNERBUTTON para uso
Obg

*Só encontrei opção de OWNERBUTTON para uso
Obg
Em homenagem a Paulo Cesar Toledo
https://pctoledo.org/

Ajudou sim, agradeço a indicação.alxsts escreveu:Olá!
Veja se o tópico [...] ajuda.
Código: Selecionar todos
//ToolBar - Ok
@ 1,-1 TOOLBAR oToolBar SIZE hwg_Getdesktopwidth(), 72 STYLE WS_DLGFRAME + TBSTYLE_AUTOSIZE + TBSTYLE_TRANSPARENT
//Buttom - Não aparece
oToolBar:AddButton("Teste1",, 0, 16, "Teste 01" ,{|| Hwg_msginfo( 'ok' ) },'Mensagem Teste 01','', "oToolbutton1")
oToolBar:AddButton("Teste2",, 0, 16, "Teste 02" ,{|| Hwg_msginfo( 'ok, ok' ) },'Mensagem Teste 02','', "oToolbutton2")
/*
//DropDown - Não compila
oToolBar:AddButton("Teste3",, 4, 128, "Teste 03" ,,, {{"DropDown", 4,{|| Hwg_msginfo( 'ok 0' ) }};
,{"Opção 1", 5,{|| Hwg_msginfo( 'ok 1' ) };
,{"Opção 2", 7,{|| Hwg_msginfo( 'ok 2' } };
,{"Opção 3", 8,{|| Hwg_msginfo( 'ok 3' } };
,{"Opção 4", 9,{|| Hwg_msginfo( 'ok 4' } } };
, "oToolbutton3")
*/
Estranho isto. Há um tempo testei isto e funcionou perfeitamente em Windows + HWGui-2.23-b1 ou HWGui-2.23-b2. Não tenho mais o código...Ana Mitoooo escreveu:na versão 2.2.3 ( atual ) o recurso esta disponível somente para Linux via GTK
Na versão 2.17 esta habilitado também no Windows(Basso/Marcos Gambeta)
Código: Selecionar todos
#include "hwgui.ch"
Function main
Local oDlg, oBrw, oToolbar1
INIT DIALOG oDlg TITLE "TOOLBAR with clause MENU active" style DS_CENTER;
AT 0, 0 SIZE 800, 500 ;
FONT HFont():Add( "MS Sans Serif",0,-13 )
@ 0,0 TOOLBAR oToolbar1 ;
SIZE oDlg:nWidth,32 ;
STYLE WS_DLGFRAME + TBSTYLE_TRANSPARENT
TOOLBUTTON oToolbar1 ;
ID 701 ;
BITMAP "..\imagens\folder-red.bmp" ;
STATE 4 ;
TEXT "" ;
MENU {{"Despesas em Aberto por Fornecedor", 1,{| This, nId | HWG_MSGINFO('OK'), onDlgInit( ) }}} ;
TOOLTIP "Abrir o documento." ;
ON CLICK {|| hwg_msginfo('ok') }
oToolbar1:AddButton(0, , 4, 1, "" ,,,'', "oToolbuttonsep1")
TOOLBUTTON oToolbar1 ;
ID 701 ;
BITMAP "..\imagens\folder_yellow.BMP" ;
STATE 4;
TEXT "" ;
TOOLTIP "" ;
ON CLICK {|| oDlg:Close() }
oToolbar1:AddButton(0, , 4, 1, "" ,,,'', "oToolbuttonsep2")
ACTIVATE DIALOG oDlg
Return Nil
E fez esse exemplo:I never used this control and don't know how it works and what the MENU clause is. In my applications I use the PANEL and ownerbuttons instead.
If you need a menu, which appears after pressing a button, you may use the context menu, full example is in samples/testtree.prg.
You need to define a context menu:
CONTEXT MENU oMyMenu
MENUITEM "Item1" ACTION { || SomeFunc_1( ) }
MENUITEM "Item2" ACTION { || SomeFunc_2( ) }
ENDMENU
and then you can call it with a:
oMyMenu:Show( oWindow ),
where oWindow is any suitable window object.
Place this oMyMenu:Show( ) call into any ON CLICK, or to any other handler.
Regards, Alexander.
Código: Selecionar todos
#include "hwgui.ch"
Function Test
Local oDlg, oFont, oMenu
PREPARE FONT oFont NAME "MS Sans Serif" WIDTH 0 HEIGHT -13
INIT DIALOG oDlg TITLE "Modal dialog" AT 100, 100 SIZE 300, 150 FONT oFont
CONTEXT MENU oMenu
MENUITEM "Message" ACTION { || hwg_MsgInfo( 'Menu item "Message"' ) }
SEPARATOR
MENUITEM "Exit" ACTION { || oDlg:Close() }
ENDMENU
@ 4,4 BUTTON "Menu" SIZE 50,28 ON CLICK {|| oMenu:Show( oDlg ) }
@ 100,100 BUTTON "Close" SIZE 100,30 ON CLICK {|| oDlg:Close() }
ACTIVATE DIALOG oDlg
Return Nil
Windows 10,alxsts escreveu:Olá!
Você usa Windows ou Linux? Qual versão HwGUI? Incluiu na compilação o manifest? (na minha máquina está em C:\HwGUI-2.23-b2\samples\hwgui_xp.rc). Não sei se isto tem influência mas, em todo caso, teste.
Agradeço a todos que tentaram auxiliar no uso do recurso.Itamar M. Lins Jr. escreveu:Olá!
...
Então eu perguntei no SVN como fazer a FLAG MENU funcionar.
E o Kresin respondeu isso:I never used this control and don't know how it works and what the MENU clause is. In my applications I use the PANEL and ownerbuttons instead.