Buttonbar 2007 button with a attached Popup menu

Buttonbar 2007 button with a attached Popup menu

Postby Otto » Wed Oct 24, 2007 7:24 pm

Does someone know how to open the attached popup menu with a click on the button.
(Like in WORD Button: “Formatvorlagen”)
Regards,
Otto
User avatar
Otto
 
Posts: 6330
Joined: Fri Oct 07, 2005 7:07 pm

Postby nageswaragunupudi » Wed Oct 24, 2007 11:12 pm

Code: Select all  Expand view
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
Regards

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

Postby Otto » Thu Oct 25, 2007 7:20 am

nageswaragunupudi , thank you for your answer.
But that is the code how to attach a popup menu.

But I need to open the attached popup menu with a click on the button.
(Like in WORD Button: “Formatvorlagen”)

Here a jpg:
ImageImage
User avatar
Otto
 
Posts: 6330
Joined: Fri Oct 07, 2005 7:07 pm

Postby Antonio Linares » Thu Oct 25, 2007 9:22 am

Otto,

Please add this method to class TBtnBmp:
Code: Select all  Expand view
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

To use it, simply do:
Code: Select all  Expand view
   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
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42082
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Otto » Thu Oct 25, 2007 1:46 pm

Thank you, Antonio.
It is working.
Regards,
Otto
User avatar
Otto
 
Posts: 6330
Joined: Fri Oct 07, 2005 7:07 pm

Re: Buttonbar 2007 button with a attached Popup menu

Postby Otto » Wed Apr 07, 2010 8:53 am

Hello Antonio,
I have seen that popup is included in 10.3. Thank you.
How can I align the popup menu if I use oBtn:ShowPopup()?

Best regards,
Otto

Code: Select all  Expand view
@ 5, 145 ADD BUTTON oBtnBearbeiten   GROUP oFunktionen BITMAP  ".\bitmaps2\11.bmp"  MENU oMenuBearbeiten ;
            SIZE 65,  75 PROMPT "Bearbeiten" SPLITPOPUP  TOP ROUND   ;
            ACTION ( oBtnBearbeiten:ShowPopup() )


Image

Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6330
Joined: Fri Oct 07, 2005 7:07 pm

Re: Buttonbar 2007 button with a attached Popup menu

Postby Antonio Linares » Wed Apr 07, 2010 9:53 am

Otto,

I don't exactly understand what you mean
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42082
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Buttonbar 2007 button with a attached Popup menu

Postby nageswaragunupudi » Wed Apr 07, 2010 11:10 am

Mr Antonio.
ShowPopup was already there in the FWH long time back.

This kind of code was working since many versions of FWH. I think we do not need to add the above code again:
The code below is an extract from testxbr3.prg:
Code: Select all  Expand view
  DEFINE BUTTON OF oBar ;
      RESOURCE "REPORT" TOP ;
      PROMPT "Report" ;
      MENU ReportMenu( oBrw ) ;
      ACTION This:ShowPopUp() ;
      MESSAGE "Print the browse contents" ;
      TOOLTIP { "Print Report", "Report" }
 
Regards

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

Re: Buttonbar 2007 button with a attached Popup menu

Postby Otto » Wed Apr 07, 2010 3:39 pm

Hello Antonio,
Best regards,
Otto


Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6330
Joined: Fri Oct 07, 2005 7:07 pm

Re: Buttonbar 2007 button with a attached Popup menu

Postby Antonio Linares » Wed Apr 07, 2010 9:01 pm

Otto,

Does it fit in the right side ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42082
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Buttonbar 2007 button with a attached Popup menu

Postby Otto » Wed Apr 07, 2010 9:29 pm

Antonio,
yes it fits in the right side.

Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6330
Joined: Fri Oct 07, 2005 7:07 pm

Re: Buttonbar 2007 button with a attached Popup menu

Postby Antonio Linares » Thu Apr 08, 2010 10:25 am

Otto,

Then it means that the left coordinate of the popup is wrongly calculated.

We are going to review it, thanks :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42082
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Buttonbar 2007 button with a attached Popup menu

Postby Daniel Garcia-Gil » Thu Apr 08, 2010 10:30 pm

Hello Otto...

in METHOD LButtonUp( nRow, nCol ) CLASS TRBtn

find and replace this section...
Code: Select all  Expand view


                  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
 
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: Buttonbar 2007 button with a attached Popup menu

Postby Otto » Fri Apr 09, 2010 6:54 am

Hello Daniel,

thank you for your help.
I did a short test but the code does not resolve my problem.
If I change as well showpopup() (left + 500) this way I would get the right alignment – only for this special case.

Thanks in advance
Otto




Code: Select all  Expand view
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

//----------------------------------------------------------------------------//
 
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6330
Joined: Fri Oct 07, 2005 7:07 pm

Re: Buttonbar 2007 button with a attached Popup menu

Postby Otto » Sun Apr 11, 2010 7:50 pm

Hello Daniel,
Would you be so kind to have another look at this problem?
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6330
Joined: Fri Oct 07, 2005 7:07 pm

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Silvio.Falconi and 123 guests