FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Radio Onchange evaluated twice
Posts: 190
Joined: Tue Mar 14, 2006 01:59 AM
Radio Onchange evaluated twice
Posted: Fri Apr 17, 2009 05:43 AM
Hello all,

Code (fw): Select all Collapse
REDEFINE RADIO oRad VAR nRad ID 163 , 170 , 171 ;                                
                             ON CHANGE Test(@nRad,@oRad) ;
                             OF oFld:oDlg

Looks like Test() get evaluated twice: each time with the same nRad value. I'd like to perform a check and then eventually restore the old radio value if the check fails (just once)

Any idea ?

Thanks,
Davide
FWH 9.04 - xH 1.2.1 - Bcc 5.5
Posts: 190
Joined: Tue Mar 14, 2006 01:59 AM
Re: Radio Onchange evaluated twice - In Folders
Posted: Fri Apr 17, 2009 08:14 AM
ok, the problem is only inside folders.
TestRad.prg works correctly, while TestFold.prg shows the problem below ( I've just changed MsgBeep() - that's heard just once - with Test() )
How can this be solved ?

TIA
Davide
Code (fw): Select all Collapse
// Testing FiveWin own folders controls support

#include "FiveWin.ch"
#include "Folder.ch"

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

function Main()

   local oDlg, oFld, oCbx, oSay
   local nValue := 2, oChk, lChk := .t.
   local cItem, oImageList

   SET _3DLOOK ON

   DEFINE DIALOG oDlg RESOURCE "Test"

   REDEFINE FOLDER oFld ID 110 OF oDlg ;
      PROMPT "Cli&pper", "&and", "&Windows", "&Magic" ;
      DIALOGS "Sub1", "Sub2"

   oFld:aEnable = { .t., .t., .f., .f. }
   
   REDEFINE COMBOBOX oCbx VAR cItem ITEMS { "This", "is", "a test" } ;
      ID 100 OF oFld:aDialogs[ 1 ]

   REDEFINE CHECKBOX oChk VAR lChk ID 92 OF oFld:aDialogs[ 1 ] ON CHANGE MsgBeep()

   REDEFINE SAY oSay ID 10 OF oFld:aDialogs[ 1 ] PROMPT "Test" COLOR "R+/B"

   REDEFINE BUTTON ID 110 OF oFld:aDialogs[ 1 ] ;   // Redefining a child
      ACTION oChk:SetText( Time() )

   REDEFINE BUTTON ID 120 OF oFld:aDialogs[ 1 ] ;
      ACTION DoBrowse()
      
   REDEFINE BITMAP ID 130 OF oFld:aDialogs[ 1 ] ;
      FILE "..\bitmaps\question.bmp" TRANSPARENT

   REDEFINE RADIO nValue ID 110, 120, 130 OF oFld:aDialogs[ 2 ] ;
      ON CHANGE Test(nValue) // MsgBeep()

   REDEFINE BUTTON ID 104 OF oFld:aDialogs[ 2 ] ;   // Redefining a child
      ACTION oFld:SetPrompts( { "one", "two", "three", "four" } )

   REDEFINE BUTTON ID 120 OF oDlg ;
      ACTION oDlg:End()

   oFld:aDialogs[ 1 ]:bRClicked = { || MsgInfo( "page 1" ) }
   oFld:aDialogs[ 2 ]:bRClicked = { || MsgInfo( "page 2" ) }

   ACTIVATE DIALOG oDlg CENTERED ;
      VALID MsgYesNo( "Want to end ?" ) ;
      ON INIT SetImages( oDlg, oFld )

return nil

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

function DoBrowse()

   USE Customer
   Browse()
   USE

return nil

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

function SetImages( oDlg, oFld )

   local oImageList
   
   DEFINE IMAGELIST oImageList SIZE 16, 16
   
   oImageList:AddMasked( TBitmap():Define( "new",,    oDlg ), nRGB( 192, 192, 192 ) )    
   oImageList:AddMasked( TBitmap():Define( "open",,   oDlg ), nRGB( 192, 192, 192 ) )    
   oImageList:AddMasked( TBitmap():Define( "search",, oDlg ), nRGB( 192, 192, 192 ) )    
   oImageList:AddMasked( TBitmap():Define( "print",,  oDlg ), nRGB( 192, 192, 192 ) )    
   
   oFld:SetImageList( oImageList )
   
return nil   

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

procedure AppSys  // Xbase++ requirement

return

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

Function Test(nValue)
? nValue
Return nil
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Radio Onchange evaluated twice
Posted: Fri Apr 17, 2009 10:56 PM
Davide,

This is a temporary workaround meanwhile we fix it:
Code (fw): Select all Collapse
   REDEFINE RADIO nValue ID 110, 120, 130 OF oFld:aDialogs[ 2 ] ;
      ON CHANGE Test( nValue )

Code (fw): Select all Collapse
function Test( nValue )

   if Upper( ProcName( 6 ) ) == "TRADIO:CLICK"
      MsgInfo( nValue )
   endif   

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 190
Joined: Tue Mar 14, 2006 01:59 AM
Re: Radio Onchange evaluated twice
Posted: Sat Apr 18, 2009 01:06 AM
Antonio,
Antonio Linares wrote:This is a temporary workaround

it's ok for now.
Thank you,
Davide

Continue the discussion