Radio Onchange evaluated twice

Radio Onchange evaluated twice

Postby Davide » Fri Apr 17, 2009 5:43 am

Hello all,

Code: Select all  Expand view
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
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Re: Radio Onchange evaluated twice - In Folders

Postby Davide » Fri Apr 17, 2009 8: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: Select all  Expand view
// 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

 
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Re: Radio Onchange evaluated twice

Postby Antonio Linares » Fri Apr 17, 2009 10:56 pm

Davide,

This is a temporary workaround meanwhile we fix it:
Code: Select all  Expand view

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

Code: Select all  Expand view

function Test( nValue )

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

return nil
 
regards, saludos

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

Re: Radio Onchange evaluated twice

Postby Davide » Sat Apr 18, 2009 1:06 am

Antonio,
Antonio Linares wrote:This is a temporary workaround

it's ok for now.
Thank you,
Davide
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 79 guests