FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour RBBTN Passing a parameter to popup menu
Posts: 130
Joined: Sat Oct 08, 2005 09:38 PM
RBBTN Passing a parameter to popup menu
Posted: Fri Dec 25, 2015 01: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 (fw): Select all Collapse
#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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: RBBTN Passing a parameter to popup menu
Posted: Fri Dec 25, 2015 08:09 AM
Birol,

Do it this way:

Code (fw): Select all Collapse
#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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: RBBTN Passing a parameter to popup menu
Posted: Fri Dec 25, 2015 09:47 AM
Another way:

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


as

Code (fw): Select all Collapse
           MENU { || BuildPopup(nNum) } ;


Note: This works for versions later than 14.10
Regards



G. N. Rao.

Hyderabad, India
Posts: 130
Joined: Sat Oct 08, 2005 09:38 PM
Re: RBBTN Passing a parameter to popup menu
Posted: Sat Dec 26, 2015 01:13 AM

Thanks for your kind help.

Birol Betoncu
birol.betoncu@gmail.com
Using Harbour, FWH 19.05, BCC7

Continue the discussion