FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Radio and GTF problem
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Radio and GTF problem
Posted: Tue Mar 28, 2017 09:29 AM
It seems, that the codeblock ::bchange on radios evaluated twice when changing the radiooption!
Please try oRadio:bchange := {||msginfo("Changed")}

In the meanwhile i found, that this only appears, if in the function of the codeblock a call to another dialog are present. (msginfo(),..).
A bPainted-call of the parent-window??

I have removed Eval( ::bChange, Self ) in method refresh() from TRadmenu-class. But this is only a hack.
Antonio?


Another problem with GTF!
Without commenting out the 2 lines in the following code-snippet from METHOD SetFormat( oFont, nColor ) CLASS TFGet the current font are destroyed!

Code (fw): Select all Collapse
      if lIsFont
//         DeleteObject( oFont:hFont )
//         oFont:hFont := oOldFont:hFont
         ::hFont := oOldFont:hFont
      else
         AAdd( ::aFonts, oFont )
         ::hFont := oFont:hFont
      endif
Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Re: Radio and GTF problem
Posted: Fri Apr 07, 2017 12:59 PM

Antonio, please take a look at this!

Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Radio and GTF problem
Posted: Fri Apr 07, 2017 04:07 PM

Günther,

Thanks for the reminder, as I missed this post from you

> In the meanwhile i found, that this only appears, if in the function of the codeblock a call to another dialog are present. (msginfo(),..).
A bPainted-call of the parent-window??

Surely it is related to the focus. Those functions change the focus

Could you provide a small and self contained example PRG to reproduce it ? many thanks

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Radio and GTF problem
Posted: Fri Apr 07, 2017 04:11 PM

I have modified samples\testrad.prg with this:

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

and it only appears once

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Re: Radio and GTF problem
Posted: Fri Apr 07, 2017 06:17 PM

Antonio, i have made inside my program a simple dialog with only a radio with 5 items and a button. ON CHANGE of the radio call a msginfo(). This msginfo are showing a second one if i close the first one!
WIN 10??

Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Radio and GTF problem
Posted: Sat Apr 08, 2017 05:03 AM
byte-one wrote:Antonio, i have made inside my program a simple dialog with only a radio with 5 items and a button. ON CHANGE of the radio call a msginfo(). This msginfo are showing a second one if i close the first one!
WIN 10??

Can you provide a sample please?
Regards



G. N. Rao.

Hyderabad, India
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Re: Radio and GTF problem
Posted: Sun Apr 09, 2017 09:04 AM
Antonio, Mr Nages, there are a test!
The problem is only present if the dialog is child! The main window calls the refresh() and in this refresh() is bChange calling. Maybe other controls also affected!

Code (fw): Select all Collapse
function Main()
    local oWin

    DEFINE WINDOW oWin TITLE "Testrad"
    ACTIVATE WINDOW oWin ON INIT rad(oWin)

return NIL

function rad(oWin)
   local oDlg, oRadMenu, oBrush
   local nOption := 2

   DEFINE DIALOG oDlg RESOURCE "Radios" OF oWin

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

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

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

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

return nil
Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Radio and GTF problem
Posted: Sun Apr 09, 2017 09:32 AM

Günther,

Please make this change in Class TRadio:

METHOD Click() INLINE ::oRadMenu:Select( Self ), ::Super:Click() // ::oRadMenu:Refresh()

that seems to solve it

Many thanks for the example

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Re: Radio and GTF problem
Posted: Sun Apr 09, 2017 10:27 AM

Antonio, not the right way! The double call is take away but some radio-buttons stay checked if gonext() and goprev() and click on a radio-button with mouse!

Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Radio and GTF problem
Posted: Sun Apr 09, 2017 04:47 PM

How to reproduce it ?

Please provide instructions or a video, many thanks

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Re: Radio and GTF problem
Posted: Sun Apr 09, 2017 05:41 PM
Please change the example to this one and click on next/prev. You see, no reaction from the radio-Buttons. In some cases more then one button is checked if i click with the mouse.
Code (fw): Select all Collapse
function Main()
    local oWin

    DEFINE WINDOW oWin TITLE "Testrad"
    ACTIVATE WINDOW oWin ON INIT rad(oWin)

return NIL

function rad(oWin)
   local oDlg, oRadMenu, oBrush
   local nOption := 2

   DEFINE DIALOG oDlg RESOURCE "Radios" OF oWin

   REDEFINE RADIO oRadMenu VAR nOption ID 110, 120, 130, 140, 150 OF oDlg ON CHANGE Msginfo(Eval( oRadmenu:bSetGet ))

   REDEFINE BUTTON ID 100 OF oDlg ACTION oRadMenu:GoNext()

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

   ACTIVATE DIALOG oDlg

return nil
Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Radio and GTF problem
Posted: Sun Apr 09, 2017 10:22 PM
This method has to be modified this way:

Code (fw): Select all Collapse
METHOD Refresh() CLASS TRadMenu

   local nOption := Eval( ::bSetGet )
   local nAt     := AScan( ::aItems, { | oRadio | If( oRadio != nil, oRadio:lIsChecked(), .f. ) } )

   DEFAULT nOption := 1

   if nAt != nOption .and. nAt <= Len( ::aItems ) .and. Len( ::aItems ) > 0
      if nAt != 0
         ::aItems[ nAt ]:SetCheck( .f. )
      endif
      if ::aItems[ nOption ] != nil
         ::aItems[ nOption ]:SetCheck( .t. )
      endif
      // if ::bChange != nil                 no needed
      //    Eval( ::bChange, Self )
      // endif
   endif

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Re: Radio and GTF problem
Posted: Mon Apr 10, 2017 01:26 AM
Antonio, thanks! To run next/prev, this change is required! Tested with my last sample.

Code (fw): Select all Collapse
METHOD GoPrevNext( lNext ) CLASS TRadMenu

   local nMove:= 0
   local nOption:= ::nOption

   DEFAULT lNext:= .F.

   while ! ( nMove > Len( ::aItems ) )
      nMove++

      if lNext
         nOption++
         nOption = If( nOption > Len(::aItems), 1, nOption )
      else
         nOption--
         nOption = If( nOption < 1, Len(::aItems), nOption )
      endif

      if ::aItems[ nOption ]:lWhen()
         ::nOption = nOption
     ::refresh(  )       //NEW
         exit
      endif

   enddo

//   if nOption != ::nOption
     //::SetOption( nOption )
//   endif

return Self
Regards,
Günther
---------------------------------
office@byte-one.com

Continue the discussion