Hmg3 method incompatibility

Moderator: Rathinagiri

Post Reply
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

Hmg3 method incompatibility

Post by l3whmg » Sun Sep 04, 2011 9:10 am

Hi friends
I found an incompatibility between a HMG3 method and HMG4 method. Please take a look to this code from control

Code: Select all

METHOD Enabled( lValue ) CLASS CONTROL

   IF PCOUNT() == 0
      ::lEnabled := IIF( hb_IsNil( ::lEnabled ) == .T., ::oQtObject:isEnabled(), ::lEnabled )
      RETURN ::lEnabled
   ELSEIF hb_IsLogical( lValue ) == .T.
      ::lEnabled := lValue
      ::oQTObject:SetEnabled( ::lEnabled )
   ENDIF

   RETURN NIL
But I found this

Code: Select all

METHOD Enabled( lValue ) CLASS TIMER
   IF hb_IsLogical( lValue )
      IF lValue
         IF ! ::oQTObject:isActive()
           ::oQTObject:disconnect( "timeout()" )
           ::oQTObject:connect( "timeout()", ::bOnInterval )
           ::oQTObject:start()
         ENDIF
      ELSE
         IF ::oQTObject:isActive()
            ::oQTObject:disconnect( "timeout()" )
            ::oQTObject:stop()
         ENDIF
      ENDIF
      ::lEnabled := lValue
   ENDIF
   RETURN ::lEnabled
As you can see, the 2nd means start and stop. This is a problem, because we can't use Enabled (from control) to know the status according to the original meaning of Qt.

I think this 2nd method must be renamed (ie started) and within hmg.ch we must recode ENABLED to STARTED.
But is a problem, because with OOP syntax we must use

Code: Select all

WITH OBJECT Timer(...
   :Started := .F.
....
and with XBase command style we must translate

Code: Select all

DEFINE TIMER
 ENABLED .F.   ===> :Started := .F.
On the other hand I think it's important to preserve the original QT meaning: enabled / disabled

Cheers



Cheers
Luigi from Italy
www.L3W.it

Post Reply