Edit box balloon tips in WinXP
-
This is pissing me off big time. I have an edit box in a dialog and want to show a balloon tip as soon as the dialog is open:
BOOL Welcome_OnInitDialog(HWND hDlg, HWND hWndFocus, LPARAM lParam)
{
// Display the music folder (as saved in the registry)
SetDlgItemText(hDlg, IDC_MUSIC_FOLDER, g_musicFolder);WCHAR szTitle\[\] = L"Music Folder"; WCHAR szText\[\] = L"Enter the path to your music folder here, or click browse.."; EDITBALLOONTIP ebt; ebt.cbStruct = sizeof(ebt); ebt.pszTitle = szTitle; ebt.pszText = szText; ebt.ttiIcon = TTI\_INFO; Edit\_ShowBalloonTip(GetDlgItem(hDlg, IDC\_MUSIC\_FOLDER), &ebt); return TRUE;
}
It is not working. Yet, when the user clicks the OK button. My WM_COMMAND hander has no problem displaying balloon tip:
void Welcome_OnCommand(HWND hDlg, int nId, HWND hWndCtrl, UINT uCodeNotify)
{
HWND hMusicFolder = GetDlgItem(hDlg, IDC_MUSIC_FOLDER);if (nId == IDOK) { g\_musicFolder.GetFromHWnd(hMusicFolder); DWORD dwFileAttributes = GetFileAttributes(g\_musicFolder); if (dwFileAttributes == 0xffffffff || dwFileAttributes & FILE\_ATTRIBUTE\_DIRECTORY != FILE\_ATTRIBUTE\_DIRECTORY) { // Select the text in the text box. SendMessage(hMusicFolder, EM\_SETSEL, 0, -1); // Display a balloon tip. **WCHAR szTitle\[\] = L"Invalid folder name"; WCHAR szText\[\] = L"Please confirm that this is the path to your music folder."; EDITBALLOONTIP ebt; ebt.cbStruct = sizeof(ebt); ebt.pszTitle = szTitle; ebt.pszText = szText; ebt.ttiIcon = TTI\_WARNING; Edit\_ShowBalloonTip(hMusicFolder, &ebt);** return; }
.
.
.
}What's going on? Any fixes?
Thanks
-
This is pissing me off big time. I have an edit box in a dialog and want to show a balloon tip as soon as the dialog is open:
BOOL Welcome_OnInitDialog(HWND hDlg, HWND hWndFocus, LPARAM lParam)
{
// Display the music folder (as saved in the registry)
SetDlgItemText(hDlg, IDC_MUSIC_FOLDER, g_musicFolder);WCHAR szTitle\[\] = L"Music Folder"; WCHAR szText\[\] = L"Enter the path to your music folder here, or click browse.."; EDITBALLOONTIP ebt; ebt.cbStruct = sizeof(ebt); ebt.pszTitle = szTitle; ebt.pszText = szText; ebt.ttiIcon = TTI\_INFO; Edit\_ShowBalloonTip(GetDlgItem(hDlg, IDC\_MUSIC\_FOLDER), &ebt); return TRUE;
}
It is not working. Yet, when the user clicks the OK button. My WM_COMMAND hander has no problem displaying balloon tip:
void Welcome_OnCommand(HWND hDlg, int nId, HWND hWndCtrl, UINT uCodeNotify)
{
HWND hMusicFolder = GetDlgItem(hDlg, IDC_MUSIC_FOLDER);if (nId == IDOK) { g\_musicFolder.GetFromHWnd(hMusicFolder); DWORD dwFileAttributes = GetFileAttributes(g\_musicFolder); if (dwFileAttributes == 0xffffffff || dwFileAttributes & FILE\_ATTRIBUTE\_DIRECTORY != FILE\_ATTRIBUTE\_DIRECTORY) { // Select the text in the text box. SendMessage(hMusicFolder, EM\_SETSEL, 0, -1); // Display a balloon tip. **WCHAR szTitle\[\] = L"Invalid folder name"; WCHAR szText\[\] = L"Please confirm that this is the path to your music folder."; EDITBALLOONTIP ebt; ebt.cbStruct = sizeof(ebt); ebt.pszTitle = szTitle; ebt.pszText = szText; ebt.ttiIcon = TTI\_WARNING; Edit\_ShowBalloonTip(hMusicFolder, &ebt);** return; }
.
.
.
}What's going on? Any fixes?
Thanks
The dialog may not have finished initializing until
OnInitDialog()
. Try setting up the balloon tip within a handler for a fake command (I useIDC_INIT_GUI
). Post the command (usingPostMessage (WM_COMMAND, IDC_INIT_GUI)
) from withinOnInitDialog()
to ensure that the handler will be executed after the dialog has initialized itself. /ravi "There is always one more bug..." http://www.ravib.com ravib@ravib.com