FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Change Caption on Radio at Run Time?
Posts: 82
Joined: Fri Mar 03, 2006 06:26 PM
Change Caption on Radio at Run Time?
Posted: Wed Jul 02, 2014 03:32 PM

Hi All

When I use REDEFINE RADIO oObj VAR nType ID 131,133 the captions are stored in the resource file. Is it possible to change the two captions at runtime?

TIA
David

Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM
Re: Change Caption on Radio at Run Time?
Posted: Wed Jul 02, 2014 05:27 PM

oRadio:aItems[ 2 ]:SetText( "Hello" )

oRadio:aItems[ 2 ]:Refresh()

http://wiki.fivetechsoft.com/doku.php?i ... ass_tradio

Regards,

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM
Re: Change Caption on Radio at Run Time?
Posted: Wed Jul 02, 2014 05:52 PM
Code (fw): Select all Collapse
// Radio Buttons management sample - \samples\TESTRAD.PRG modified.

#include "FiveWin.ch"

//----------------------------------------------------------------------------//

function Main()

   local oDlg, oRadMenu, oBrush
   local nOption := 2

   SET _3DLOOK ON

   DEFINE DIALOG oDlg RESOURCE "Radios"

   REDEFINE RADIO oRadMenu VAR nOption ID 110, 120, 130, 140, 150 OF oDlg ;
            ON CHANGE SWAP_CAPTION( oRadMenu )

      //ON CHANGE MsgBeep()

   REDEFINE BUTTON ID 100 OF oDlg ACTION oRadMenu:GoNext() ;
      WHEN nOption == 3

   REDEFINE BUTTON ID 102 OF oDlg ACTION oRadMenu:GoPrev()

   ACTIVATE DIALOG oDlg CENTERED ;
      ON INIT oRadMenu:aItems[ 1 ]:SetText( "Hello" )

   SET _3DLOOK OFF

return nil

FUNCTION SWAP_CAPTION( oRadMenu )

   oRadMenu:aItems[4]:SetText( "Chang" )
   oRadMenu:aItems[4]:Refresh()

RETURN( .T. )

//----------------------------------------------------------------------------//

procedure AppSys  // XBase++ requirement

return

//----------------------------------------------------------------------------//
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 82
Joined: Fri Mar 03, 2006 06:26 PM
Re: Change Caption on Radio at Run Time?
Posted: Thu Jul 03, 2014 04:49 PM

Thanks for your help Karinha :)

I implemented it this way:

ACTIVATE DIALOG oDlg ON INIT (oObj[3]:aItems[1]:SetText("Rounds"), oObj[3]:aItems[1]:Refresh(), oDlg:Center(oMainWnd)) ;
  VALID (oFont:End(), SysRefresh(), .T.)

David

Continue the discussion