Possible another Submenu from METRO SUBmenu-button ?

Possible another Submenu from METRO SUBmenu-button ?

Postby ukoenig » Thu Jun 04, 2015 10:26 am

Hello,

is it possible to define a SUBMENU from a metro menubutton `
I can display the submenu, but there is still something wrong.

I would like to start the SUBMENU from menu 2 < Index - button >

Ok I can move the Index-button to the MAIN-page and call menu 3,
but would like a SUBMENU-solution.

Image

The STRUCTURE i'm using for the moment

DEFINE METROPANEL oMetro OF oWnd TITLE "Stammdaten" ;
COLOR nWText, CLR_BLUE
oMetro:oFont := oFontLarge
oMetro:lDesignMode := .T.
oMetro:nMetroTop = 160
oMetro:nMetroMargin := 50
oMetro:nBtnSize = 120
oMetro:nMetroRows := 8
...
...
DEFINE METROBUTTON oSBtn[31] OF oMetro ;
COLOR nMText3A, nMColor3 ;
CAPTION "&Service" ;
ALIGN "TOPLEFT" ;
GROUP 3 ;
BITMAP c_Pfad1 + "Service.bmp" ;
BMPALIGN "MIDDLECENTER" ;
SIZE 50, 50 ;
MENU SERVICE(oWnd,oMetro)
oSBtn[31]:nClrCaption := nMText3B
oSBtn[31]:oFont := oFontSmall
oSBtn[31]:oTextFont := oFontTiny
...
...
oMetro:Show()

RETURN NIl

// ----

STATIC FUNCTION SERVICE(oWnd,oMetro)
LOCAL oBtn[20], oBrush

IF oMenu2 == nil
DEFINE METROPANEL oMenu2 OF oWnd TITLE "Service" ;
COLOR nWText, CLR_GREEN ;
ON CLICK ( oMenu2:HIDE(), oMetro:Show() )
oMenu2:oFont := oFontLarge

oBrush := WD_BACKGRD( oMenu2, nWStyle, nWColorF, nWColorB, lWDirect, nWGradPos, cWBrush, cWImage )
oMenu2:SetBrush( oBrush )
oBrush:End()
...
...
DEFINE METROBUTTON oSBtn[72] OF oMenu2 ;
COLOR nMText6B, nMColor6 ;
CAPTION "Index" ;
ALIGN "TOPLEFT" ;
GROUP 1 ;
BITMAP c_Pfad1 + "Index.bmp" ;
BMPALIGN "MIDDLECENTER" ;
SIZE 50, 50 ;
BODYTEXT "Neuaufbau" ;
TEXTALIGN "BOTTOMCENTER" ;
ACTION NEUINDEX(oWnd,oMetro) // SUBMENU ????
oSBtn[72]:nClrCaption := nMText6A
oSBtn[72]:oFont := oFontSmall
oSBtn[72]:oTextFont := oFontTiny
...
...
ELSE
oMenu2:SHOW()
ENDIF

oMenu2:bRClicked := {|| oMenu2:HIDE(), oMetro:Show() }

RETURN oMenu2

// -----

STATIC FUNCTION NEUINDEX(oWnd,oMetro)
???
???



best regards
Uwe :?:
Last edited by ukoenig on Fri Jun 05, 2015 11:14 am, edited 4 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Possible to define a Submenu from METRO menu-button ?

Postby nageswaragunupudi » Thu Jun 04, 2015 12:24 pm

Please see \fwh\samples\metrptst.prg.
Please build and test.

This is the only one program that shows all capabilities of metropanel including submenus.

This sample program also works as a simple tutor.

I also hope you are aware that metropanel has a built-in designer and program generator. You do not need to write the code yourself.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10308
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Possible to define a Submenu from METRO menu-button ?

Postby ukoenig » Thu Jun 04, 2015 2:10 pm

The needed solution is not included in the sample < metrptst.prg >

I found a solution, to create a new menu from a submenu-button ( NOT startpage )
and to change the buttonsize as well :

Image

called from submenu-button < Index >

STATIC FUNCTION NEUINDEX(oWnd)
LOCAL oBtn[30], oBrush, oMetro1

oMenu2:HIDE() // Menu 2 of oMetro

DEFINE METROPANEL oMetro1 OF oWnd TITLE "Index - Aufbau" ;
COLOR nWText, CLR_BLUE
oMetro1:oFont := oFontLarge
oMetro1:lDesignMode := .F.
oMetro1:nMetroTop = 160
oMetro1:nMetroMargin := 50
oMetro1:nBtnSize = 80
oMetro1:nMetroRows := 8

oWnd:bMouseWheel = { | nKey, nDelta, nXPos, nYPos | oMetro1:MouseWheel( nKey, nDelta, nXPos, nYPos ) }

oBrush := WD_BACKGRD( oMetro1, nWStyle, nWColorF, nWColorB, lWDirect, nWGradPos, cWBrush, cWImage )
oMetro1:SetBrush( oBrush )
oBrush:End()
...
...
oMetro1:SHOW() // new PANEL called from oMetro menu 2 Button < Index >

oMetro1:bRClicked := {|| oMetro1:END(), oMenu2:Show() } // back to Menu 2 of oMetro

RETURN NIL

best regards
Uwe :)
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 32 guests