TSAYTIMER

TSAYTIMER

Postby wmormar » Sun Sep 25, 2011 9: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.

Image

Aquí el Código TEST
Code: Select all  Expand view
#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: Select all  Expand view
/*
   Autor  : William Morales
   País   : México
   Correo : wmormar@hotmail.com
   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

/**************************************************************************************/
 
Last edited by wmormar on Sun Sep 25, 2011 9:33 am, edited 1 time in total.
William, Morales
Saludos

méxico.sureste
User avatar
wmormar
 
Posts: 1073
Joined: Fri Oct 07, 2005 10:41 pm
Location: México

Re: TSAYTIMER

Postby wmormar » Sun Sep 25, 2011 9: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: Select all  Expand view

   METHOD Hide() INLINE ShowWindow( ::hWnd, SW_HIDE )
 


Después:
Code: Select all  Expand view

   METHOD Hide() INLINE ::lVisible := .f., ShowWindow( ::hWnd, SW_HIDE ) // wmm
 


Antes:
Code: Select all  Expand view

   METHOD Show() INLINE ShowWindow( ::hWnd, SW_SHOWNA )
 


Después:
Code: Select all  Expand view

   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
User avatar
wmormar
 
Posts: 1073
Joined: Fri Oct 07, 2005 10:41 pm
Location: México

Re: TSAYTIMER

Postby wmormar » Sun Sep 25, 2011 10:01 am

Por sugerencia de Daniel Garcia, y sin modificar la TWindow, la clase TSAYTIMER quedaría así:

Code: Select all  Expand view
/*
   Autor  : William Morales
   País   : México
   Correo : wmormar@hotmail.com
   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
User avatar
wmormar
 
Posts: 1073
Joined: Fri Oct 07, 2005 10:41 pm
Location: México

Re: TSAYTIMER

Postby MdaSolution » Sun Sep 25, 2011 7: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
User avatar
MdaSolution
 
Posts: 401
Joined: Tue Jan 05, 2010 2:33 pm

Re: TSAYTIMER

Postby Antonio Linares » Sun Sep 25, 2011 7:31 pm

William,

gracias! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41205
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: TSAYTIMER

Postby wmormar » Sun Sep 25, 2011 8:21 pm

Es un gusto maestro.

Antonio Linares wrote:William,

gracias! :-)
William, Morales
Saludos

méxico.sureste
User avatar
wmormar
 
Posts: 1073
Joined: Fri Oct 07, 2005 10:41 pm
Location: México

Re: TSAYTIMER

Postby wmormar » Sun Sep 25, 2011 8: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: Select all  Expand view
#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: Select all  Expand view
/*
   Autor  : William Morales
   País   : México
   Correo : wmormar@hotmail.com
   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: Select all  Expand view
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
User avatar
wmormar
 
Posts: 1073
Joined: Fri Oct 07, 2005 10:41 pm
Location: México

Re: TSAYTIMER

Postby compubrion » Sun Sep 25, 2011 8:54 pm

Saludos !
Muy bueno tu aporte....

Aca el recurso completo


Code: Select all  Expand view

// 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
User avatar
compubrion
 
Posts: 130
Joined: Thu Mar 08, 2007 6:12 pm
Location: Miranda - Venezuela

Re: TSAYTIMER

Postby wmormar » Sun Sep 25, 2011 8:56 pm

Excelente bro.

saludos

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

Aca el recurso completo


Code: Select all  Expand view

// 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
User avatar
wmormar
 
Posts: 1073
Joined: Fri Oct 07, 2005 10:41 pm
Location: México

Re: TSAYTIMER

Postby Armando » Mon Sep 26, 2011 5: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
User avatar
Armando
 
Posts: 3049
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: TSAYTIMER

Postby wmormar » Mon Sep 26, 2011 5:09 pm

Muy a la orden amigazo

Armando wrote:Brother:

Excelente aporte, muchas gracias.

Saludos
William, Morales
Saludos

méxico.sureste
User avatar
wmormar
 
Posts: 1073
Joined: Fri Oct 07, 2005 10:41 pm
Location: México

Re: TSAYTIMER

Postby wmormar » Tue Sep 27, 2011 7:08 am

Amigos,

Aquí el archivo preprocesado.

Lo nombre: SAYTIMER.CH
Code: Select all  Expand view
#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
User avatar
wmormar
 
Posts: 1073
Joined: Fri Oct 07, 2005 10:41 pm
Location: México

Re: TSAYTIMER

Postby Bayron » Tue Sep 27, 2011 8: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
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Bayron
 
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: TSAYTIMER

Postby wmormar » Tue Sep 27, 2011 5: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
User avatar
wmormar
 
Posts: 1073
Joined: Fri Oct 07, 2005 10:41 pm
Location: México

Re: TSAYTIMER

Postby AIDA » Wed Sep 28, 2011 5:37 am

Funciona muy bien :mrgreen:


Image

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

I love Fivewin

séʌǝɹ ןɐ ɐʇsǝ opunɯ ǝʇsǝ
User avatar
AIDA
 
Posts: 877
Joined: Fri Jan 12, 2007 8:35 pm

Next

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 10 guests