Page 1 of 1

Light a Icon on Msgitem - Resolved -

Posted: Wed Nov 09, 2022 9:24 am
by Silvio.Falconi
When I activate the main windows I made

Image

Code: Select all | Expand

IF !CheckEstrazione()
          ::oMsgItem2:setBitmap("warning")
          ::oMsgItem2:cMsg:="Archivio non aggiornato"
       else
          ::oMsgItem2:setBitmap("check")
          ::oMsgItem2:cMsg:="Archivio aggiornato"
       Endif
        ::oMsgItem2:refresh()
How I can to flash the icon or bitmap?

Re: Light a Icon on Msgitem

Posted: Wed Nov 09, 2022 3:31 pm
by karinha
Dear Silvio: Maybe,

Code: Select all | Expand

   IF !CheckEstrazione()
      ::oWnd:oMsgItem2:setBitmap("warning") // LoadBmp() ?
      ::oWnd:oMsgItem2:cMsg:="Archivio non aggiornato"
   ELSE
      ::oWnd:oMsgItem2:setBitmap("check")
      ::oWnd:oMsgItem2:cMsg:="Archivio aggiornato"
   ENDIF

   ::oWnd:oMsgItem2:Refresh()

   // If( IsWindowVisible( ::oMsgBar:hWnd ), ::Paint(),)
 
Regards, saludos.

Re: Light a Icon on Msgitem

Posted: Wed Nov 09, 2022 3:50 pm
by Silvio.Falconi
karinha wrote:Dear Silvio: Maybe,

Code: Select all | Expand

   IF !CheckEstrazione()
      ::oWnd:oMsgItem2:setBitmap("warning") // LoadBmp() ?
      ::oWnd:oMsgItem2:cMsg:="Archivio non aggiornato"
   ELSE
      ::oWnd:oMsgItem2:setBitmap("check")
      ::oWnd:oMsgItem2:cMsg:="Archivio aggiornato"
   ENDIF

   ::oWnd:oMsgItem2:Refresh()

   // If( IsWindowVisible( ::oMsgBar:hWnd ), ::Paint(),)
 
Regards, saludos.


Karina,
are you running a competition to answer all my requests without reconnaissance on the forum? but did you understand my problem?
I want to display a bitmap but I want to make it flash that is to show and not to show, to show and not to show ... until infinity !!

I believe that you are making me so much teasing on the forum, you are answering my requests for help without a logical sense, maybe I'm wrong because I really don't really understand your answers !!!!

Re: Light a Icon on Msgitem

Posted: Wed Nov 09, 2022 6:03 pm
by TimStone
Silvio,

First, I see lots of applications with those warning icons, but never flashing. I think to do that you would have to create a function that displays, removes, displays, removes the icon. That would certainly be a load on the CPU to constantly refresh the dialog to display it in a flash.

Icons, by nature, are not ( I think ) animated. Just thinking outloud, but can you insert a GIF for a flashing warning ? I really don't know if you can do it, but just sharing some thoughts.

Tim

Re: Light a Icon on Msgitem

Posted: Wed Nov 09, 2022 6:05 pm
by karinha
Caro Silvio, tranquilo. Dear Silvio, calm down.
No sé por qué estás tan nervioso. I don't know why you're so nervous. hahahahahaha.

A ver si te ayuda:

C:\FWH..\SAMPLES\TESTMBAR.PRG

Regards, saludos.

Re: Light a Icon on Msgitem

Posted: Thu Nov 10, 2022 9:43 am
by Silvio.Falconi
TimStone wrote:Silvio,

First, I see lots of applications with those warning icons, but never flashing. I think to do that you would have to create a function that displays, removes, displays, removes the icon. That would certainly be a load on the CPU to constantly refresh the dialog to display it in a flash.

Icons, by nature, are not ( I think ) animated. Just thinking outloud, but can you insert a GIF for a flashing warning ? I really don't know if you can do it, but just sharing some thoughts.

Tim
Tim,
I resolved!!!!

Two Bitmaps

warning1.bmp
Image

warning2.bmp
Image

If you save from forum you must rename the exstension of Bmps because postimages.org converte on Png

Code: Select all | Expand


// Animations on MsgItem using Bmp and Timers

#include "FiveWin.ch"

static oWnd

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

function Main()

   local oBrush



   DEFINE WINDOW oWnd FROM 1, 1 TO 20, 60 ;
      TITLE "msgitem"

   SET MESSAGE OF oWnd ;
      TO FWVERSION + FWCOPYRIGHT

      DEFINE MSGITEM oMsgItem1;
         OF oWnd:oMsgBar ;
           SIZE 170             ;
         ACTION NIL

   ACTIVATE WINDOW oWnd ;
      ON INIT DisplayIcons(oMsgItem1)

return nil

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

function DisplayIcons(oMsgItem1)

   local oIco, oTimer

   static nFrame := 1

    oMsgItem1:cMsg:="Archivio non aggiornato"

   DEFINE TIMER oTimer OF oWnd ;
      INTERVAL 400 ;
      ACTION ( nFrame := If( ++nFrame > 2, 1, nFrame ) , ;
               oMsgItem1:setBitmap( "warning" + AllTrim( Str( int(nFrame) ) )+".bmp" ) )

   ACTIVATE TIMER oTimer

return nil