FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour intermittent color
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
intermittent color
Posted: Sat Mar 28, 2020 06:09 PM
how can I create an intermittent color for a btnbmp






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?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: intermittent color
Posted: Sat Mar 28, 2020 09:53 PM
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.



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.
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: intermittent color
Posted: Sun Mar 29, 2020 09:31 PM

no I wish simulate the old clipper comand * do you remember ?

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: intermittent color
Posted: Sun Mar 29, 2020 10:30 PM
Uwe,
Please try this test
Code (fw): Select all Collapse
#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 ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: intermittent color
Posted: Mon Mar 30, 2020 10:21 AM
Silvio,

try this

Code (fw): Select all Collapse
#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 :-)
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.
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: intermittent color
Posted: Mon Mar 30, 2020 12:59 PM
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
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com

Continue the discussion