FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour TSAYTIMER
Posts: 1076
Joined: Fri Oct 07, 2005 10:41 PM
TSAYTIMER
Posted: Sun Sep 25, 2011 09:09 AM
Amigos, necesitando un reloj en una ventana o dialog se me ocurrió hacer una clase a la cual llamé TSAYTIMER, aqui las pantallas y el codigo de pruebas, asi como el codigo de la clase.

Es un reloj digital, es algo simple, pero bueno, quise compartirla con ustedes. Es totalmente personalizable, tanto en tipos de fuentes, tamaños de letra, como colores de fondo, shadow del texto, y color del PEN, asi como el intervalo que actualizará la hora.

Me gustaría poder seleccionar entre un reloj digital y de manecillas, será para una próxima entrega.

Sin más preámbulo aquí esta.



Aquí el Código TEST
Code (fw): Select all Collapse
#include <fivewin.ch>

STATIC oWnd, oIcon, oWTimer1, oWTimer2, oWTimer3
STATIC oFontTimer1
STATIC oFontTimer2
STATIC oFontTimer3

FUNCTION main()
  LOCAL oIcon1

  DEFINE FONT oFontTimer1 NAME "Tahoma" SIZE 16, 16
  DEFINE FONT oFontTimer2 NAME "Arial" SIZE 18, 18
  DEFINE FONT oFontTimer3 NAME "Times New Roman" SIZE 20, 20

  DEFINE ICON oIcon  FILE "y:\fwh\icons\fivewin.ICO"

  DEFINE WINDOW oWnd TITLE "Test de la Clase Reloj Digital" ICON oIcon
     oWTimer1 := TSAYTIMER():new( oWnd, { 10, 30}, oFontTimer1, 1, CLR_BLUE, CLR_WHITE, CLR_RED, CLR_BLUE )
     oWTimer2 := TSAYTIMER():new( oWnd, { 70, 30}, oFontTimer2, 2, CLR_WHITE, CLR_BLUE, CLR_BLACK, CLR_HGREEN )
     oWTimer3 := TSAYTIMER():new( oWnd, {130, 30}, oFontTimer3, 3, CLR_HGREEN, CLR_RED, CLR_HGRAY, CLR_BLACK )
  ACTIVATE WINDOW oWnd
return NIL


Aquí el código de la clase.
Code (fw): Select all Collapse
/*
   Autor  : William Morales
   País   : México
   Correo : <!-- e --><a href="mailto:wmormar@hotmail.com">wmormar@hotmail.com</a><!-- e -->
   Fecha  : 25/09/2011 03:28 a.m.
*/

#include <fivewin.ch>

CLASS TSayTimer
   DATA oWnd        AS OBJECT    INIT NIL
   DATA oTmr        AS OBJECT    INIT NIL
   DATA oFont       AS OBJECT    INIT NIL

   DATA nClrPen     AS NUMERIC   INIT CLR_HBLUE
   DATA nClrBack    AS NUMERIC   INIT CLR_BLUE
   DATA nClrShadow  AS NUMERIC   INIT CLR_GRAY
   DATA nClrFront   AS NUMERIC   INIT CLR_WHITE
   DATA nInterval   AS NUMERIC   INIT 1

   DATA lFont       AS LOGICAL   INIT .f.
   DATA lFirst      AS LOGICAL   INIT .t.

   DATA cHour       AS CHARACTER INIT "0"
   DATA cMin        AS CHARACTER INIT "0"
   DATA cSecs       AS CHARACTER INIT "0"

   DATA aPos        AS ARRAY     INIT { 10, 10 }

   METHOD new( oWnd, aPos, oFont, nInterval, clrFront, clrShadow, clrBack, clrPen )
   METHOD settimer()
   METHOD saytimer()
   METHOD activate()    INLINE ::oTmr:activate()
   METHOD pause()       INLINE ::oTmr:deactivate()
   METHOD END()

ENDCLASS

/**************************************************************************************/
METHOD new( oWnd, aPos, oFont, nInterval, clrFront, clrShadow, clrBack, clrPen )
   DEFAULT oWnd      := wndmain()
   DEFAULT aPos      := ::aPos
   DEFAULT nInterval := ::nInterval
   DEFAULT clrPen    := ::nClrPen
   DEFAULT clrFront  := ::nClrFront
   DEFAULT clrShadow := ::nClrShadow
   DEFAULT clrBack   := ::nClrBack

   IF ValType(oFont) == "U"
      DEFINE FONT ::oFont NAME "Tahoma" SIZE 18, 18 BOLD
      ::lFont := .t.
   ELSE
      ::oFont := oFont
   ENDIF

   ::oWnd       := oWnd
   ::aPos       := aPos
   ::nInterval  := nInterval * 1000
   ::nClrPen    := clrPen
   ::nClrFront  := clrFront
   ::nClrShadow := clrShadow
   ::nClrBack   := clrBack

   ::settimer()
   ::saytimer()

   RETURN Self

/**************************************************************************************/
METHOD settimer()
   DEFINE TIMER ::oTmr INTERVAL ::nInterval ACTION ::saytimer() OF ::oWnd
   ACTIVATE TIMER ::oTmr

   RETURN NIL

/**************************************************************************************/
METHOD saytimer()
   LOCAL hDC       := 0
   LOCAL hPen      := 0
   LOCAL hBrush    := 0
   LOCAL nBkOld    := 0
   LOCAL hFontOld  := 0
   LOCAL nWidth    := 0
   LOCAL nHeight   := 0
   LOCAL cTime     := Time()

   IF !::oWnd:lVisible
      IF ::oTmr:nInterval # 1
         ::pause()
         ::oTmr:nInterval := 1
         ::activate()
      ENDIF
      RETURN NIL
   ELSE
      IF ::oTmr:nInterval # ::nInterval
         ::pause()
         ::oTmr:nInterval := ::nInterval
         ::activate()
      ENDIF
   ENDIF

   hDC      := ::oWnd:GETDC()
   hPen     := CreatePen( 1, 3, ::nClrPen )
   hBrush   := CreateSolidBrush( ::nClrBack )
   nBkOld   := SetBkMode( hDC, 1 )
   hFontOld := SelectObject( hDC, ::oFont:hFont )
   nWidth   := ::aPos[2] + GetTextWidth( hDC, cTime, ::oFont:hFont )
   nHeight  := ::aPos[1] + GetTextHeight( ::oFont:hFont, hDC )

   Rectangle( hDC, ::aPos[1], ::aPos[2], nHeight + 5, nWidth + 5, hPen )
   FillRect( hDC, {::aPos[1] + 2, ::aPos[2] + 2, nHeight + 3, nWidth + 3}, hBrush )

   SetTextColor( hDC, ::nClrShadow )
   DrawText( hDC, cTime, {::aPos[1] + 3, ::aPos[2] + 3, nHeight, nWidth} )
   SetTextColor( hDC, ::nClrFront )
   DrawText( hDC, cTime, {::aPos[1] + 4, ::aPos[2] + 4, nHeight, nWidth} )

   DeleteObject( hBrush )
   DeleteObject( hPen )
   SelectObject( hDC, hFontOld )
   SetBkMode( hDC, nBkOld )

   RETURN NIL

/**************************************************************************************/
METHOD END()
   ::oTmr:END()

   IF ::lFont
      ::oFont:END()
   ENDIF

   RETURN NIL

/**************************************************************************************/
William, Morales

Saludos



méxico.sureste
Posts: 1076
Joined: Fri Oct 07, 2005 10:41 PM
Re: TSAYTIMER
Posted: Sun Sep 25, 2011 09:13 AM
Casi se me olvida.

Hay que modificar en la TWindow dos métodos, y es una corrección igual de la TWindow, la DATA lVisible no setea correctamente cuando una ventana está oculta o no, y estas son las líneas a modificar.

Antes:
Code (fw): Select all Collapse
   METHOD Hide() INLINE ShowWindow( ::hWnd, SW_HIDE )


Después:
Code (fw): Select all Collapse
   METHOD Hide() INLINE ::lVisible := .f., ShowWindow( ::hWnd, SW_HIDE ) // wmm


Antes:
Code (fw): Select all Collapse
   METHOD Show() INLINE ShowWindow( ::hWnd, SW_SHOWNA )


Después:
Code (fw): Select all Collapse
   METHOD Show() INLINE ::lVisible := .t., ShowWindow( ::hWnd, SW_SHOWNA ) // wmm


Con esas pequeñas modificaciones, la DATA lVisible se setea correctamente.
William, Morales

Saludos



méxico.sureste
Posts: 1076
Joined: Fri Oct 07, 2005 10:41 PM
Re: TSAYTIMER
Posted: Sun Sep 25, 2011 10:01 AM
Por sugerencia de Daniel Garcia, y sin modificar la TWindow, la clase TSAYTIMER quedaría así:

Code (fw): Select all Collapse
/*
   Autor  : William Morales
   País   : México
   Correo : <!-- e --><a href="mailto:wmormar@hotmail.com">wmormar@hotmail.com</a><!-- e -->
   Fecha  : 25/09/2011 03:28 a.m.
*/

#include <fivewin.ch>

CLASS TSayTimer
   DATA oWnd        AS OBJECT    INIT NIL
   DATA oTmr        AS OBJECT    INIT NIL
   DATA oFont       AS OBJECT    INIT NIL

   DATA nClrPen     AS NUMERIC   INIT CLR_HBLUE
   DATA nClrBack    AS NUMERIC   INIT CLR_BLUE
   DATA nClrShadow  AS NUMERIC   INIT CLR_GRAY
   DATA nClrFront   AS NUMERIC   INIT CLR_WHITE
   DATA nInterval   AS NUMERIC   INIT 1
   DATA nRow        AS NUMERIC   INIT 10
   DATA nCol        AS NUMERIC   INIT 10

   DATA lFont       AS LOGICAL   INIT .f.
   DATA lFirst      AS LOGICAL   INIT .t.

   DATA cHour       AS CHARACTER INIT "0"
   DATA cMin        AS CHARACTER INIT "0"
   DATA cSecs       AS CHARACTER INIT "0"

   METHOD new( nRow, nCol, oWnd, oFont, nInterval, clrFront, clrShadow, clrBack, clrPen )
   METHOD settimer()
   METHOD saytimer()
   METHOD activate()    INLINE ::oTmr:activate()
   METHOD pause()       INLINE ::oTmr:deactivate()
   METHOD END()

ENDCLASS

/**************************************************************************************/
METHOD new( nRow, nCol, oWnd, oFont, nInterval, clrFront, clrShadow, clrBack, clrPen )
   DEFAULT oWnd      := wndmain()
   DEFAULT nRow      := ::nCol
   DEFAULT nCol      := ::nCol
   DEFAULT nInterval := ::nInterval
   DEFAULT clrPen    := ::nClrPen
   DEFAULT clrFront  := ::nClrFront
   DEFAULT clrShadow := ::nClrShadow
   DEFAULT clrBack   := ::nClrBack

   IF ValType(oFont) == "U"
      DEFINE FONT ::oFont NAME "Tahoma" SIZE 18, 18 BOLD
      ::lFont := .t.
   ELSE
      ::oFont := oFont
   ENDIF

   ::oWnd       := oWnd
   ::nRow       := nRow
   ::nCol       := nCol
   ::nInterval  := nInterval * 1000
   ::nClrPen    := clrPen
   ::nClrFront  := clrFront
   ::nClrShadow := clrShadow
   ::nClrBack   := clrBack

   ::settimer()
   ::saytimer()

   RETURN Self

/**************************************************************************************/
METHOD settimer()
   DEFINE TIMER ::oTmr INTERVAL ::nInterval ACTION ::saytimer() OF ::oWnd
   ACTIVATE TIMER ::oTmr

   RETURN NIL

/**************************************************************************************/
METHOD saytimer()
   LOCAL hDC       := 0
   LOCAL hPen      := 0
   LOCAL hBrush    := 0
   LOCAL nBkOld    := 0
   LOCAL hFontOld  := 0
   LOCAL nWidth    := 0
   LOCAL nHeight   := 0
   LOCAL cTime     := Time()

   IF !IsWindowVisible( ::oWnd:hWnd )
      IF ::oTmr:nInterval # 1
         ::pause()
         ::oTmr:nInterval := 1
         ::activate()
      ENDIF
      RETURN NIL
   ELSE
      IF ::oTmr:nInterval # ::nInterval
         ::pause()
         ::oTmr:nInterval := ::nInterval
         ::activate()
      ENDIF
   ENDIF

   hDC      := ::oWnd:GETDC()
   hPen     := CreatePen( 1, 3, ::nClrPen )
   hBrush   := CreateSolidBrush( ::nClrBack )
   nBkOld   := SetBkMode( hDC, 1 )
   hFontOld := SelectObject( hDC, ::oFont:hFont )
   nWidth   := ::nCol + GetTextWidth( hDC, cTime, ::oFont:hFont )
   nHeight  := ::nRow + GetTextHeight( ::oFont:hFont, hDC )

   Rectangle( hDC, ::nRow, ::nCol, nHeight + 5, nWidth + 6, hPen )
   FillRect( hDC, {::nRow + 2, ::nCol + 2, nHeight + 3, nWidth + 4}, hBrush )

   SetTextColor( hDC, ::nClrShadow )
   DrawText( hDC, cTime, {::nRow + 3, ::nCol + 3, nHeight, nWidth} )
   SetTextColor( hDC, ::nClrFront )
   DrawText( hDC, cTime, {::nRow + 4, ::nCol + 4, nHeight, nWidth} )

   DeleteObject( hBrush )
   DeleteObject( hPen )
   SelectObject( hDC, hFontOld )
   SetBkMode( hDC, nBkOld )
   ::oWnd:ReleaseDC()

   RETURN NIL

/**************************************************************************************/
METHOD END()
   ::oTmr:END()

   IF ::lFont
      ::oFont:END()
   ENDIF

   RETURN NIL

/**************************************************************************************/


PD Gracias Daniel
William, Morales

Saludos



méxico.sureste
Posts: 401
Joined: Tue Jan 05, 2010 02:33 PM
Re: TSAYTIMER
Posted: Sun Sep 25, 2011 07:12 PM

Stack Calls

Called from: source\rtl\tobject.prg => TFONT:ERROR(172)
Called from: source\rtl\tobject.prg => TFONT:MSGNOTFOUND(205)
Called from: source\rtl\tobject.prg => TFONT:HWND(0)
Called from: .\source\classes\TIMER.PRG => TTIMER:NEW(36)
Called from: test.prg => TSAYTIMER:SETTIMER(96)
Called from: test.prg => TSAYTIMER:NEW(89)
Called from: test.prg => MAIN(18)

FWH .. BC582.. xharbour
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: TSAYTIMER
Posted: Sun Sep 25, 2011 07:31 PM

William,

gracias! :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1076
Joined: Fri Oct 07, 2005 10:41 PM
Re: TSAYTIMER
Posted: Sun Sep 25, 2011 08:21 PM
Es un gusto maestro.

Antonio Linares wrote:William,

gracias! :-)
William, Morales

Saludos



méxico.sureste
Posts: 1076
Joined: Fri Oct 07, 2005 10:41 PM
Re: TSAYTIMER
Posted: Sun Sep 25, 2011 08:27 PM
Aqui convertida totalmente como control.

Por sugerencia del maestro Daniel Garcia.

Además de poder integrarlo como recurso en un dialogo.

Aqui el ejemplo.
Code (fw): Select all Collapse
#include <fivewin.ch>

STATIC oWnd, oDlg, oTray, oIcon, oWTimer1, oWTimer2, oWTimer3, oWTimer4
STATIC oFontTimer1
STATIC oFontTimer2
STATIC oFontTimer3
STATIC oFontTimer4
STATIC lTerminate := .f.
STATIC oIcon1

FUNCTION main()

  DEFINE FONT oFontTimer1 NAME "Tahoma" SIZE 20, 40
  DEFINE FONT oFontTimer2 NAME "Arial" SIZE 30, 60
  DEFINE FONT oFontTimer3 NAME "Times New Roman" SIZE 40, 80
  DEFINE FONT oFontTimer4 NAME "Times New Roman" SIZE 46, 90

  DEFINE ICON oIcon  FILE "y:\fwh\icons\fivewin.ICO"

  // Aqui se lanza el dialogo con recurso
  dialogo()

  DEFINE WINDOW oWnd TITLE "Test de la Clase Reloj Digital" ICON oIcon ;
         FROM -10000, -10000 TO -9980, -9940
     oWTimer1 := TWSAYTIMER():new(  1,  5, oWnd, oFontTimer1, 1, CLR_HGREEN, CLR_RED, CLR_HGRAY, CLR_BLACK )
     oWTimer2 := TWSAYTIMER():new(  5, 10, oWnd, oFontTimer2, 1, CLR_HGREEN, CLR_RED, CLR_HGRAY, CLR_BLACK )
     oWTimer3 := TWSAYTIMER():new( 10, 15, oWnd, oFontTimer3, 1, CLR_HGREEN, CLR_RED, CLR_HGRAY, CLR_BLACK )
  ACTIVATE WINDOW oWnd

  RETURN NIL

/**************************************************************************************/
FUNCTION dialogo()
  DEFINE DIALOG oDlg RESOURCE "RELOJ" TITLE "Test desde Recurso"
     oWTimer4 := TWSAYTIMER():Redefine(  401, oDlg, oFontTimer4, 1, CLR_HGREEN, CLR_RED, CLR_HGRAY, CLR_BLACK )
  ACTIVATE DIALOG oDlg

  RETURN NIL

/**************************************************************************************/


Aqui el codigo del control.

Code (fw): Select all Collapse
/*
   Autor  : William Morales
   País   : México
   Correo : <!-- e --><a href="mailto:wmormar@hotmail.com">wmormar@hotmail.com</a><!-- e -->
   Fecha  : 25/09/2011 06:29 a.m.
*/

#include <fivewin.ch>
#include <constant.ch>

#define COLOR_BTNFACE           15

CLASS TWSayTimer FROM TControl
   CLASSDATA lRegistered AS LOGICAL
   DATA lFont            AS LOGICAL   INIT .f.
   DATA lPixel           AS LOGICAL   INIT .f.

   DATA oTmr             AS OBJECT    INIT NIL

   DATA nClrPen          AS NUMERIC   INIT CLR_HBLUE
   DATA nClrShadow       AS NUMERIC   INIT CLR_GRAY
   DATA nInterval        AS NUMERIC   INIT 1

   DATA cHour            AS CHARACTER INIT "0"
   DATA cMin             AS CHARACTER INIT "0"
   DATA cSecs            AS CHARACTER INIT "0"

   METHOD new( nTop, nLeft, oWnd, oFont, nInterval, clrText, clrShadow, ;
               clrBack, clrPen, lPixel ) CONSTRUCTOR
   METHOD Redefine( nId, oWnd, oFont, nInterval, clrText, clrShadow, ;
                    clrBack, clrPen ) CONSTRUCTOR
   METHOD paint()
   METHOD Display()         INLINE ::BeginPaint(), ::Paint(), ::EndPaint(), 0
   METHOD settimer()
   METHOD updatecoord()
   METHOD activate()        INLINE ::oTmr:activate()
   METHOD pause()           INLINE ::oTmr:deactivate()
   METHOD END()
   METHOD Initiate( hDlg )
   METHOD EraseBkGnd( hDC ) INLINE 0

ENDCLASS

/**************************************************************************************/
METHOD new( nTop, nLeft, oWnd, oFont, nInterval, clrText, clrShadow, ;
            clrBack, clrPen, lPixel ) CLASS TWSayTimer
   DEFAULT oWnd      := GetWndDefault()
   DEFAULT nTop      := ::nTop
   DEFAULT nLeft     := ::nLeft
   DEFAULT nInterval := ::nInterval
   DEFAULT clrPen    := ::nClrPen
   DEFAULT clrText   := oWnd:nClrText
   DEFAULT clrShadow := ::nClrShadow
   DEFAULT clrBack   := GetSysColor( COLOR_BTNFACE )
   DEFAULT lPixel    := .f.

   IF ValType(oFont) == "U"
      DEFINE FONT ::oFont NAME "Tahoma" SIZE 18, 18 BOLD
      ::lFont := .t.
   ELSE
      ::oFont := oFont
   ENDIF

   ::oWnd       := oWnd
   ::nTop       := nTop * IF( !lPixel, BTN_CHARPIX_H, 1 )
   ::nLeft      := nLeft * IF( !lPixel, BTN_CHARPIX_W, 1 )
   ::updatecoord()
   ::nStyle     := nOR( WS_CHILD, WS_VISIBLE )
   ::nId        := ::GetNewId()
   ::nInterval  := nInterval * 1000
   ::nClrPen    := clrPen
   ::nClrShadow := clrShadow
   ::nClrText   := clrText
   ::nClrPane   := clrBack
   ::lDrag      := .f.

   ::Register()

   IF !Empty( ::oWnd:hWnd )
      ::Create()
      ::oWnd:AddControl( Self )
   ELSE
      ::oWnd:DefControl( Self )
   ENDIF

   ::settimer()

   RETURN Self

/**************************************************************************************/
METHOD Redefine( nId, oWnd, oFont, nInterval, clrText, clrShadow, ;
                 clrBack, clrPen ) CLASS TWSayTimer
   DEFAULT oWnd      := GetWndDefault()
   DEFAULT nInterval := ::nInterval
   DEFAULT clrPen    := ::nClrPen
   DEFAULT clrText   := oWnd:nClrText
   DEFAULT clrShadow := ::nClrShadow
   DEFAULT clrBack   := GetSysColor( COLOR_BTNFACE )

   IF ValType(oFont) == "U"
      DEFINE FONT ::oFont NAME "Tahoma" SIZE 18, 18 BOLD
      ::lFont := .t.
   ELSE
      ::oFont := oFont
   ENDIF

   ::nId        := nId
   ::oWnd       := oWnd
   ::nInterval  := nInterval * 1000
   ::nClrPen    := clrPen
   ::nClrShadow := clrShadow
   ::nClrText   := clrText
   ::nClrPane   := clrBack
   ::lDrag      := .f.

   //::Register()
   ::Register( nOR( CS_VREDRAW, CS_HREDRAW ) )
   oWnd:DefControl( Self )

   RETURN Self

/**************************************************************************************/
METHOD paint() CLASS TWSayTimer
   LOCAL hPen      := 0
   LOCAL hBrush    := 0
   LOCAL nBkOld    := 0
   LOCAL hFontOld  := 0
   LOCAL cTime     := Time()
   LOCAL aInfo     := ::DispBegin()
   LOCAL hOldBrush := 0
   LOCAL aRect     := GetClientRect( ::hWnd )
   LOCAL aRect1    := GetClientRect( ::hWnd )
   LOCAL aRect2    := GetClientRect( ::hWnd )

   hPen     := CreatePen( 1, 3, ::nClrPen )
   hBrush   := CreateSolidBrush( ::nClrPane )
   nBkOld   := SetBkMode( ::hDC, 1 )
   hFontOld := SelectObject( ::hDC, ::oFont:hFont )

   hOldBrush = SelectObject( ::hDC, hBrush )
   Rectangle( ::hDC, 0, 0, ::nHeight, ::nWidth, hPen )
   SelectObject( ::hDC, hOldBrush )

   SetTextColor( ::hDC, ::nClrShadow )
   aRect1[1] := aRect1[1] + 2
   aRect1[2] := aRect1[2] + 2
   DrawText( ::hDC, cTime, aRect1 )
   SetTextColor( ::hDC, ::nClrText )
   aRect2[1] := aRect2[1] + 3
   aRect2[2] := aRect2[2] + 3
   DrawText( ::hDC, cTime, aRect2 )

   DeleteObject( hBrush )
   DeleteObject( hPen )
   SelectObject( ::hDC, hFontOld )
   SetBkMode( ::hDC, nBkOld )

   ::DispEnd( aInfo )

   RETURN NIL

/**************************************************************************************/
METHOD settimer() CLASS TWSayTimer
   DEFINE TIMER ::oTmr INTERVAL ::nInterval ;
          ACTION If( IsWindowVisible( ::hWnd ), ::refresh(), ) OF Self
   ACTIVATE TIMER ::oTmr

   RETURN NIL

/**************************************************************************************/
METHOD updatecoord() CLASS TWSayTimer
   LOCAL hFontOld  := 0
   LOCAL cTime     := Time()

   hFontOld  := SelectObject( ::GETDC, ::oFont:hFont )
   ::nBottom := ::nTop + GetTextHeight( ::oFont:hFont, ::hDC ) + 6
   ::nRight  := ::nLeft + GetTextWidth( ::hDC, cTime, ::oFont:hFont ) + 6

   SelectObject( ::hDC, hFontOld )
   ::ReleaseDC()

   RETURN NIL

/**************************************************************************************/
METHOD END() CLASS TWSayTimer
   ::oTmr:END()

   IF ::lFont
      ::oFont:END()
   ENDIF

   RETURN NIL

/**************************************************************************************/
METHOD Initiate( hDlg ) CLASS TWSayTimer

   Super:Initiate( hDlg )
   :: settimer()

   RETURN  nil

/**************************************************************************************/


Aquí el recurso
Code (fw): Select all Collapse
RELOJ DIALOGEX DISCARDABLE 6, 18, 194, 54
STYLE WS_POPUP|DS_MODALFRAME|DS_CONTEXTHELP|DS_3DLOOK|WS_CAPTION|WS_SYSMENU|WS_VISIBLE
CAPTION "Dialog"
FONT 14, "Book Antiqua", 0, 0, 1
{
  CONTROL "OK", IDOK, "Button", WS_TABSTOP, 144, 8, 45, 15
  CONTROL "Cancel", IDCANCEL, "Button", WS_TABSTOP, 144, 24, 45, 15
  CONTROL "TWSAYTIMER", 401, "TWSAYTIMER", 0x00000000, 4, 4, 136, 36
}


Bueno, esta mejor que al inicio y se comporta de igual manera mejor, esto fue hecho con la ayuda del maestro Daniel Garcia, y pos son mis pininos.
William, Morales

Saludos



méxico.sureste
Posts: 132
Joined: Thu Mar 08, 2007 06:12 PM
Re: TSAYTIMER
Posted: Sun Sep 25, 2011 08:54 PM
Saludos !
Muy bueno tu aporte....

Aca el recurso completo


Code (fw): Select all Collapse
// RESOURCE SCRIPT generated by "Pelles C for Windows, version 6.50".

#include <windows.h>
#include <commctrl.h>
#include <richedit.h>

LANGUAGE LANG_SPANISH,SUBLANG_SPANISH_MEXICAN

RELOJ DIALOGEX DISCARDABLE 6, 18, 194, 54
STYLE WS_POPUP|DS_MODALFRAME|DS_CONTEXTHELP|DS_3DLOOK|WS_CAPTION|WS_SYSMENU|WS_VISIBLE
CAPTION "Dialog"
FONT 14, "Book Antiqua", 0, 0, 1
{
  CONTROL "OK", IDOK, "Button", WS_TABSTOP, 144, 13, 45, 15
  CONTROL "Cancel", IDCANCEL, "Button", WS_TABSTOP, 144, 29, 45, 15
  CONTROL "TWSAYTIMER", 401, "TWSAYTIMER", 0x00000000, 4, 9, 136, 36
}
Harbour / Bcc / MinGW / Fwh 13.9
Posts: 1076
Joined: Fri Oct 07, 2005 10:41 PM
Re: TSAYTIMER
Posted: Sun Sep 25, 2011 08:56 PM
Excelente bro.

saludos

compubrion wrote:Saludos !
Muy bueno tu aporte....

Aca el recurso completo


Code (fw): Select all Collapse
// RESOURCE SCRIPT generated by "Pelles C for Windows, version 6.50".

#include <windows.h>
#include <commctrl.h>
#include <richedit.h>

LANGUAGE LANG_SPANISH,SUBLANG_SPANISH_MEXICAN

RELOJ DIALOGEX DISCARDABLE 6, 18, 194, 54
STYLE WS_POPUP|DS_MODALFRAME|DS_CONTEXTHELP|DS_3DLOOK|WS_CAPTION|WS_SYSMENU|WS_VISIBLE
CAPTION "Dialog"
FONT 14, "Book Antiqua", 0, 0, 1
{
  CONTROL "OK", IDOK, "Button", WS_TABSTOP, 144, 13, 45, 15
  CONTROL "Cancel", IDCANCEL, "Button", WS_TABSTOP, 144, 29, 45, 15
  CONTROL "TWSAYTIMER", 401, "TWSAYTIMER", 0x00000000, 4, 9, 136, 36
}
William, Morales

Saludos



méxico.sureste
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: TSAYTIMER
Posted: Mon Sep 26, 2011 05:02 PM

Brother:

Excelente aporte, muchas gracias.

Saludos

SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Posts: 1076
Joined: Fri Oct 07, 2005 10:41 PM
Re: TSAYTIMER
Posted: Mon Sep 26, 2011 05:09 PM
Muy a la orden amigazo

Armando wrote:Brother:

Excelente aporte, muchas gracias.

Saludos
William, Morales

Saludos



méxico.sureste
Posts: 1076
Joined: Fri Oct 07, 2005 10:41 PM
Re: TSAYTIMER
Posted: Tue Sep 27, 2011 07:08 AM
Amigos,

Aquí el archivo preprocesado.

Lo nombre: SAYTIMER.CH
Code (fw): Select all Collapse
#ifndef _SAYTIMER_CH
#define _SAYTIMER_CH

/*----------------------------------------------------------------------------*/

#xcommand REDEFINE SAYTIMER                        ;
             [<oSayTimer>]                         ;
             [ <dlg: OF,WINDOW,DIALOG > <oWnd> ]   ;
             [ FONT <oFont> ]                      ;
             [ INTERVAL <nInterval> ]              ;
             [ <color: COLOR,COLORS > <nClrText> [,<nClrShadow> [,<nClrBack> [,<nClrPen> ] ] ] ] ;
             [ <lPixel: PIXEL, PIXELS > ]          ;
      => ;
          [ <oSayTimer> := ] TWSayTimer():Redefine( ;
             <oWnd>, <oFont>, <nInterval>, <nClrText>, ;
             <nClrShadow>, <nClrBack>, <nClrPen>, <.lPixel.> )

#xcommand @ <nRow>, <nCol> SAYTIMER                ;
             [ <oSayTimer> ]                       ;
             [ <dlg: OF,WINDOW,DIALOG > <oWnd> ]   ;
             [ FONT <oFont> ]                      ;
             [ INTERVAL <nInterval> ]              ;
             [ <color: COLOR,COLORS > <nClrText> [,<nClrShadow> [,<nClrBack> [,<nClrPen> ] ] ] ] ;
             [ <lPixel: PIXEL, PIXELS > ]          ;
      => ;
          [ <oSayTimer> := ] TWSayTimer():New( <nRow>, <nCol>, ;
             <oWnd>, <oFont>, <nInterval>, <nClrText>, ;
             <nClrShadow>, <nClrBack>, <nClrPen>, <.lPixel.> )
#endif


Espero sea de su agrado
William, Morales

Saludos



méxico.sureste
Posts: 883
Joined: Thu Dec 24, 2009 12:46 AM
Re: TSAYTIMER
Posted: Tue Sep 27, 2011 08:23 AM

William,
Como siempre muy buen aporte!!!

Mis conocimientos no llegan lo suficientemente lejos como para ayudar a hacerlo, pero seria bueno que pudiera ser transparente, sin afectar el color o el brush de la ventana/dialogo...!!! y la posibilidad de NoBorder

=====>

Bayron Landaverry
xBasePHP.com
(215)2226600 Philadelphia,PA, USA
MayaBuilders@gMail.com
Guatemala

FWH25.06--Harbour 3.0.0--BCC7.7--UEstudio 10.10
Windows 10

FiveWin, One line of code and it's done...

Posts: 1076
Joined: Fri Oct 07, 2005 10:41 PM
Re: TSAYTIMER
Posted: Tue Sep 27, 2011 05:10 PM
Listo, bro, ya está en el tintero.

Dejame y veo lo que comentas.

saludos

Bayron wrote:William,
Como siempre muy buen aporte!!!

Mis conocimientos no llegan lo suficientemente lejos como para ayudar a hacerlo, pero seria bueno que pudiera ser transparente, sin afectar el color o el brush de la ventana/dialogo...!!! y la posibilidad de NoBorder
William, Morales

Saludos



méxico.sureste
Posts: 880
Joined: Fri Jan 12, 2007 08:35 PM
Re: TSAYTIMER
Posted: Wed Sep 28, 2011 05:37 AM
Funciona muy bien :-)




Saluditos :-)
Que es mejor que programar? creo que nada :)
Atropellada pero aqui ando :P

I love Fivewin

séʌǝɹ ןɐ ɐʇsǝ opunɯ ǝʇsǝ