BUG in TToast!?

BUG in TToast!?

Postby byte-one » Tue Oct 23, 2018 8:41 pm

If i use the DATA bReturn this codeblock will never calling. I see in the source of this class that ::end() is using and not :destroy(), also the method :destroy() with the bReturn-codeblock is ignored!
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: BUG in TToast!?

Postby cnavarro » Tue Oct 23, 2018 8:46 pm

Please explain what you need and the purpose of using TToast
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: 6501
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: BUG in TToast!?

Postby byte-one » Tue Oct 23, 2018 9:01 pm

I will at end of my programm show a TToast-alert with a delay of 5 seconds. But the ending from my program waits not to the end from the TToast. So i pack the code from ending the program in the bReturn-codeblock but no call to this codeblock is executed!
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: BUG in TToast!?

Postby cnavarro » Tue Oct 23, 2018 9:34 pm

Dear Günther, this run ok, for me
MsgStop is show at end
Code: Select all  Expand view


   oMsg := TToast():NewToast( 4, cM, cBmp, 320, nH, oWindow, ;
                              Rgb( 88, 88, 88 ), Rgb( 88, 88, 88 ), ;
                              CLR_WHITE, , nT, .F.,, .F. )
   TipTimeHide( 0.008 )
   oMsg:bReturn     := { || MsgStop( "Final" ) }
   oMsg:lCenterText := .T.
   oMsg:bValid      := { || TipTransHide( oMsg ), .T. }
   oMsg:ActivaAlert( oWindow )

 
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: 6501
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: BUG in TToast!?

Postby cnavarro » Tue Oct 23, 2018 9:39 pm

Which version of fw do you use?
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: 6501
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: BUG in TToast!?

Postby byte-one » Tue Oct 23, 2018 9:53 pm

FWH 18.04
I see, you use TToast():NewToast(….) i use TTost():New(….)
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: BUG in TToast!?

Postby byte-one » Tue Oct 23, 2018 10:04 pm

I am using NewToast() but no ok. If i use ttoast on start from the program in the clausula ON INIT with a bReturn the program freezes!
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: BUG in TToast!?

Postby cnavarro » Tue Oct 23, 2018 10:08 pm

byte-one wrote:I am using NewToast() but no ok. If i use ttoast on start from the program in the clausula ON INIT with a bReturn the program freezes!


Not use TToast at ON INIT
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: 6501
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: BUG in TToast!?

Postby cnavarro » Tue Oct 23, 2018 10:10 pm

This code run ok for me also, and bReturn is run at end

Code: Select all  Expand view


Function HazAlert1( oWnd, lLines, lBmp, lMnu )

   local oTip
   local oBrw

   DEFAULT lLines  := .T.
   DEFAULT lBmp    := .T.
   DEFAULT lMnu    := .F.                     // CLR_RED, CLR_WHITE
   oTip := TToast():New( 0, 0, 290, 350, oWnd, , , , , 0 , 0, nLevel,,,, lUp,,,, lLeft )

   WITH OBJECT oTip
      :nTimer             := nT
      :lLineHeader        := lLines
      :nClrTextHeader     := CLR_GREEN
      :cHeader            :=  "Header"
      if lBmp
         :cBmpHeader         := "..\bitmaps\16edit.bmp" //people2.bmp"  //"..\bitmaps\16edit.bmp"
      endif
     
      :lLineFoot          := lLines
      :nClrTextFoot       := CLR_YELLOW
      :lRightAlignFoot    := .T.
      if lBmp
         :cBmpFoot           := "..\bitmaps\save16.bmp" //pdf.bmp"      //"save16.bmp"
      endif
     
      :lSplitHdr          := .T.
      :lLeft              := lBmp
      if lBmp
         :cBmpLeft           := "..\bitmaps\attach.bmp"  //"16code.bmp"
      endif
     
      :lRightAlignBody    := .F.
      :nClrTextBody       := CLR_BROWN
      :cBody              := "En un lugar de la Mancha de cuyo nombre no quiero acordarme"
     
      //:lBtnClose          := .T.
      :lBorder            := .F.
      if lMnu
         :bMnuFoot  := { | nRow, nCol, oWnd | MnuConfig( nRow, nCol, oWnd ) }
      endif

      :bReturn      := { || MsgStop( "Stop" ) }

      :CreateFromCode()
   END
   
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: 6501
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: BUG in TToast!?

Postby cnavarro » Tue Oct 23, 2018 10:15 pm

cnavarro wrote:
byte-one wrote:I am using NewToast() but no ok. If i use ttoast on start from the program in the clausula ON INIT with a bReturn the program freezes!


Not use TToast at ON INIT


I tested using TToast in clause ON INIT and run OK also
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: 6501
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: BUG in TToast!?

Postby cnavarro » Tue Oct 23, 2018 10:48 pm

Günther, try with this sample and tell me

Code: Select all  Expand view


#include "Fivewin.ch"


Static oWnd
Static oMsg
Static nTimeMsg          := 0.05

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

Function Main()


   DEFINE WINDOW oWnd TITLE "TToast Test at INIT" MENU BuildMenu()



   ACTIVATE WINDOW oWnd MAXIMIZED ON INIT MyMessage( "Inicializando....." + CRLF + "Atencion", , )

Return nil

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

Function BuildMenu()

   local oMenu
   MENU oMenu
     MENUITEM "Files"
        MENU
           MENUITEM "Edit"
           SEPARATOR
           MENUITEM "Exit" ACTION oWnd:End()
        ENDMENU
     MENUITEM "Help"
   ENDMENU

Return oMenu

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

Static Function MyMessage( cM, nT, nC )

   local cBmp
   local nH   := 0
   DEFAULT cM := "No messages"
   DEFAULT nT := nTimeMsg * 1000

   if !Hb_IsNil( oMsg )
      oMsg:BuildTimer( .T. )
      oMsg:End()
      oMsg    := nil
   endif

   cM         += CRLF + " ... "
   nH         := Max( NumAt( CRLF, cM ) - 3, 3 ) * 48
   oMsg := TToast():NewToast( 4, cM, cBmp, 320, nH, oWnd, ;
                              Rgb( 88, 88, 88 ), Rgb( 88, 88, 88 ), ;
                              CLR_WHITE, , nT, .F.,, .F. )
   TipTimeHide( 0.008 )
   oMsg:bReturn     := { || MsgStop( "Final" ) }
   oMsg:lCenterText := .T.
   oMsg:bValid      := { || TipTransHide( oMsg ), .T. }
   oMsg:ActivaAlert()

Return oMsg

//----------------------------------------------------------------------------//
 
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: 6501
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: BUG in TToast!?

Postby byte-one » Wed Oct 24, 2018 9:38 am

Cristobal, i have changed the code. Now it seems to functioning. Please see.
Code: Select all  Expand view
METHOD Destroy() CLASS TToast

   if !Empty( ::oFontHdr )
      ::oFontHdr :End()
   endif
   if !Empty( ::oFontHdr2 )
      ::oFontHdr2:End()
   endif
   if !Empty( ::oFontBody )
      ::oFontBody:End()
   endif
   if !Empty( ::oFontFoot )
      ::oFontFoot:End()
   endif
   if !Empty( ::hRgn )
      DeleteObject( ::hRgn )
   endif
   if valtype(::bReturn) == "B"
    Eval( ::bReturn )
   endif
   ::Super:Destroy()
   if ::lHistory
      ::DelToast()
   endif

Return nil//Eval( ::bReturn ) //, oSelf
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: BUG in TToast!?

Postby cnavarro » Wed Oct 24, 2018 10:38 am

Ok, it is another possibility that I will have to evaluate, but it seems that it can work without problems
I will keep you informed
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: 6501
Joined: Wed Feb 15, 2012 8:25 pm
Location: España


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 20 guests