TO Cristobal : Message position

TO Cristobal : Message position

Postby Silvio.Falconi » Tue Jun 08, 2021 8:21 am

some time ago I wrote to you because I had problems positioning a message with TToast class
I explained to you that in a resizable dialog the class did not work as it should and I also sent you the example
I explained to you that the message created with the class being another entity (oWnd), did not behave as if it were an object control.
In fact, if the user moves the dialog, the message is shown elsewhere and not where the programmer wants it to be placed
Is there any news for any changes?
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: 7063
Joined: Thu Oct 18, 2012 7:17 pm

Re: TO Cristobal : Message position

Postby cnavarro » Tue Jun 08, 2021 11:21 am

Sorry Dear Silvio
The reply mail stayed in "drafts"
As you can verify your problem has nothing to do with TToast class
Please try with your sample modified
Code: Select all  Expand view  RUN

#include "fivewin.ch"

#define ORANGE      RGB(255,165,0)
#define LIGHTGREEN  RGB(144,238,144)
#define RED         RGB(255,0,0)
#define WHITE       RGB(255,255,255)
#define ROYALBLUE   RGB(65,105,225)

Function test()

   Local oDlg
   Local oFolder
   Local oBtnSearch

   DEFINE DIALOG oDlg SIZE 1180,650  PIXEL   ;
      TITLE "test" ;
       STYLE nOR( WS_CAPTION, WS_MAXIMIZEBOX, WS_MINIMIZEBOX, WS_THICKFRAME )


 @  1, 0 FOLDEREX oFolder OF oDlg SIZE oDlg:nWidth - 585, oDlg:nHeight - 390 PIXEL  ;
         PROMPT "Prenotazioni","Pagamenti","Familiari"

   @ 08, 10 BTNBMP oBtnSearch FILENAME "INVOICE_CERCA" ;   // 355
       SIZE 15,12 PIXEL OF oFolder:aDialogs[1] NOBORDER ;
       action  Messaggio(1, oFolder:aDialogs[ 1 ],,oBtnSearch)   // oDlg
       oBtnSearch:lTransparent:=.t.

      oDlg:bResized  := <||
                     local oRect
                     oRect                := oDlg:GetCliRect()
                     oFolder:nWidth       := oRect:nRight-2
                     oFolder:nHeight      := oRect:nBottom-160
                     //oBtnSearch:nTop      := oRect:nTop+5
                     //oBtnSearch:nLeft     := oRect:nleft+550
                     oFolder:Default()
                     return nil
                      >
    ACTIVATE DIALOG oDlg CENTERED  ;
    ON INIT ( Messaggio( 1, oFolder:aDialogs[ 1 ],,oBtnSearch) )
    //               ON INIT (eval( oDlg:bResized ) ,Messaggio(1,oDlg,,oBtnSearch) )

return nil

//------------------------------------------------------------------------------------------------//
Function Messaggio(numero,odlg,nValore,obj)
   local  nColor1,nColor2,nColortxt,cTesto,cImage
    local  nWidth  :=420
    local nHeight:= 35
    local x,y,oRect

    DEFAULT nValore  := 10

   Do case
   case Numero =1
          nColor1 :=  ORANGE
          nColor2 :=  ORANGE
          nColortxt:= WHITE
         cTesto:= "Elemento non  disponibile! "
         cImage:= "CHECK3"

   case Numero = 2
       nColor1 :=  LIGHTGREEN
       nColor2 :=  LIGHTGREEN
       nColortxt:=   ROYALBLUE
       cTesto:= "Elemento  disponibile!"
       cImage:= "CHECK2"


   case Numero =3
       nColor1 :=  ORANGE
       nColor2 :=  RED
       nColortxt:=  WHITE
       cTesto:= ("Attenzione !!!Non è stata trovata nessuna tariffa! Si inserisce il valore € "+;
                          ltrim(str(nvalore))+". Controllare le tariffe")
       cImage:= "XPALERT"
       nWidth:= 740
       nHeight:= 35

   ENDCASE
   MessageToast( 1, cTesto, cImage,;
                      nWidth, nHeight, oDlg, nColor1, nColor2, ;
                      nColortxt, , , .T., , .F., .F., .F., -10, 20 )

Return nil
//---------------------------------------------------------------------------------//

 Function MessageToast( nType, cText, cBmp, nWidth, nHeight, oWnd, nClrPane, nClrPane2, ;
                 nClrText, nLev, nTime, lUp, bRet, lLeftP, lAlert, lShadow,;
                  nOffY, nOffX, nFont )

   local oTip
   local bInit

   DEFAULT lLeftP   := .t.
   DEFAULT lUp      := .T.
   DEFAULT nType    := 1
   DEFAULT lAlert   := .F.
   DEFAULT lShadow  := .T.
   DEFAULT nLev     := 180
   DEFAULT nTime    := 4000
   DEFAULT nOffY     := 0
   DEFAULT nOffX     := 0
   DEFAULT nFont     := -10
   /*
     oTip := TToast():NewToast( nType, cText, cBmp, nWidth, nHeight, oWnd,;
                                 nClrPane, nClrPane2, nClrText,;
                                 nLev, nTime, lUp, lLeftP,lAlert, lShadow,;
                                 nOffY, nOffX, nFont )
   */


   oTip := TToast():NewToast( nType, cText, cBmp, nWidth, nHeight, oWnd, ;
               nClrPane, nClrPane2,nClrText, nLev, nTime, lUp, bRet, lLeftp, .T., .T., nOffY, nOffX )
   oTip:nWRadio    := 6
   oTip:nHRadio    := 6
   oTip:lBtnClose  := .f.
   oTip:lBtnSetup  := .f.
   //oTip:bValid     := { || TipTransHide( oTip ), .T. }
   oTip:ActivaAlert()

return nil

function O2a( cCadena ) ; return Oemtoansi( cCadena )
 
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: 6548
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: TO Cristobal : Message position

Postby Silvio.Falconi » Tue Jun 08, 2021 8:27 pm

maybe it is me who does not explain well, if the user moves, resizes the dialog the message is not always in the same place as you can see in this figure.


Image


ttoast should behave like a control, a get, an image instead this is not possible because
ttoast was born from a modification of Paco's tooltip class and in my opinion it cannot be used to display a colored message on a dialog, patience ... .
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: 7063
Joined: Thu Oct 18, 2012 7:17 pm

Re: TO Cristobal : Message position

Postby cnavarro » Tue Jun 08, 2021 10:44 pm

Silvio.Falconi wrote:maybe it is me who does not explain well, if the user moves, resizes the dialog the message is not always in the same place as you can see in this figure.
ttoast should behave like a control, a get, an image instead this is not possible because
ttoast was born from a modification of Paco's tooltip class and in my opinion it cannot be used to display a colored message on a dialog, patience ... .


Have you used my example that I put in my previous post or are you using yours?
A picture is worth a thousand words
Image
It is a class used by many users, including myself, without any problem.
How can you know what I have based on to develop that class?
In any case, you can still use the MsgInfo function which works wonders.
Sure enough, patience, you said so.
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: 6548
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: TO Cristobal : Message position

Postby Silvio.Falconi » Wed Jun 09, 2021 10:10 am

cnavarro wrote:
Silvio.Falconi wrote:maybe it is me who does not explain well, if the user moves, resizes the dialog the message is not always in the same place as you can see in this figure.
ttoast should behave like a control, a get, an image instead this is not possible because
ttoast was born from a modification of Paco's tooltip class and in my opinion it cannot be used to display a colored message on a dialog, patience ... .


Have you used my example that I put in my previous post or are you using yours?
A picture is worth a thousand words

It is a class used by many users, including myself, without any problem.
How can you know what I have based on to develop that class?
In any case, you can still use the MsgInfo function which works wonders.
Sure enough, patience, you said so.



>Have you used my example that I put in my previous post or are you using yours?
I'm using the example what you posted on the forum

>How can you know what I have based on to develop that class?
because it is the same , c5tooltip of Paco of Canal5 use a Wnd ( CLASS TToast FROM TWindow as CLASS TC5Tip FROM TWindow),

if you did a class from the beginning you would have done a control (object) and not a window



resize ok

Now before to recreate the ttoast ( pressing the button) move the dialog and show me ( and on forum) what happen!!!
then press the button to recreate the ttoast and then move the dialog , where i the toast ? show me ( and on forum) what happen!!!

if it was a control it stayed at the same point if you move the dialog, since it is not an object this does not happen
for example the folder is always there it is not moved as is possible?


Image

>A picture is worth a thousand words
yes of course, I think I show to all forum What I mean !!!
your class ttoast is another entity, it is a wnd not a control obj, if it was a control object, it was on the dialog also if the user move and resize the dialog ( as the folder and the button)

that is, to make the ignorant on the subject understand,

I want to explain that the TToast class is positioned in the coordinates of the screen of your computer and not in the coordinates of the dialog,

thus doing what I explained above with the animation happens.
Last edited by Silvio.Falconi on Wed Jun 09, 2021 11:34 am, edited 2 times 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: 7063
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 70 guests