Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » TopWindow&PopUp, TrayIcon » TrayIcon Tool tips text lenght limited
TrayIcon Tool tips text lenght limited [message #30306] Thu, 23 December 2010 15:34 Go to next message
lucpolak is currently offline  lucpolak
Messages: 18
Registered: April 2008
Location: France
Promising Member
Hello,

I have a problem using the Tip method. Thes text is truncated after 60 characters :
http://www.harsze.com/tooltip.jpg

The code behind this line is :

Tip(t_("Temps sur Suivi de l'integration : 0:00:00 (Journée : 0:00:00 )"));



Why is it limited ?

When developping with MSVC, the text is not truncated...

Lucas
Re: TrayIcon Tool tips text lenght limited [message #30307 is a reply to message #30306] Thu, 23 December 2010 15:49 Go to previous messageGo to next message
lucpolak is currently offline  lucpolak
Messages: 18
Registered: April 2008
Location: France
Promising Member
Hello,

I find in the TrayIconWin32.cpp the function Notify which truncate the text to 60 characters :


void TrayIcon::Notify(dword msg)
{
	if(visible) {
		nid.flags = NIF_ICON|NIF_MESSAGE|NIF_TIP;
		if(nid.icon)
			DestroyIcon(nid.icon);
		nid.icon = IconWin32(icon);
		String stip = ToSystemCharset(tip);
		int len = min(stip.GetLength(), 60);
		memcpy(nid.tip, stip, len);
		nid.tip[len] = 0;
		VERIFY(Shell_NotifyIcon(msg, (NOTIFYICONDATA *)&nid));
    }
}


I'va modified the line
int len = min(stip.GetLength(), 60);


to

int len = stip.GetLength();


And it's works fine.

Lucas
Re: TrayIcon Tool tips text lenght limited [message #30308 is a reply to message #30307] Thu, 23 December 2010 16:14 Go to previous messageGo to next message
lucpolak is currently offline  lucpolak
Messages: 18
Registered: April 2008
Location: France
Promising Member
I'm seen in the MSDN and the text limit is effectively 64 bytes :

typedef struct _NOTIFYICONDATA {
  DWORD cbSize;
  HWND  hWnd;
  UINT  uID;
  UINT  uFlags;
  UINT  uCallbackMessage;
  HICON hIcon;
  TCHAR szTip[64];
  DWORD dwState;
  DWORD dwStateMask;
  TCHAR szInfo[256];
  union {
    UINT uTimeout;
    UINT uVersion;
  } ;
  TCHAR szInfoTitle[64];
  DWORD dwInfoFlags;
  GUID  guidItem;
  HICON hBalloonIcon;
} NOTIFYICONDATA, *PNOTIFYICONDATA;


But some paragraphs later :

szTip
TCHAR
A null-terminated string that specifies the text for a standard tooltip. It can have a maximum of 64 characters, including the terminating null character.

For Windows 2000 and later, szTip can have a maximum of 128 characters, including the terminating null character.


So I think that we can consider a max length of 128 and not 64

int len = min(stip.GetLength(), 127);




Re: TrayIcon Tool tips text lenght limited [message #30310 is a reply to message #30308] Thu, 23 December 2010 16:22 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
It seems right. Could it be included?

Best regards
Iñaki
Re: TrayIcon Tool tips text lenght limited [message #30367 is a reply to message #30310] Sun, 26 December 2010 11:49 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
OK, applied. TrayIcon was added a couple of years ago when we still needed to support Win98.... But I guess we can finally forget about pre-Win2K days...
Previous Topic: how to communicate between windows?
Next Topic: PROPOSAL: PopUp Example / Test
Goto Forum:
  


Current Time: Fri Mar 29 00:13:57 CET 2024

Total time taken to generate the page: 0.01281 seconds