Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Edit box balloon tips in WinXP

Edit box balloon tips in WinXP

Scheduled Pinned Locked Moved C / C++ / MFC
windows-adminhelpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sultan_of_6string
    wrote on last edited by
    #1

    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

    RaviBeeR 1 Reply Last reply
    0
    • S sultan_of_6string

      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

      RaviBeeR Offline
      RaviBeeR Offline
      RaviBee
      wrote on last edited by
      #2

      The dialog may not have finished initializing until OnInitDialog(). Try setting up the balloon tip within a handler for a fake command (I use IDC_INIT_GUI). Post the command (using PostMessage (WM_COMMAND, IDC_INIT_GUI)) from within OnInitDialog() 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

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups