flashing SAY

flashing SAY

Postby Natter » Thu May 25, 2023 6:30 am

Hi,

Please tell me an example with a flashing SAY
Natter
 
Posts: 1221
Joined: Mon May 14, 2007 9:49 am

Re: flashing SAY

Postby Antonio Linares » Thu May 25, 2023 7:43 am

Dear Yuri,

Simply use a TIMER and change the colors of the SAY object
regards, saludos

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

Re: flashing SAY

Postby Natter » Thu May 25, 2023 8:31 am

Thanks
Natter
 
Posts: 1221
Joined: Mon May 14, 2007 9:49 am

Re: flashing SAY

Postby karinha » Thu May 25, 2023 1:44 pm

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7826
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: flashing SAY

Postby Antonio Linares » Thu May 25, 2023 5:32 pm

Dear João,

many thanks

dsay.ch
Code: Select all  Expand view
#ifndef _DSAY_CH
#define _DSAY_CH

/*----------------------------------------------------------------------------//
!short: DYNAMIC SAY  */


// The SPEED tints that to go from 0 to 100

#xcommand REDEFINE DYNAMIC SAY [<oDSay>] ;
             [ <label: PROMPT, VAR> <cText> ] ;
             [ PICTURE <cPict> ] ;
             [ ID <nId> ] ;
             [ <dlg: OF,WINDOW,DIALOG > <oWnd> ] ;
             [ <lCenter: CENTERED, CENTER > ] ;
             [ <lRight:  RIGHT > ] ;
             [ <lBottom: BOTTOM > ];
             [ <color: COLOR,COLORS > <nClrText> [,<nClrBack> ] ] ;
             [ <scroll: VERTICAL, HORIZONTAL > SCROLL [ SPEED <nSpeed> ] [ <lWrap: WRAP > ] ] ;
             [ <lBlink: BLINKING > ] ;
             [ <update: UPDATE > ] ;
             [ FONT <oFont> ] ;
             [ <lShaded: SHADED, SHADOW > ] ;
             [ <lBox:    BOX   >  ] ;
             [ <lRaised: RAISED > ] ;
       => ;
          [ <oDSay> := ] TDSay():ReDefine( <nId>, <{cText}>, <oWnd>, <cPict>, ;
                        <.lCenter.>, <.lRight.>, <.lBottom.>, <nClrText>, <nClrBack>, ;
                        [Upper(<(scroll)>)], <nSpeed>, <.lWrap.>, <.lBlink.>, ;
                        <.update.>, <oFont>, <.lShaded.>, <.lBox.>, <.lRaised.> )

#xcommand @ <nRow>, <nCol> DYNAMIC SAY [ <oDSay> <label: PROMPT,VAR > ] <cText> ;
             [ PICTURE <cPict> ] ;
             [ <dlg: OF,WINDOW,DIALOG > <oWnd> ] ;
             [ FONT <oFont> ]  ;
             [ <lCenter: CENTERED, CENTER > ] ;
             [ <lRight:  RIGHT > ] ;
             [ <lBottom: BOTTOM > ];
             [ <lBorder: BORDER > ] ;
             [ <lPixel: PIXEL, PIXELS > ] ;
             [ <color: COLOR,COLORS > <nClrText> [,<nClrBack> ] ] ;
             [ SIZE <nWidth>, <nHeight> ] ;
             [ <scroll: VERTICAL, HORIZONTAL > SCROLL [ SPEED <nSpeed> ] [ <lWrap: WRAP > ] ] ;
             [ <lBlink: BLINKING > ] ;
             [ <design: DESIGN >  ] ;
             [ <update: UPDATE >  ] ;
             [ <lShaded: SHADED, SHADOW > ] ;
             [ <lBox:    BOX   >  ] ;
             [ <lRaised: RAISED > ] ;
      => ;
          [ <oDSay> := ] TDSay():New( <nRow>, <nCol>, <{cText}>,;
             [<oWnd>], [<cPict>], <oFont>, <.lCenter.>, <.lRight.>, <.lBottom.>, <.lBorder.>,;
             <.lPixel.>, <nClrText>, <nClrBack>, <nWidth>, <nHeight>,;
             [Upper(<(scroll)>)], <nSpeed>, <.lWrap.>, <.lBlink.>,;
             <.design.>, <.update.>, <.lShaded.>, <.lBox.>, <.lRaised.> )
#endif
 


dsay.prg
Code: Select all  Expand view
// MODIFICADO EM: 28/10/2021 -> ::Super - Joao

#include "FiveWin.ch"
#include "Constant.ch"

#define SS_CENTER             1
#define SS_RIGHT              2
#define SS_GRAYRECT           5 // BOXRECT

#define TA_LEFT               0
#define TA_RIGHT              2
#define TA_CENTER             6
#define TA_TOP                0
#define TA_BOTTOM             8

#define COLOR_WINDOW          5
#define COLOR_WINDOWTEXT      8

#define COLOR_BTNSHADOW      16
#define COLOR_BTNHIGHLIGHT   20

#define WM_NCHITTEST        132  // 0x84

#define GWL_STYLE           -16
#define GWL_EXSTYLE         -20

#ifdef __XPP__
   #define Super ::TControl
   #define New   _New
#endif

static oTimer, aTimer := {}

//----------------------------------------------------------------------------//

CLASS TDSay FROM TControl

   CLASSDATA lRegistered AS LOGICAL

   DATA   l3D
   DATA   cPicture
   DATA   aCaption
   DATA   bGet

   DATA   lShaded, lBox, lRaised

   DATA   nDTop, nDLeft
   DATA   nTTop, nTLeft
   DATA   aRect, nLong
   DATA   nTxtWidth, nTxtHeight
   DATA   nAlign

   DATA   oTimer
   DATA   lScroll, lHorizontal, nSpeed, lWrap    // nSpeed: 0 to 100
   DATA   lBlink, lView

   METHOD New( nRow, nCol, bText, oWnd, cPicture, oFont,;
               lCentered, lRight, lBottom, lBorder, lPixels, nClrText, nClrBack,;
               nWidth, nHeight, cScroll, nSpeed, lWrap, lBlink,;
               lDesign, lUpdate, lShaded, lBox, lRaised ) CONSTRUCTOR

   METHOD ReDefine( nId, bText, oWnd, cPicture, lCentered, lRight, lBottom,;
                    nClrText, nClrBack, cScroll, nSpeed, lWrap, lBlink,;
                    lUpdate, oFont, lShaded, lBox, lRaised )  CONSTRUCTOR

   METHOD Default()

   METHOD Destroy()

   METHOD Initiate( hDlg ) INLINE ::Super:Initiate( hDlg ), ::Default()

   METHOD HandleEvent( nMsg, nWParam, nLParam )
   
   METHOD Display() INLINE ::BeginPaint(), ::Paint(), ::EndPaint()

   METHOD Paint()

   METHOD Dynamic()

   METHOD Refresh() INLINE If( ::bGet != nil, ::SetText( Eval( ::bGet ) ),)

   METHOD ReSize( nType, nWidth, nHeight ) INLINE ::Default(), ::Super:ReSize( nType, nWidth, nHeight )
   
   METHOD SetText( cText ) INLINE ;
                    ::cCaption := If( ::cPicture != nil,;
                                  Transform( cText, ::cPicture ),;
                                  cValToChar( cText ) ),;
                                  ::Default(), ::Paint()
   METHOD VarPut( cValue )

ENDCLASS

//----------------------------------------------------------------------------//

METHOD New( nRow, nCol, bText, oWnd, cPicture, oFont,;
            lCentered, lRight, lBottom, lBorder, lPixels, nClrText, nClrBack,;
            nWidth, nHeight, cScroll, nSpeed, lWrap, lBlink,;
            lDesign, lUpdate, lShaded, lBox, lRaised ) CLASS TDSay

   DEFAULT nRow     := 0, nCol := 0,;
           lBorder  := .f., lCentered := .f., lRight := .f., lBottom := .f., lPixels := .f.,;
           oWnd     := GetWndDefault(),;
           nClrText := oWnd:nClrText, nClrBack := oWnd:nClrPane,;
           nHeight  := If( oFont != nil, Abs( oFont:nHeight ), SAY_CHARPIX_H ),;
           lDesign  := .f., bText := { || "" },;
           lUpdate  := .f., lShaded := .f., lBox := .f., lRaised := .f.

   ::l3D       = lShaded .or. lBox .or. lRaised
   ::nAlign    = nOr( If( lBottom, TA_BOTTOM, TA_TOP ),;
                      If( lCentered, TA_CENTER, If( lRight, TA_RIGHT, TA_LEFT ) ) )
   ::bGet      = bText
   ::bSetGet   = bText
   ::cPicture  = cPicture
   ::cCaption  = If( Empty( cPicture ), cValToChar( Eval( bText ) ),;
                     Transform( Eval( bText ), cPicture ) )
   
   DEFAULT nWidth := ( If( oFont != nil, Abs( oFont:nWidth ), SAY_CHARPIX_W ) * Len( ::cCaption ) ) - 4  // 8

   if ! lPixels
      ::nTop  = nRow * If( oFont != nil, Abs( oFont:nHeight ), SAY_CHARPIX_H ) + 2        // 13
      ::nLeft = nCol * If( oFont != nil, Abs( oFont:nWidth ), SAY_CHARPIX_W )                    // 8
   else
      ::nTop  = nRow
      ::nLeft = nCol
   endif

   ::nBottom   = ::nTop + nHeight - 1
   ::nRight    = ::nLeft + nWidth - 1
 
   DEFAULT nSpeed := 55, lWrap := .f., lBlink := .f.

   ::lScroll     = ( cScroll != nil )
   ::lHorizontal = ( cScroll == "HORIZONTAL" )
   ::nSpeed      = if( nSpeed < 50, ( 50 - nSpeed ) * 10, 100 - nSpeed )
   ::lWrap       = lWrap
   ::lBlink      = lBlink

   ::oWnd      = oWnd
   ::oFont     = oFont
   ::nId       = ::GetNewId()
   ::nStyle    = nOR( WS_CHILD, WS_VISIBLE,;
                 If( lDesign, nOr( WS_CLIPSIBLINGS, WS_TABSTOP ), 0 ),;
                 If( lBorder, WS_BORDER, 0 ) )
   ::lShaded  = lShaded
   ::lBox     = lBox
   ::lRaised  = lRaised

   ::lDrag     = lDesign
   ::lCaptured = .f.
   ::lUpdate   = lUpdate
 
   ::SetColor( nClrText, nClrBack )

   ::Register( nOR( CS_VREDRAW, CS_HREDRAW ) )
 
   if ! Empty( oWnd:hWnd )
      ::Create()
      ::Default()
      if ::l3D
         ::Set3DLook()
      endif
      oWnd:AddControl( Self )
   else
      oWnd:DefControl( Self )
   endif

   if ::lDrag
      ::CheckDots()
   endif

return Self

//----------------------------------------------------------------------------//

METHOD ReDefine( nId, bText, oWnd, cPicture, lCentered, lRight, lBottom,;
                 nClrText, nClrBack, cScroll, nSpeed, lWrap, lBlink,;
                 lUpdate, oFont, lShaded, lBox, lRaised ) CLASS TDSay

   DEFAULT lCentered := .f., lRight := .f., lBottom := .f.,;
           nClrText := oWnd:nClrText, nClrBack := oWnd:nClrPane,;
           oWnd := GetWndDefault(),;
           lUpdate := .f., lShaded := .f., lBox := .f., lRaised := .f.

   ::l3D       = lShaded .or. lBox .or. lRaised
   ::nId       = nId
   ::nAlign    = nOr( If( lBottom, TA_BOTTOM, TA_TOP ),;
                      If( lCentered, TA_CENTER, If( lRight, TA_RIGHT, TA_LEFT ) ) )
   ::bGet      = bText
   ::bSetGet   = bText
   ::cPicture  = cPicture
   ::oFont     = oFont

   if bText != nil
      ::cCaption = If( Empty( cPicture ), cValToChar( Eval( bText ) ),;
                       Transform( Eval( bText ), cPicture ) )
   endif

   DEFAULT nSpeed := 55, lWrap := .f., lBlink := .f.
                 
   ::lScroll     = ( cScroll != nil )
   ::lHorizontal = ( cScroll == "HORIZONTAL" )
   ::nSpeed      = if( nSpeed < 50, ( 50 - nSpeed ) * 10, 100 - nSpeed )
   ::lWrap       = lWrap
   ::lBlink      = lBlink  

   ::oWnd      = oWnd
   ::hWnd      = 0
   ::lShaded   = lShaded
   ::lBox      = lBox
   ::lRaised   = lRaised

   ::lDrag     = .f.
   ::lCaptured = .f.
   ::lUpdate   = lUpdate

   ::SetColor( nClrText, nClrBack )
   
   ::Register( nOR( CS_VREDRAW, CS_HREDRAW ) )

   if oWnd != nil
      oWnd:DefControl( Self )
   endif
 
return Self

//----------------------------------------------------------------------------//

METHOD HandleEvent( nMsg, nWParam, nLParam ) CLASS TDSay

   if ::lDrag .and. nMsg == WM_NCHITTEST    
      return DefWindowProc( ::hWnd, nMsg, nWParam, nLParam )
   endif

return ::Super:HandleEvent( nMsg, nWParam, nLParam )

//----------------------------------------------------------------------------//

METHOD Default() CLASS TDSay
 
   local lCentered := nAnd( ::nAlign, TA_CENTER ) == TA_CENTER  
   local lRight    := nAnd( ::nAlign, TA_RIGHT )  == TA_RIGHT
   local lBottom   := nAnd( ::nAlign, TA_BOTTOM ) == TA_BOTTOM  
   
   if ::oFont != nil
      ::SetFont( ::oFont )
   else
      ::SetFont( ::oWnd:oFont )
   endif

   ::nTxtWidth  = 0
   ::nTxtHeight = GetTextHeight( ::hWnd, 0 )

   ::aCaption   = Array( MLCount( ::cCaption, 254 ) )
   AEval( ::aCaption, {|c, n| ::aCaption[ n ] := Trim( MemoLine( ::cCaption, 252, n ) ),;
                       ::nTxtWidth := Max( ::nTxtWidth, GetTextWidth( 0, ::aCaption[ n ],;
                       if( ::oFont != nil, ::oFont:hFont, 0 ) ) ) } )

   ::aRect := GetClientRect( ::hWnd )
 
   ::nDTop  := ::nTTop  := if( lBottom, ::aRect[ 3 ], 0 )
   ::nDLeft := ::nTLeft := if( lCentered, int( ::aRect[ 4 ] / 2 ), if( lRight, ::aRect[ 4 ], 0 ) )
 
   if ::lBox
      ::aRect := { 2, 2, ::aRect[ 3 ] - 2, ::aRect[ 4 ] - 2 }
   elseif ::lShaded .or. ::lRaised
      ::aRect := { 1, 1, ::aRect[ 3 ] - 1, ::aRect[ 4 ] - 1 }
   endif      

   if ::lScroll
      if ::lHorizontal
         ::nLong := Max( ::nTxtWidth, ::aRect[ 4 ] )
      else
         ::nLong := Max( ::nTxtHeight * len( ::aCaption ), ::aRect[ 3 ] )
      endif
   endif

   InvalidateRect( ::hWnd, ::aRect, .t. )
   ::lView := .t.

   // Call dynamic and blinking
               
   if !::lDrag

      if ::lScroll .and. ::oTimer = nil
         DEFINE TIMER ::oTimer INTERVAL ::nSpeed ACTION ::Dynamic() OF Self
         ACTIVATE TIMER ::oTimer
      endif
     
      if ::lBlink .and. AScan( aTimer, { | oCtrl | oCtrl == Self } ) == 0
         AAdd( aTimer, Self )
         if oTimer = nil
            DEFINE TIMER oTimer INTERVAL 300 ACTION Blink() OF ::oWnd
            ACTIVATE TIMER oTimer
         endif
      endif

   endif

return nil

//----------------------------------------------------------------------------//

METHOD Destroy() CLASS TDSay
 
  if ::lBlink

     ADel( aTimer, AScan( aTimer, { |o| o == Self} ) )
     ASize( aTimer, len( aTimer) - 1 )

     if len( aTimer ) = 0
        oTimer := nil
     endif

  endif

return ::Super:Destroy()

//----------------------------------------------------------------------------//

METHOD Paint() CLASS TDSay

   local n
   local nColorShadow, nColorLight

   ::GetDC()

   if ::lActive

      if ::lView
   
         for n := 1 to len( ::aCaption )
             WSay( ::hWnd, ::hDC, ::nDTop + ( n - 1 ) * ::nTxtHeight, ::nDLeft, ::aCaption[ n ], ::nClrText,,;
                   If( ::oFont != nil, ::oFont:hFont, 0 ), .T., .T., ::nAlign )
         next
   
         if ::lScroll .and. ::lWrap
            if ::lHorizontal
                for n := 1 to len( ::aCaption )
                    WSay( ::hWnd, ::hDC, ::nDTop + ( n - 1 ) * ::nTxtHeight, ::nDLeft + ::nLong, ::aCaption[ n ], ::nClrText,,;
                          If( ::oFont != nil, ::oFont:hFont, 0 ), .T., .T., ::nAlign )
                next
             else
                for n := 1 to len( ::aCaption )
                    WSay( ::hWnd, ::hDC, ::nDTop + ( n - 1 ) * ::nTxtHeight + ::nLong, ::nDLeft, ::aCaption[ n ], ::nClrText,,;
                          If( ::oFont != nil, ::oFont:hFont, 0 ), .T., .T., ::nAlign )
                next
             endif
         endif
   
      else

         /* //-> Para que o BLINKING nao trave no WINDOWS XP
            //-> Modificado em 01/01/2008
         Hay que hacer esta modificación en la clase TDSay:
         Código:

         METHOD Paint() CLASS TDSay
         */


         // InvalidateRect( ::hWnd, ::aRect, .t. )
         FillRect( ::hDC, GetClientRect( ::hWnd ), ::oBrush:hBrush )

         /*
         El intervalo del timer lo he pasado de 300 a 600, pero eso será según las preferencias de cada uno

         regards, saludos

         Antonio Linares
         www.fivetechsoft.com
         */

   
      endif

   else

      nColorShadow := GetSysColor( COLOR_BTNSHADOW )
      nColorLight  := GetSysColor( COLOR_BTNHIGHLIGHT )

      for n := 1 to len( ::aCaption )
          WSay( ::hWnd, ::hDC, ::nDTop + ( n - 1 ) * ::nTxtHeight + 1, ::nDLeft + 1, ::aCaption[ n ], nColorLight,,;
                If( ::oFont != nil, ::oFont:hFont, 0 ), .T., .T., ::nAlign )
          WSay( ::hWnd, ::hDC, ::nDTop + ( n - 1 ) * ::nTxtHeight, ::nDLeft, ::aCaption[ n ], nColorShadow,,;
                If( ::oFont != nil, ::oFont:hFont, 0 ), .T., .T., ::nAlign )
      next

   endif

   // 3D

   if ::lShaded
      WndInset( ::hWnd, ::hDC )   // SHADED, SHADOW
   endif

   if ::lRaised
      WndRaised( ::hWnd, ::hDC )  // RAISED
   endif

   if ::lBox
      WndBoxIn( ::hDC, 0, 0, ::nBottom-::nTop, ::nRight-::nLeft )
      WndBoxRaised( ::hDC, 1, 1, ::nBottom-::nTop-1, ::nRight-::nLeft-1 )
   endif

   ::ReleaseDC()

return nil

//----------------------------------------------------------------------------//

METHOD Dynamic() CLASS TDSay

  local nSpeed := if( ::nSpeed < 50, int( ( 50 - ::nSpeed + 5 ) / 5 ), 1 )

  if !::lActive
     return nil
  endif

  if ::lHorizontal

     ::nDLeft -= nSpeed
     if ::nDLeft + ::nLong < ::nTLeft
        if ::lWrap
           ::nDLeft := ::nDLeft + ::nLong
        else
           ::oTimer:End()
        endif
     endif
     ScrollWindow( ::hWnd, -nSpeed, 0, ::aRect, ::aRect )

  else

     ::nDTop -= nSpeed
     if ::nDTop + ::nLong < if( ::nTTop = 0, 0, ::nTxtHeight )
        if ::lWrap
           ::nDTop := ::nDTop + ::nLong
        else
           ::oTimer:End()
        endif
     endif
     ScrollWindow( ::hWnd, 0, -nSpeed, ::aRect, ::aRect )

  endif

  /*  It is not necessary to use the method 'Paint()' because
      'ScrollWindow()' he calls directly to the method 'Paint()'  */


return nil

//----------------------------------------------------------------------------//

METHOD VarPut( cValue ) CLASS TDSay

   if ! Empty( ::cPicture )
      cValue = Transform( cValue, ::cPicture )
   else
      cValue = cValToChar( cValue )
   endif

   ::bGet = { || cValue }

return nil

//  Static functions
//----------------------------------------------------------------------------//

static Function Blink()
  AEval( aTimer, {| oCtrl | oCtrl:lView := !oCtrl:lView, if( oCtrl:lActive, oCtrl:Paint(), ) } )
return nil




dsay3.prg
Code: Select all  Expand view
// C:\FWH..\SAMPLES\DSAY3.PRG y DSAY3.RC

#Include "FiveWin.ch"

FUNCTION Main()

   LOCAL cText := MemoRead( "c:\fwh1905\samples\dsay2.prg" )
   LOCAL oDlg, oMsg1, oMsg2, oFont, oBold

   DEFINE FONT oFont NAME "LUCIDA CONSOLE" SIZE 0,-14
   DEFINE FONT oBold NAME "VERDANA" SIZE 0,-32

   DEFINE DIALOG oDlg RESOURCE "ABMS" FONT oFont

   oDlg:lHelpIcon := .F.

   // REDEFINE PANEL oMsg1 ID 4001 OF oDlg NOBORDER
   // REDEFINE PANEL oMsg2 ID 4002 OF oDlg NOBORDER

   // usando @
   /*@ 100,100 SCROLLMSG "FiveWin Power : New Scroll Msg class" ;
      SIZE 600, 40 PIXEL OF oDlg                              ;
      FONT oBold COLOR CLR_BLACK, CLR_HGREEN HORIZONTAL       ;
      SPEED 1

   // FiveWin.ch
   @ 200,100 SCROLLMSG oMsg TEXT cText SIZE 600, 200 PIXEL OF oDlg ;
      FONT oFont COLOR CLR_HRED, CLR_YELLOW SPEED 1*/


   // Usando Recursos.
   oMsg1 := TScrollMsg():New( 0, 0, 600, 40, "FiveWin Power : New Scroll Msg class",;
            oDlg, oBold, 1,                 ;
            CLR_BLACK, CLR_HGREEN, .T.,.T., ;
            .F. )

   oMsg2 := TScrollMsg():New( 0, 0, 600, 200, cText, ;
            oDlg, oFont, 1,                          ;
            CLR_HRED, CLR_YELLOW, .F.,.T.,           ;
            .F. )

   oMsg1:nId := 4001
   oMsg2:nId := 4002

   ACTIVATE DIALOG oDlg CENTERED

   RELEASE FONT oFont, oBold

RETURN NIL

// FIN



dsay3.rc
Code: Select all  Expand view
ABMS DIALOG DISCARDABLE 6, 18, 366, 198
STYLE WS_POPUP|DS_MODALFRAME|WS_CAPTION|WS_SYSMENU|WS_VISIBLE
CAPTION "SCROLL MSG"
FONT 8, "Tahoma"
{
  CONTROL "", 4001, "Static", WS_GROUP, 12, 8, 336, 36
  CONTROL "", 4002, "Static", WS_GROUP, 12, 52, 340, 136
}
 
regards, saludos

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

Re: flashing SAY

Postby karinha » Thu May 25, 2023 5:54 pm

// TESTDSAY.PRG

Code: Select all  Expand view

// Testing FiveWin Dynamic Say controls - TESTDSAY.PRG
// Testando FiveWin Com Controles de Says Dinamicos

#include "FiveWin.Ch"
#include "DSay.Ch"

STATIC oWnd

STATIC oDSay

// ----------------------------------------------------------------------------//

FUNCTION Main()

   LOCAL cTitle := "Testando Say Dinamico" + Space( 20 )

   LOCAL cSay  := "Texto de Prova"

   LOCAL oDSay1, oDSay2
   LOCAL cDSay
   LOCAL cDSay1 := "Menu caro:" + CRLF + ;
      "- Caviar" + CRLF + ;
      "- Salmón aumado" + CRLF + ;
      "- Jamón 5 iberico" + CRLF + ;
      "- Camarones" + CRLF + ;
      "- y Albariño"

   LOCAL cDSay2 := "Menu cutre:" + CRLF + ;
      "- Croquetas" + CRLF + ;
      "- Tortilla patata" + CRLF + ;
      "- Chorizo" + CRLF + ;
      "- Aceitunas" + CRLF + ;
      "- y Cocacola"

   DEFINE WINDOW oWnd FROM 1, 1 TO 400, 600 PIXEL ;
      COLOR CLR_BLACK, CLR_HGRAY ;
      TITLE cTitle

   SET MESSAGE OF oWnd TO "" KEYBOARD CLOCK DATE NOINSET

   // Esta es una prueba de que se puede usar este contro en
   // la Barra de mensajes, pero sera necesario redimensionarlo
   // según se redimensione la ventana principal:
   //
   // @ 4,8 DYNAMIC SAY oTT VAR cTitle PIXEL OF oWnd:oMsgBar;
   // HORIZONTAL SCROLL WRAP

   @ 30, 30 DYNAMIC SAY cSay + " A Velocidade Base" PIXEL OF oWnd SIZE 280, 20 ;
      BORDER HORIZONTAL SCROLL WRAP

   // nSpeed: 0 to 100

   @ 60, 30 DYNAMIC SAY cSay + " A Velocidade Lenta" PIXEL OF oWnd SIZE 280, 20 ;
      SHADED CENTER;
      HORIZONTAL SCROLL SPEED 10 WRAP

   @ 90, 30 DYNAMIC SAY cSay + " A Velocidade Rapida" PIXEL OF oWnd SIZE 280, 20 ;
      RAISED RIGHT;
      HORIZONTAL SCROLL SPEED 90 WRAP

   @ 120, 30 DYNAMIC SAY cSay + " Estatico Piscante" PIXEL OF oWnd SIZE 280, 20 ;
      BOX CENTERED BLINKING

   @ 150, 30 DYNAMIC SAY cSay + " Dinamico Piscante" PIXEL OF oWnd SIZE 280, 20 ;
      HORIZONTAL SCROLL WRAP;
      BLINKING

   @ 185, 140 BUTTON "&Trocar" SIZE 92, 22 PIXEL OF oWnd;
      ACTION ( cDSay := cDSay1, cDSay1 := cDSay2, cDSay2 := cDSay, ;
      oDSay1:SetText( cDSay1 ), oDSay2:SetText( cDSay2 ) )

   @ 220, 30 DYNAMIC SAY oDSay1 VAR cDSay1 SIZE 150, 110 PIXEL ;
      COLOR CLR_BLACK, CLR_GRAY SHADED;
      VERTICAL SCROLL WRAP

   @ 220, 190 DYNAMIC SAY oDSay2 VAR cDSay2 SIZE 150, 110 PIXEL ;
      COLOR CLR_BLACK, CLR_GRAY SHADED;
      HORIZONTAL SCROLL WRAP

   // @ Say
   @ 200, 450 BUTTON "&Codigo" SIZE 92, 22 PIXEL ;
      ACTION Test_Dialog() OF oWnd

   // WorkShop
   @ 235, 450 BUTTON "&Recursos" SIZE 92, 22 PIXEL ;
      ACTION Test_Resource() OF oWnd

   ACTIVATE WINDOW oWnd

RETURN NIL

// ----------------------------------------------------------------------------//

FUNCTION Test_Dialog()

   LOCAL oDlg, oFont
   LOCAL cVar := "Este controle esta dedicado" + CRLF + ;
      "aos mais queridos e inigualaveis" + CRLF + ;
      "amigos:" + CRLF + CRLF + ;
      "a Pantera Rosa" + CRLF + ;
      "os Hermanos Marx" + CRLF + ;
      "O Collote" + CRLF + ;
      "Tintín" + CRLF + ;
      "Mario Moreno (Cantinflas)" + CRLF + ;
      "Os tres mosqueteiros" + CRLF + ;
      "Kin Kong" + CRLF + ;
      "Pepe Potamo" + CRLF + ;
      "Ao Clube dos poetas mortos" + CRLF + ;
      "Paty pernas largas" + CRLF + ;
      "e ao Pato Lucas" + CRLF + CRLF + CRLF + CRLF + ;
      "kapiabafwh@gmail.com"

   DEFINE FONT oFont NAME "Comic Sans MS" SIZE 0, - 18 // BOLD

   DEFINE DIALOG oDlg TITLE "Say Dinamico na Dialog" WINDOW oWnd ;
      FROM 50, 50 TO 370, 370 PIXEL ;
      COLORS CLR_BLACK, CLR_YELLOW

   oDlg:lHelpIcon := .F.

   @ 5, 5 DYNAMIC SAY cVar SIZE 150, 150 PIXEL OF oDlg;
      VERTICAL SCROLL;
      CENTERED BOTTOM;
      FONT oFont

   ACTIVATE DIALOG oDlg

   RELEASE FONT oFont

RETURN NIL

// ----------------------------------------------------------------------------//

FUNCTION Test_Resource()

   LOCAL oDlg, oFont
   LOCAL cText := "Super oferta"           + CRLF + CRLF + ;
      "Controles para FiveWin" + CRLF + CRLF + ;
      "Totalmente Gratis"

   DEFINE FONT oFont NAME "Arial" SIZE 0, - 20 ;
      BOLD ITALIC NESCAPEMENT 450

   SET 3DLOOK ON

   DEFINE DIALOG oDlg RESOURCE "TEST_DSAY"  WINDOW oWnd

   oDlg:lHelpIcon := .F.

   REDEFINE DYNAMIC SAY PROMPT ( OemToAnsi( " kapiabafwh@gmail.com" ) )    ;
      ID 101 OF oDlg                                                       ;
      CENTERED BLINKING

   REDEFINE DYNAMIC SAY VAR cText ID 102 OF oDlg;
      HORIZONTAL SCROLL WRAP;
      RIGHT SHADED;
      COLOR CLR_WHITE, CLR_BLUE FONT oFont

   ACTIVATE DIALOG oDlg

   RELEASE FONT oFont

RETURN NIL

// fin / end
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7826
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: flashing SAY

Postby Willi Quintana » Fri May 26, 2023 3:26 pm

Hello

Code: Select all  Expand view

.........
       DEFINE TIMER oTmr INTERVAL 1000 ACTION Blinker(oSay, oTmr)

       REDEFINE SAY oSay VAR cMen ID 125 FONT oFont1 COLOR CLR_RED OF oDlg


......
...
..
.
//-----------------------------------------------------------------------
Function Blinker(oCtrl, oTmr)
Static lOn := .f.
oTmr:DeActivate()
if lOn
   oCtrl:Enable() //Hide()
else
   oCtrl:Disable() //Show()
endif
lOn := !lOn
oTmr:Activate()
Return(Nil)


 
User avatar
Willi Quintana
 
Posts: 1019
Joined: Sun Oct 09, 2005 10:41 pm
Location: Cusco - Perú

Re: flashing SAY

Postby karinha » Sat Jun 03, 2023 5:54 pm

Willi, no hay manera de comparar la calidad de la clase DSAY.PRG con tu ejemplo. Vea este ejemplo usando el programa Calculadora de Acuéllar.

https://imgur.com/tiqt1u2

Image

Download completo aqui:

https://mega.nz/file/1E0EUSxa#9eeIw3MMs8wXWp6uJK3QQVKOCFnAQlVHOffwLWfANS4

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7826
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 37 guests