Does someone know how to open the attached popup menu with a click on the button.
(Like in WORD Button: “Formatvorlagen”)
Regards,
Otto
DEFINE BUTTON OF oBar NOBORDER ;
PROMPT 'SubMenu' ;
MENU MyPopUp() ;
ACTION MsgInfo('Can have action and also submenu')
....
....
// -------------------
STATIC FUNCTION MyPopUp()
LOCAL oPop
MENU oPop POPUP
MENUITEM 'One'
MENUITEM 'Two'
ENDMENU
RETURN oPop
METHOD ShowPopup() CLASS TBtnBmp
local oWnd
if ::oPopup != nil
if ::oWnd:oWnd != nil .and. Upper( ::oWnd:oWnd:Classname() ) == "TBAR"
oWnd := ::oWnd:oWnd
else
oWnd := ::oWnd
endif
if GetClassName( GetParent( Self:hWnd ) ) != "TBAR"
oWnd = oWndFromhWnd( GetParent( Self:hWnd ) )
endif
oWnd:NcMouseMove() // close the tooltip
oWnd:oPopup = ::oPopup
::oPopup:Activate( ::nTop + ::nHeight(), ::nLeft, oWnd, .f. )
oWnd:oPopup = nil
::Refresh()
endif
return nil
MENU oPopup POPUP
MENUITEM "One" ACTION MsgInfo( 1 )
MENUITEM "Two" ACTION MsgInfo( 2 )
ENDMENU
DEFINE BUTTON oBtn OF oBar ACTION oBtn:ShowPopup() ;
RESOURCE "people" PROMPT "Clients" GROUP ;
MENU oPopup
@ 5, 145 ADD BUTTON oBtnBearbeiten GROUP oFunktionen BITMAP ".\bitmaps2\11.bmp" MENU oMenuBearbeiten ;
SIZE 65, 75 PROMPT "Bearbeiten" SPLITPOPUP TOP ROUND ;
ACTION ( oBtnBearbeiten:ShowPopup() )
DEFINE BUTTON OF oBar ;
RESOURCE "REPORT" TOP ;
PROMPT "Report" ;
MENU ReportMenu( oBrw ) ;
ACTION This:ShowPopUp() ;
MESSAGE "Print the browse contents" ;
TOOLTIP { "Print Report", "Report" }
case ::nTypeButton == TYPE_SPLITPOPUP
if nRow >= ::nPopupMargin .or. ! lAction
oWnd := ::oWnd
oWnd:NcMouseMove() // close the tooltip
oWnd:oPopup = ::oPopup
::oPopup:Activate( ::nHeight, 0, Self, .F. )
oWnd:oPopup = nil
::Refresh()
else
::click()
endif
case ::nTypeButton == TYPE_POPUP
if nCol >= ::nPopupMargin .or. !lAction
oWnd := ::oWnd
oWnd:NcMouseMove() // close the tooltip
oWnd:oPopup = ::oPopup
::oPopup:Activate( ::nHeight, 0, Self, .F. )
oWnd:oPopup = nil
::Refresh()
else
::click()
endif
METHOD ShowPopup() CLASS TRBtn
local oWnd
msginfo("asdfla")
if ::oPopup != nil
if GetClassName( GetParent( Self:hWnd ) ) != "TBAR"
oWnd = oWndFromhWnd( GetParent( Self:hWnd ) )
endif
oWnd:NcMouseMove() // close the tooltip
oWnd:oPopup = ::oPopup
::oPopup:Activate( ::nTop + ::nHeight(), ::nLeft - oWnd:nLeft + 500, oWnd, .f. )
oWnd:oPopup = nil
::Refresh()
endif
return nil
//----------------------------------------------------------------------------//
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 76 guests