Notification boxes colored

Notification boxes colored

Postby Silvio.Falconi » Thu May 17, 2018 9:46 pm

How create a small message boxes timed and colored for dialogs as these ?

Image

I wish insert it on dialogs with timer and trasparency

desktopalert class is no good
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: Notification boxes colored

Postby cnavarro » Thu May 17, 2018 10:04 pm

Explain better, and details your goal
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Notification boxes colored

Postby Silvio.Falconi » Fri May 18, 2018 8:45 am

the message must be inserted inside a colored frame and must be placed at @ x, y of the dialog without shadows must appear and disappear in n seconds as you can see it has a small icon at the beginning and must have at least the possibility to insert two lines text obviously the message if it has two linne has to resize itself. We probably have something already. I do not want messages like desktop alert or similar otherwise I would have opted for the desktopalert class .... you want a simple thing maybe a colored panel and with rounded corners just as you see it in the picture

I need this kind of message because it is very useful in the programs I put in tablets. The operator does not have to press the confirm button as it does in the traditional msginfo () / msgalert () but the message must appear and disappear after n seconds so that the tablet can inform the operator in a simple example:

the operator inserts the wrong dates or the service for those dates is not free. the message notifies the operator of the error in a simple way without the operator having to press esc or press the ok key to go on
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: Notification boxes colored

Postby cnavarro » Fri May 18, 2018 10:51 pm

Please try with this sample and tell me what modifications need

https://bitbucket.org/fivetech/fivewin- ... astest.prg
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Notification boxes colored

Postby Silvio.Falconi » Sat May 19, 2018 4:45 pm

Sorry I Know it

I have a dialog as this



and for a sample I wish insert a colored message timed into a specific position for a sample


or



or
Last edited by Silvio.Falconi on Sat Aug 24, 2019 9:25 am, edited 1 time in total.
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: Notification boxes colored

Postby cnavarro » Sat May 19, 2018 5:26 pm

Ok, please try with this sample

Code: Select all  Expand view

//----------------------------------------------------------------------------//
Function HazAlert204( oWnd, nType )

   local oTip
   local cText
   local cBmp    := "..\bitmaps\16x16\alert.bmp"
   local lLeft   := .T.
   local lUp     := .T.
   DEFAULT nType := 1
   
   // oTip := TToast():NewToast( nToast, cText, cBmp, nWidth, nHeight, oWnd, nClrPane, ;
   //                  nClrPane2, nClrText, nLev, nTime, lUp, bRet, lLeft )

   cText   := "Message Success Action"
   oTip := TToast():NewToast( nType, cText, cBmp, 400, 40, oWnd, ;
               CLR_BLUE, , CLR_WHITE, 255, 4000, !lUp, , lLeft )
   oTip:nWRadio    := 6
   oTip:nHRadio    := 6
   oTip:ActivaAlert( oWnd )

   // nTime = -1, no timer active, and user close alert with button X
   Syswait( 1.0 )
   cText   := "Message Error Action"
   oTip := TToast():NewToast( nType, cText, cBmp, 400, 40, oWnd, ;
               CLR_RED, , CLR_WHITE, 255, -1, !lUp, , !lLeft )
   oTip:nWRadio    := 6
   oTip:nHRadio    := 6
   oTip:ActivaAlert( oWnd )

   Syswait( 1.0 )
   cText   := "Message Attention User"
   oTip := TToast():NewToast( nType, cText, cBmp, 400, 40, oWnd, ;
               CLR_HBLUE, , CLR_WHITE, 255, 4000, lUp, , !lLeft )
   oTip:nWRadio    := 6
   oTip:nHRadio    := 6
   oTip:lBtnClose  := .F.
   oTip:lBtnSetup  := .F.
   oTip:ActivaAlert( oWnd )

   Syswait( 1.0 )
   cText   := "Message Received"
   oTip := TToast():NewToast( nType, cText, cBmp, 400, 40, oWnd, ;
               CLR_GREEN, , CLR_WHITE, 255, 4000, lUp, , lLeft )
   oTip:nWRadio    := 6
   oTip:nHRadio    := 6
   oTip:lBtnClose  := .F.
   oTip:lBtnSetup  := .F.
   oTip:ActivaAlert( oWnd )

Return oTip
//----------------------------------------------------------------------------//
 
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Notification boxes colored

Postby Silvio.Falconi » Sat May 19, 2018 7:52 pm

good it can run
only can you make show and dissapper slowly ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: Notification boxes colored

Postby cnavarro » Sun May 20, 2018 6:45 pm

Ok, try with this sample ( last message )
For show slowly, need modify class

Code: Select all  Expand view


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

Function HazAlert204( oWnd, nType )

   local oTip
   local bInit
   local cText
   local cBmp    := "..\bitmaps\16x16\alert.bmp"
   local lLeft   := .T.
   local lUp     := .T.
   DEFAULT nType := 1
   
   // oTip := TToast():NewToast( nToast, cText, cBmp, nWidth, nHeight, oWnd, nClrPane, ;
   //                  nClrPane2, nClrText, nLev, nTime, lUp, bRet, lLeft )

   cText   := "Message Success Action"
   oTip := TToast():NewToast( nType, cText, cBmp, 400, 40, oWnd, ;
               CLR_BLUE, , CLR_WHITE, 255, 4000, !lUp, , lLeft )
   oTip:nWRadio    := 6
   oTip:nHRadio    := 6
   oTip:ActivaAlert( oWnd )

   Syswait( 1.0 )
   cText   := "Message Error Action"
   oTip := TToast():NewToast( nType, cText, cBmp, 400, 40, oWnd, ;
               CLR_RED, , CLR_WHITE, 255, 4000, !lUp, , !lLeft )
   oTip:nWRadio    := 6
   oTip:nHRadio    := 6
   oTip:ActivaAlert( oWnd )

   Syswait( 1.0 )
   cText   := "Message Attention User"
   oTip := TToast():NewToast( nType, cText, cBmp, 400, 40, oWnd, ;
               CLR_HBLUE, , CLR_WHITE, 255, 4000, lUp, , !lLeft )
   oTip:nWRadio    := 6
   oTip:nHRadio    := 6
   oTip:lBtnClose  := .F.
   oTip:lBtnSetup  := .F.
   oTip:ActivaAlert( oWnd )


   Syswait( 1.0 )
   cText   := "Message Received"
   oTip := TToast():NewToast( nType, cText, cBmp, 400, 40, oWnd, ;
               CLR_GREEN, , CLR_WHITE, 255, 4000, lUp, , lLeft )
   oTip:nWRadio    := 6
   oTip:nHRadio    := 6
   oTip:lBtnClose  := .F.
   oTip:lBtnSetup  := .F.

   //oTip:bValid     := { || TipTransHide( oTip ), .T. }     // Only Hide slowly
   oTip:bValid     := { || TipTransFlicker( oTip ), .T. }     // Flicker slowly at end

   oTip:ActivaAlert( oWnd )

Return oTip

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

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

#define LWA_ALPHA 2

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

static function TipTransFlicker( oObj )

   TipTransHide( oObj )
   TipTransShow( oObj )
   TipTransHide( oObj )

return NIL

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

static function TipTransHide( oObj )

   local x

   for x = oObj:nLevel to 0 step -1
      SetLayeredWindowAttributes( oObj:hWnd, , x, LWA_ALPHA )
      SysWait( 0.0003 )
   next x

return NIL

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

static function TipTransShow( oObj )

   local x

   for x = 1 to oObj:nLevel
      SetLayeredWindowAttributes( oObj:hWnd, , x, LWA_ALPHA )
      SysWait( 0.0003 )
   next x

return NIL

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

 
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Notification boxes colored

Postby Silvio.Falconi » Mon May 21, 2018 6:51 pm

thanks but here not run ok

Please try this test

1. the Message Toast is not on the dialog
2. the animation ( show and dissaperar not run ok)



Code: Select all  Expand view
#include "FiveWin.Ch"
#include "constant.ch"


#define LWA_ALPHA 2

Function ShowInvoice()
Local nBottom   := 47.2
Local nRight    := 147.4
Local nWidth    :=  Max( nRight * DLG_CHARPIX_W, 180 )
Local nHeight   := nBottom * DLG_CHARPIX_H

 DEFINE DIALOG oDlg SIZE nWidth, nHeight   PIXEL  ;
   TITLE "Prenotazione n. "

ACTIVATE DIALOG oDlg CENTERED;
on init Message(oDlg)
//------------------------------------------------//


Function Message(oDlg)

 Local  cText   := "Message Received"
 Local  nType   := 1
 Local  cBmp    := "c:\work\fwh\bitmaps\16x16\check.bmp"
 local lUp     := .T.
 local lLeft   := .T.
 Local oTip
 
   oTip := TToast():NewToast( nType, cText, cBmp, 400, 40, oDlg, ;
               CLR_GREEN, , CLR_WHITE, 255, 4000, lUp, , lLeft )

   oTip:nWRadio    := 6
   oTip:nHRadio    := 6
   oTip:lBtnClose  := .F.
   oTip:lBtnSetup  := .F.
   oTip:bValid     := { || TipTransFlicker( oTip ), .T. }

   oTip:ActivaAlert( oDlg )

return nil

static function TipTransFlicker( oObj )

   TipTransHide( oObj )
   TipTransShow( oObj )
   TipTransHide( oObj )

return NIL

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

static function TipTransHide( oObj )

   local x

   for x = oObj:nLevel to 0 step -1
      SetLayeredWindowAttributes( oObj:hWnd, , x, LWA_ALPHA )
      SysWait( 0.0003 )
   next x

return NIL


static function TipTransShow( oObj )

   local x

   for x = 1 to oObj:nLevel
      SetLayeredWindowAttributes( oObj:hWnd, , x, LWA_ALPHA )
      SysWait( 0.0003 )
   next x

return NIL
 
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: Notification boxes colored

Postby cnavarro » Mon May 21, 2018 7:29 pm

Ok, change METHOD NewToast in class TToast

Code: Select all  Expand view

.../...
   nBottom      := nTop  + nHeight
   nRight       := nLeft + nWidth
   if ::lAlert
      // Add this
      if !Empty( ::oWndEvent )
         aPoint := ClientToScreen( ::oWndEvent:hWnd, { nTop, nLeft } )
         aPoint := ScreenToClient( ::hWnd, aPoint )
         nTop   := aPoint[ 1 ]
         nLeft  := aPoint[ 2 ]
         nBottom := aPoint[ 1 ] + nHeight
         nRight  := aPoint[ 2 ] + nWidth
      endif
      ::Super:New( nTop, nLeft, nBottom, nRight,, nStyle,,,, ::oWndEvent,,, nClrText, nClrPane,,,,,,,.T., nStyleEx,,,)
      //
   endif
.../...

// and at end of method Add this

   ::bInit   := { || Self:TToolWindow(), ;
                     IF( !HB_IsNIL( ::oWndEvent ), Self:oWndEvent:SetFocus(), ), ;
                     Self:nIT := Len( aTToast ), ;
                     if( Self:lHistory, Self:AddToast(), ) }

return Self

// in method ActivaAlert change this

.../...

   ACTIVATE WINDOW Self    // Remove clause ON INIT

 
Last edited by cnavarro on Mon May 21, 2018 8:45 pm, edited 1 time in total.
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Notification boxes colored

Postby Silvio.Falconi » Mon May 21, 2018 7:38 pm

I have allways the message go out of the dialog and not on the dialog
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: Notification boxes colored

Postby cnavarro » Mon May 21, 2018 7:56 pm

With my last modification ?
Not, run OK
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Notification boxes colored

Postby Silvio.Falconi » Mon May 21, 2018 8:36 pm

I insert your modification and I see allway the mesage out of the dialog
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: Notification boxes colored

Postby cnavarro » Mon May 21, 2018 8:44 pm

Put all my modifications in METHOD NEWTOAST not Method New
Revise my modifications ( all lines )
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Notification boxes colored

Postby Silvio.Falconi » Tue May 22, 2018 6:44 am

I made all your modifications
send me your ttoast class
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 61 guests

cron