Page 1 of 1

intermittent color

Posted: Sat Mar 28, 2020 6:09 pm
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?

Re: intermittent color

Posted: Sat Mar 28, 2020 9:53 pm
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 :?:

Re: intermittent color

Posted: Sun Mar 29, 2020 9:31 pm
by Silvio.Falconi
no I wish simulate the old clipper comand * do you remember ?

Re: intermittent color

Posted: Sun Mar 29, 2020 10:30 pm
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 ?

Re: intermittent color

Posted: Mon Mar 30, 2020 10:21 am
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

Re: intermittent color

Posted: Mon Mar 30, 2020 12:59 pm
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