RBBTN Passing a parameter to popup menu

RBBTN Passing a parameter to popup menu

Postby betoncu » Fri Dec 25, 2015 1:14 am

Is it possible to pass a parameter to the popup menu which is changed dynamically during the run time.
See the example below. Changing the value of nNum has no effect.
Best regards,

Code: Select all  Expand view
#include "FiveWin.ch"
#include "Ribbon.ch"

function Main()
local oDlg, oBtn, nNum:=10

   DEFINE DIALOG oDlg FROM 5, 5 TO 15, 40 TITLE "Testing RBBTN Popup Menu"

   @ 1, 3 GET nNum OF oDlg PICTURE '9999'

   @ 30, 5 RBBTN oBtn OF oDlg POPUP ;
           SIZE 90,29 PIXEL ;
           PROMPT "Class TRBtn" ;
           MENU BuildPopup(nNum) ;  
           ROUND BORDER ;
           BITMAP "..\bitmaps\16x16\fivetech.bmp" LEFT

   ACTIVATE DIALOG oDlg CENTERED
return nil

function BuildPopup(nNum)
local oPopup
   MENU oPopup POPUP 2007
      MENUITEM "Multiply by 10" ACTION MsgInfo( nNum*10 )
      MENUITEM "Multiply by 20" ACTION MsgInfo( nNum*20 )
      MENUITEM "Multiply by 30" ACTION MsgInfo( nNum*30 )
   ENDMENU
return oPopup      
 
Birol Betoncu
birol.betoncu@gmail.com
Using Harbour, FWH 19.05, BCC7
User avatar
betoncu
 
Posts: 126
Joined: Sat Oct 08, 2005 9:38 pm
Location: Cyprus (North)

Re: RBBTN Passing a parameter to popup menu

Postby Antonio Linares » Fri Dec 25, 2015 8:09 am

Birol,

Do it this way:

Code: Select all  Expand view
#include "FiveWin.ch"
#include "Ribbon.ch"

static nNum := 10

function Main()
local oDlg, oBtn

   DEFINE DIALOG oDlg FROM 5, 5 TO 15, 40 TITLE "Testing RBBTN Popup Menu"

   @ 1, 3 GET nNum OF oDlg PICTURE '9999'

   @ 30, 5 RBBTN oBtn OF oDlg POPUP ;
           SIZE 90,29 PIXEL ;
           PROMPT "Class TRBtn" ;
           MENU BuildPopup() ;  
           ROUND BORDER ;
           BITMAP "..\bitmaps\16x16\fivetech.bmp" LEFT

   ACTIVATE DIALOG oDlg CENTERED
return nil

function BuildPopup()
local oPopup
   MENU oPopup POPUP 2007
      MENUITEM "Multiply by 10" ACTION MsgInfo( nNum*10 )
      MENUITEM "Multiply by 20" ACTION MsgInfo( nNum*20 )
      MENUITEM "Multiply by 30" ACTION MsgInfo( nNum*30 )
   ENDMENU
return oPopup
regards, saludos

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

Re: RBBTN Passing a parameter to popup menu

Postby nageswaragunupudi » Fri Dec 25, 2015 9:47 am

Another way:

In the original sample, please change this line:
Code: Select all  Expand view
          MENU BuildPopup(nNum) ;  
 


as

Code: Select all  Expand view
          MENU { || BuildPopup(nNum) } ;  
 


Note: This works for versions later than 14.10
Regards

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

Re: RBBTN Passing a parameter to popup menu

Postby betoncu » Sat Dec 26, 2015 1:13 am

Thanks for your kind help.
Birol Betoncu
birol.betoncu@gmail.com
Using Harbour, FWH 19.05, BCC7
User avatar
betoncu
 
Posts: 126
Joined: Sat Oct 08, 2005 9:38 pm
Location: Cyprus (North)


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 117 guests