Пример #1
0
zLONG
ZTimer::SetZCtrlState( zLONG  lStatusType,
                       zULONG ulValue )
{
   zLONG lRC = ZMapAct::SetZCtrlState( lStatusType, ulValue );

   // Enabled is used to start/stop the timer thread
   if ( lStatusType == zCONTROL_STATUS_ENABLED )
   {
   // TraceLineI( "ZTimer::SetZCtrlState ENABLED: ", ulValue );

      if ( ulValue )
      {
         if ( ulValue > 1 )
         {
            m_lInterval = ulValue;

#ifdef zREMOTE_SERVER
            zCHAR szInterval[ 32 ];

            _ltoa_s( m_lInterval, szInterval );
            SetRemoteZCtrlAttribute( this, "Timer", "Interval", szInterval );
#endif
         }

         if ( m_bEnabled == FALSE )
         {
#ifdef zREMOTE_SERVER
            SetRemoteZCtrlAttribute( this, "Ctrl", "Enabled", "Y" );
#else
            m_bEnabled = TRUE;
            m_pThread = AfxBeginThread( fnTimerThreadProc,
                                        (zPVOID) this,
                                        THREAD_PRIORITY_NORMAL,
                                        0, NULL );
#endif
         }
      }
      else
      {
         if ( m_bEnabled == TRUE )
         {
            m_bEnabled = FALSE;
#ifdef zREMOTE_SERVER
            SetRemoteZCtrlAttribute( this, "Ctrl", "Enabled", "N" );
#endif
         }
      }
   }

   return( lRC );
}
Пример #2
0
void
ZCheckBox::SetCheck( zBOOL bCheck )
{
#ifdef zREMOTE_SERVER
   SetRemoteZCtrlAttribute( this, m_csERemote, "Checked",
                            bCheck ? "Y" : "N" );
#else
   if ( mIs_hWnd( m_hWnd ) )
      CButton::SetCheck( bCheck );
#endif
}
Пример #3
0
// ZTimer - ctor
ZTimer::ZTimer( ZSubtask *pZSubtask,
                CWnd     *pWndParent,
                ZMapAct  *pzmaComposite,
                zVIEW    vDialog,
                zSHORT   nOffsetX,
                zSHORT   nOffsetY,
                zKZWDLGXO_Ctrl_DEF *pCtrlDef ) :
        CStatic( ),
        ZMapAct( pZSubtask,             // base class ctor
                 pzmaComposite,
                 pWndParent,
                 this,
                 vDialog,
                 nOffsetX,
                 nOffsetY,
                 pCtrlDef,
                 "Timer" )
{
#ifdef DEBUG_ALL
   TraceLineI( "In ctor for ZTimer", (zLONG) this );
#endif

   m_ulMapActFlags &= ~zMAPACT_FOCUS_ENABLED;

   // Make it a hidden window.
   Attr.Style &= ~(WS_TABSTOP | WS_VISIBLE );
   Attr.Style |= WS_DISABLED;
   Attr.X = 0;
   Attr.Y = 0;
   Attr.W = 0;
   Attr.H = 0;

   // Localize settings from XWD.
   m_lInterval = pCtrlDef->StyleX;
   m_bEnabled = TRUE;
   m_pThread = 0;

// TraceLineI( "Timer interval --> ", m_lInterval );
// TraceLineS( "string interval -> ", pCtrlDef->Text );
// TraceLineI( "Timer enabled ---> ", m_bEnabled );

#ifdef zREMOTE_SERVER
   zCHAR szInterval[ 32 ];

   _ltoa_s( m_lInterval, szInterval );
   SetRemoteZCtrlAttribute( this, "Timer", "Interval", szInterval );
#endif

   CreateZ( );
}
Пример #4
0
zLONG
ZCheckBox::SetZCtrlState( zLONG lStatusType,
                          zULONG ulValue )
{
   if ( lStatusType == zCONTROL_STATUS_CHECKED )
   {
#ifdef zREMOTE_SERVER
      SetRemoteZCtrlAttribute( this, "CheckBox",
                               "Checked", ulValue ? "Y" : "N" );
#else
      if ( mIs_hWnd( m_hWnd ) )
         SetCheck( ulValue ? 1 : 0 );
#endif

      return( 0 );
   }
   else
      return( ZMapAct::SetZCtrlState( lStatusType, ulValue ) );
}
Пример #5
0
zSHORT
ZMLE::LimitTextLength( zULONG ulTextLth )
{
#ifdef DEBUG_ALL
   TraceLineS( "ZMLE::LimitTextLength: ", *m_pzsTag );
#endif
   if ( ulTextLth >= 0 )
   {
      m_ulLth = ulTextLth;
      if ( mIs_hWnd( m_hWnd ) )
         SetLimitText( m_ulLth );

#ifdef zREMOTE_SERVER
      zCHAR szTextLth[ 32 ];

      zltoa( ulTextLth, szTextLth );
      SetRemoteZCtrlAttribute( this, "MLE", "TextLth", szTextLth );
#endif

      return( 0 );
   }

   return( 1 );
}
Пример #6
0
int
ZMLE::OnCreate( LPCREATESTRUCT lpCreateStruct )
{
   int nRC = CEdit::OnCreate( lpCreateStruct );
   if ( nRC == -1 )
      return( -1 );

   SetFontOverride( );

#ifdef zREMOTE_SERVER
   SetRemoteZCtrlAttribute( this, "Ctrl", "ReadOnly",
                            (m_ulMapActFlags & zMAPACT_ENABLED) ? "N" : "Y" );
#else
   SetReadOnly( (m_ulMapActFlags & zMAPACT_ENABLED) ? FALSE : TRUE );
#endif

   zVIEW  vApp = 0;

   if ( m_pzsVName && m_pzsEName && m_pzsAName ) // painter ensures all???
   {
      if ( GetViewByName( &vApp, *m_pzsVName,
                          m_pZSubtask->m_vDialog, zLEVEL_ANY ) > 0 )
      {
         if ( m_ulLth == 0 )
            GetAttributeDisplayLength( &m_ulLth, vApp, *m_pzsEName,
                                       *m_pzsAName, *m_pzsContext );
      }
   }

   LimitTextLength( m_ulLth );

   if ( m_ulMapActFlags & zMAPACT_DISABLE_READONLY )
      SetZCtrlState( zCONTROL_STATUS_DISABLE_READONLY, TRUE );

   return( nRC );
}
Пример #7
0
zLONG
ZMLE::SetZCtrlState( zLONG  lStatusType,
                     zULONG ulValue )
{
   // We want to do something different for multiline edit controls.
   // As opposed to edit controls, it is OK to set the state of the MLE
   // control to ReadOnly when it is disabled so that is can receive
   // focus and scroll as necessary.
   if ( lStatusType != zCONTROL_STATUS_ENABLED &&
        lStatusType != zCONTROL_STATUS_AUTOGRAY )
   {
      return( ZMapAct::SetZCtrlState( lStatusType, ulValue ) );
   }

   zBOOL bEnabledPrev = (m_ulMapActFlags & zMAPACT_ENABLED) ? TRUE : FALSE;

   if ( lStatusType == zCONTROL_STATUS_ENABLED )
   {
      // Shut off auto enabled flag ... user is overriding enabled status.
      m_ulMapActFlags &= ~zMAPACT_AUTO_DISABLED;
      if ( ulValue )
         m_ulMapActFlags |= zMAPACT_ENABLED;
      else
         m_ulMapActFlags &= ~zMAPACT_ENABLED;
   }
   else
   if ( lStatusType == zCONTROL_STATUS_AUTOGRAY )
   {
      if ( ulValue )
      {
         // We can't auto-enable a control that was manually disabled.
         if ( m_ulMapActFlags & zMAPACT_AUTO_DISABLED )
         {
            m_ulMapActFlags |= zMAPACT_ENABLED;
            m_ulMapActFlags &= ~zMAPACT_AUTO_DISABLED;
         }
      }
      else
      {
         // We can't auto-disable a control that was manually disabled.
         if ( m_ulMapActFlags & zMAPACT_ENABLED )
         {
            m_ulMapActFlags &= ~zMAPACT_ENABLED;
            m_ulMapActFlags |= zMAPACT_AUTO_DISABLED;
         }
      }
   }

   zBOOL bEnabled = (m_ulMapActFlags & zMAPACT_ENABLED) ? TRUE : FALSE;
   if ( bEnabled == TRUE && bEnabledPrev == FALSE ||
        bEnabled == FALSE && bEnabledPrev == TRUE )
   {
      bEnabled = !bEnabled;     // for SetReadOnly and for return value
#ifdef zREMOTE_SERVER
      SetRemoteZCtrlAttribute( this, "Ctrl", "Enabled",
                               bEnabled ? "N" : "Y" );
      SetRemoteZCtrlAttribute( this, "Ctrl", "ReadOnly",
                               bEnabled ? "Y" : "N" );
#else
      if ( mIs_hWnd( m_hWnd ) )
      {
         SetReadOnly( bEnabled );
         Invalidate( TRUE );
      }
#endif
   }

   return( bEnabled );
}