Problem with TCalendar class in Change Method

Problem with TCalendar class in Change Method

Postby Maurizio » Wed Oct 27, 2021 8:34 am

Hello Antonio
I ran into a problem in Change Method .
Code: Select all  Expand view

METHOD Change() CLASS TCalendar

   local aTmp
   
   static dOldDate, dOldDate2

   if ::bChange != nil
      if ::lMultiselect
         aTmp = ::GetDateRange()
         if dOldDate != aTmp[ 1 ] .or. dOldDate2 != aTmp[ 2 ]
            Eval( ::bChange, Self )
            dOldDate  = aTmp[ 1 ]
            dOldDate2 = aTmp[ 2 ]
         endif
      else
         if dOldDate != ::GetDate()
            Eval( ::bChange, Self )
            dOldDate = ::GetDate()
           
         endif
      endif
   endif
return nil
 


I have a dialog with a CALENDAR
The problem is
Code: Select all  Expand view

static dOldDate
 

The first time I open the dialog bChange it works because dOldDate is nil
If I reopen the dialog bChange it doesn't work because dOldDate remains the same as before

I solved it by creating a variable and deleting dOldDate , I dont use ::lMultiselect
Code: Select all  Expand view


DATA _dOldDate

METHOD Change() CLASS TCalendar

   local aTmp
   
   static  dOldDate2

   if ::bChange != nil
      if ::lMultiselect
         aTmp = ::GetDateRange()
         if dOldDate != aTmp[ 1 ] .or. dOldDate2 != aTmp[ 2 ]
            Eval( ::bChange, Self )
            dOldDate  = aTmp[ 1 ]
            dOldDate2 = aTmp[ 2 ]
         endif
      else
         //if dOldDate != ::GetDate()
         if ::_dOldDate != ::GetDate()
            Eval( ::bChange, Self )
            //dOldDate = ::GetDate()
            ::_dOldDate = ::GetDate()
         endif
      endif
   endif

return nil


 
User avatar
Maurizio
 
Posts: 823
Joined: Mon Oct 10, 2005 1:29 pm

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 57 guests