intermittent color

Post Reply
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

intermittent color

Post by Silvio.Falconi »

how can I create an intermittent color for a btnbmp

Image




See the image ?

now the btnbmp has the color yellow with :SetColor(CLR_RED,CLR_YELLOW)


but I would like to flash for a few seconds in different colors to make it display and say to the end user "I am here"

how can I do it?
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: intermittent color

Post by ukoenig »

Silvio,
but I would like to flash for a few seconds in different colors
to make it display and say to the end user "I am here"
what do You think about painting only a colored border
with a defined pensize and transparent-level
instead of changing the buttoncolor
I think that looks better.

Image

regards
Uwe :?:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: intermittent color

Post by Silvio.Falconi »

no I wish simulate the old clipper comand * do you remember ?
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: intermittent color

Post by Silvio.Falconi »

Uwe,
Please try this test

Code: Select all




#include "fivewin.ch"


function Test()

   local oDlg, oFont, aBtn[ 3 ]
   local nRow, nCol, n

   local ntype:="01"
   local date1 :=date()
   local date2 :=date()

   local cImage1:= "c:\work\fwh\bitmaps\alphabmp\world.bmp"
   local cImage2:= "c:\work\fwh\bitmaps\alphabmp\task.bmp"

   aData:={}

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 600,200 PIXEL TRUEPIXEL FONT oFont

   nRow  := 50
   nCol  := 30

   for n := 1 to 3
      @ nRow, nCol BTNBMP aBtn[ n ] RESOURCE cImage1 ;
         PROMPT LTrim( Str( n ) ) + " " ;
         SIZE 64,64 PIXEL OF oDlg FLAT TOP  NOBORDER

        
      nCol  += 80
   next n


  ACTIVATE DIALOG oDlg CENTERED;
                                        ON INIT ( Lamp( aBtn[ 3 ] ) )
   RELEASE FONT oFont

   return nil
//----------------------------------------------------------------//

Function Lamp(oBtn)
local n
       For n=1 to 10
         oBtn:SetColor(CLR_RED,CLR_YELLOW)
        syswait(0.08)
        oBtn:SetColor(CLR_RED,CLR_GREEN)
         syswait(0.08)
        oBtn:SetColor(CLR_RED,CLR_YELLOW)
        n++
      next
      RETURN NIL
//-----------------------------------------------------------//
I wish change the background color of btnbmp many times for simulate the intermittet color as to create a blink
How I can resolve ?
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: intermittent color

Post by ukoenig »

Silvio,

try this

Code: Select all

#include "fivewin.ch"

// now the btnbmp has the color yellow with :SetColor(CLR_RED,CLR_YELLOW)
// but I would like to flash for a few seconds in different colors 
// to make it display and say to the end user "I am here" 

FUNCTION MAIN()
local oDlg, oFont, aBtn[ 3 ]
local nRow, nCol, n

local ntype:="01"
local date1 :=date()
local date2 :=date()

local cImage1:= ".\Bitmaps\world.bmp"
local cImage2:= ".\Bitmaps\task.bmp"

aData:={}

DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14

DEFINE DIALOG oDlg SIZE 600,200 PIXEL TRUEPIXEL FONT oFont

nRow  := 50
nCol  := 30

FOR n := 1 to 3
      @ nRow, nCol BTNBMP aBtn[ n ] RESOURCE cImage1 ;
           PROMPT LTrim( Str( n ) ) + " " ;
           SIZE 64,64 PIXEL OF oDlg FLAT TOP  NOBORDER
      nCol  += 80
NEXT n

oDlg:bPainted := < |hDC|
    Lamp( aBtn[ 3 ] ) // don't use ON INIT !
RETURN NIL
>

ACTIVATE DIALOG oDlg CENTERED

RELEASE FONT oFont

RETURN NIL

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

FUNCTION LAMP(oBtn)
local n, lChange := .F.

FOR n := 1 to 9 // lastcolor = yellow
    IF lChange = .F.
         oBtn:SetColor(CLR_RED,CLR_YELLOW)
         lChange := .T.
    ELSE
         oBtn:SetColor(CLR_RED,CLR_GREEN)
         lChange := .F.
    ENDIF
    oBtn:Refresh()
    syswait(0.1)
    n++
NEXT
oBtn:Refresh() // shows yellow

RETURN NIL

 
regards
Uwe :D
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: intermittent color

Post by Silvio.Falconi »

yes good

I knew you would find the right solution, as far as graphics are concerned you are good
for image Umbrella run good for another services not run
but this depends on the image which is too large and does not have a defined outline

I was what I have been looking for for a long time: the user searches for a customer for example "Falconi",
the procedure searches for the customer (in that date range), creates an array,

if the len of the array is one it shows the flashing otherwise it opens a dialog with the list of services
occupied by the customer during that period, then the end user can select which service to show by flashing
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Post Reply