Tooltip with multiline

Moderator: Rathinagiri

KDJ
Posts: 223
Joined: Mon Sep 05, 2016 3:04 am
Location: Poland
Been thanked: 262 times

Re: Tooltip with multiline

Post by KDJ » Wed Sep 14, 2016 6:07 pm

emzampi

See on msdn: https://msdn.microsoft.com/en-us/librar ... s.85).aspx

Code: Select all

LOCAL hWndToolTip
LOCAL nAutopopTime

hWndToolTip := GetFormToolTipHandle('FormName')

//set display time
nAutopopTime := 2000 //miliseconds
SendMessage(hWndToolTip, 1027 /*TTM_SETDELAYTIME*/, 2 /*TTDT_AUTOPOP*/, nAutopopTime)

//get display time
nAutopopTime := SendMessage(hWndToolTip, 1045 /*TTM_GETDELAYTIME*/, 2 /*TTDT_AUTOPOP*/, 0)
MsgInfo(nAutopopTime)

EduardoLuis
Posts: 651
Joined: Tue Jun 04, 2013 6:33 pm
Location: Argentina
Has thanked: 1 time
Been thanked: 61 times

Post by EduardoLuis » Wed Sep 14, 2016 7:15 pm

Hi PabloCesar
Wellcome back.-

Hola PabloCesar
Bienvenido.-

User avatar
mustafa
Posts: 835
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Been thanked: 119 times
Contact:

Post by mustafa » Thu Sep 15, 2016 1:59 pm

Another Option

Code: Select all

#include <hmg.ch>

*--------------------------- TOOLTIP ----------------------------*
*--------- Rutina cedida  Por Marcos Antonio Gambeta ------------*
#define WM_USER                0x400
#define TTM_SETTITLE       (WM_USER + 32)
#define CRLF                      Chr(13)+Chr(10)
*----------------------------------------------------------------*
#define TTI_NONE                     0
#define TTI_INFO                     1
#define TTI_WARNING                  2
#define TTI_ERROR                    3
*----------------------------------------------------------------*
#define TTI_INFO_LARGE               4
#define TTI_WARNING_LARGE            5
#define TTI_ERROR_LARGE              6
*----------------------------------------------------------------*
#define TTI_STOP                     7
*----------------------------------------------------------------*

Function Main()
 
  SET TOOLTIPSTYLE BALLOON
  SET TOOLTIPBACKCOLOR { 255,255,000 }   // Does not work with Win-10

   DEFINE WINDOW Form_1 AT 219 , 253 WIDTH 478 HEIGHT 186 ;
          TITLE "ToolTip with Title and Icone" Main Nomaximize
   
   DEFINE BUTTON Button_1
       ROW    40
       COL    20
       WIDTH  100
       HEIGHT 28
       ACTION Nil
       CAPTION "Print option"
       FONTNAME "Arial"
       FONTSIZE 9
       TOOLTIP SPACE(3) +"Click here to Start Printing"+ CRLF +;
               SPACE(13)+"Line Centered"+ CRLF + ;
               SPACE(10) +"Hello World Hmg"
   END BUTTON
   
   DEFINE BUTTON Button_2
       ROW    80
       COL    20
       WIDTH  100
       HEIGHT 28
       ACTION Nil
       CAPTION "Cancel option"
       FONTNAME "Arial"
       FONTSIZE 9
       TOOLTIP SPACE(9) +"Click here to Cancel"+ CRLF +;
               SPACE(12)+"Line Centered"+ CRLF + ;
               SPACE(10)+"Hello World Hmg"
   END BUTTON

END WINDOW

*---------------------------------------------------------   TOOLTIP   ----------------------------------------------*
  SendMessageString( GetFormToolTipHandle ("Form_1"), TTM_SETTITLE, TTI_STOP , SPACE(4)+"Preview of Report"+SPACE(4) )  
*--------------------------------------------------------------------------------------------------------------------*
 
CENTER WINDOW Form_1
ACTIVATE WINDOW Form_1
Return Nil

*---------------------------------------*
#pragma BEGINDUMP

#include <windows.h>
#include "hbapi.h"

HB_FUNC ( SENDMESSAGESTRING )
{
  hb_retnl( (LONG) SendMessage( (HWND) hb_parnl(1), (UINT) hb_parni(2), (WPARAM) hb_parnl(3), (LPARAM) (LPSTR) hb_parc(4) ) );
}

#pragma ENDDUMP
*---------------------------------------*

Regards

Mustafa

EduardoLuis
Posts: 651
Joined: Tue Jun 04, 2013 6:33 pm
Location: Argentina
Has thanked: 1 time
Been thanked: 61 times

Post by EduardoLuis » Fri Sep 16, 2016 4:41 pm

Hy Mustafa:

I've been using your sample since last year and word perfectly and looks really nice.-
By the way, Dr. Claudio Soto introduces a compress version of that since version 3.41 (HMG), if you go to my sample Miniwriter on Samples\Applications you'll see in detail.- Also works fine.-
With regards.
Eduardo

Hola Mustafa:

He venido utilizando tu ejemplo desde el ultimo año y funciona perfectamente además de lucir bien.-
A propósito, el Dr. Claudio Soto introdujo una version comprimida desde la version 3.41 (HMG), si vas a mi aplicación Miniwriter ubicada en Samples\Applications, la verás en detalle.- Tambien funciona perfectamente.-
Cordialmente
Eduardo

User avatar
mustafa
Posts: 835
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Been thanked: 119 times
Contact:

Post by mustafa » Sun Sep 18, 2016 12:09 pm

Hola Eduardo
el tema del color no funciona en Win-10 64 bits
---> SET TOOLTIPBACKCOLOR { 255,255,000 } //<---- Does not work with Win-10
Saludos
Mustafa

User avatar
mustafa
Posts: 835
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Been thanked: 119 times
Contact:

Post by mustafa » Mon Sep 19, 2016 10:55 am

more options with " TOOLTIPCUSTOMDRAW"

Code: Select all

#include <hmg.ch>

*----------------------------------------------------------------*
#define CRLF               Chr(13)+Chr(10)
*----------------------------------------------------------------*
#define TTI_NONE                  0
#define TTI_INFO                  1
#define TTI_WARNING               2
#define TTI_ERROR                 3
*----------------------------------------------------------------*
#define TTI_INFO_LARGE            4
#define TTI_WARNING_LARGE         5
#define TTI_ERROR_LARGE           6
*----------------------------------------------------------------*
#define TTI_STOP                  7
#define TTI_STOP_LARGE            8
*----------------------------------------------------------------*

*----------------------------------------- Diferentes tipos de Iconos ---------------------------------------------*
*----------------------------------------  Different types of Icons   ---------------------------------------------*

/*
       SET TOOLTIPCUSTOMDRAW FORM &cCurrentForm  TITLE cToolTipTitle  ICON TOOLTIPICON_INFO  
       SET TOOLTIPCUSTOMDRAW FORM &cCurrentForm  TITLE cToolTipTitle  ICON TOOLTIPICON_INFO_LARGE  

       SET TOOLTIPCUSTOMDRAW FORM &cCurrentForm  TITLE cToolTipTitle  ICON TOOLTIPICON_WARNING 
       SET TOOLTIPCUSTOMDRAW FORM &cCurrentForm  TITLE cToolTipTitle  ICON TOOLTIPICON_WARNING_LARGE  
 
       SET TOOLTIPCUSTOMDRAW FORM &cCurrentForm  TITLE cToolTipTitle  ICON TOOLTIPICON_ERROR  
       SET TOOLTIPCUSTOMDRAW FORM &cCurrentForm  TITLE cToolTipTitle  ICON TOOLTIPICON_ERROR_LARGE    

*-------------------------------------------------------------------------------------------------------*

       SET TOOLTIPCUSTOMDRAW FORM &cCurrentForm  TITLE cToolTipTitle  ICON TTI_INFO 
       SET TOOLTIPCUSTOMDRAW FORM &cCurrentForm  TITLE cToolTipTitle  ICON TTI_INFO_LARGE  

       SET TOOLTIPCUSTOMDRAW FORM &cCurrentForm  TITLE cToolTipTitle  ICON TTI_WARNING
       SET TOOLTIPCUSTOMDRAW FORM &cCurrentForm  TITLE cToolTipTitle  ICON TTI_WARNING_LARGE 

       SET TOOLTIPCUSTOMDRAW FORM &cCurrentForm  TITLE cToolTipTitle  ICON  TTI_ERROR   
       SET TOOLTIPCUSTOMDRAW FORM &cCurrentForm  TITLE cToolTipTitle  ICON  TTI_ERROR_LARGE      

       SET TOOLTIPCUSTOMDRAW FORM &cCurrentForm  TITLE cToolTipTitle  ICON TTI_STOP          <-Icon -> Blue Circle
       SET TOOLTIPCUSTOMDRAW FORM &cCurrentForm  TITLE cToolTipTitle  ICON TTI_STOP_LARGE    <-Icon = ->TTI_ERROR  */
 
*------------------------------------------------------------------------------------------------*

Function Main()

   SET TOOLTIPCUSTOMDRAW ON
   SET TOOLTIPSTYLE BALLOON 
   SET TOOLTIPBACKCOLOR { 250, 250, 210}       // Does not work with Win-10


  PRIVATE cCurrentForm  := 'Form_1'
  PRIVATE cToolTipTitle := SPACE(4)+"Preview of Report"+SPACE(4)  

   DEFINE WINDOW Form_1 AT 219 , 253 WIDTH 478 HEIGHT 186 ;
          TITLE "ToolTip with Title and Icone" Main Nomaximize
   
   DEFINE BUTTON Button_1
       ROW    40
       COL    20
       WIDTH  100
       HEIGHT 28
       ACTION Nil
       CAPTION "Print option"
       FONTNAME "Arial"
       FONTSIZE 9
       TOOLTIP SPACE(3) +"Click here to Start Printing"+ CRLF +;
               SPACE(13)+"Line Centered"+ CRLF + ;
               SPACE(10) +"Hello World Hmg"
   END BUTTON
   
   DEFINE BUTTON Button_2
       ROW    80
       COL    20
       WIDTH  100
       HEIGHT 28
       ACTION Nil
       CAPTION "Cancel option"
       FONTNAME "Arial"
       FONTSIZE 9
       TOOLTIP SPACE(9) +"Click here to Cancel"+ CRLF +;
               SPACE(12)+"Line Centered"+ CRLF + ;
               SPACE(10)+"Hello World Hmg"
   END BUTTON

*---------------------------------   TOOLTIP  Message from the Sample --------------------------------------------*
       SET TOOLTIPCUSTOMDRAW FORM &cCurrentForm  TITLE cToolTipTitle  ICON TTI_STOP      
*-----------------------------------------------------------------------------------------------------------------* 

  END WINDOW

  CENTER WINDOW Form_1
  ACTIVATE WINDOW Form_1

Return Nil

Saludos /Regards
Mustafa

User avatar
danielmaximiliano
Posts: 2146
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Has thanked: 162 times
Been thanked: 25 times
Contact:

Post by danielmaximiliano » Mon Sep 19, 2016 12:15 pm

Gracias por compartir Mustafa
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`.HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. : +54901169026142
Telegram Name : DaNiElMaXiMiLiAnO

EduardoLuis
Posts: 651
Joined: Tue Jun 04, 2013 6:33 pm
Location: Argentina
Has thanked: 1 time
Been thanked: 61 times

Post by EduardoLuis » Mon Sep 19, 2016 1:34 pm

Hi Mustafa:

Very nice sample, and as allways thanks for share your knowledge with all of us.-
About what you mention of color in tooltip, i test the MINIWRITER.EXE compiled under WIN XP, but executed on WIN 8 and works fine.- I will test it on a friend machine with WIN 10 and then make any comment.-
With regards.
Eduardo

Post Reply