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. Tooltip problem

Tooltip problem

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
5 Posts 3 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.
  • M Offline
    M Offline
    madmax0001
    wrote on last edited by
    #1

    Hello, I have a problem with a tooltip control in a modeless dialog. I have created the tooltip like this in the dialogs OnInitDialog() function:

    m\_pTip = new CToolTipCtrl();
    m\_pTip->Create(this, TTS\_ALWAYSTIP);
    m\_pTip->SetMaxTipWidth(250);
        m\_pTip->Activate(TRUE);
    m\_pTip->AddTool(this, "TEST");
    

    I also call RelayEvent in PreTranslateMessage. This works fine. But in a certain situation I must disable the parent window of the dialog, so the dialog behaves like a modal dialog. I do this just with

    m\_pParentWnd->EnableWindow(FALSE);
    

    But after this call the tooltips in my dialog do not work anymore. Does someone have a hint for me? Thank you

    H K 2 Replies Last reply
    0
    • M madmax0001

      Hello, I have a problem with a tooltip control in a modeless dialog. I have created the tooltip like this in the dialogs OnInitDialog() function:

      m\_pTip = new CToolTipCtrl();
      m\_pTip->Create(this, TTS\_ALWAYSTIP);
      m\_pTip->SetMaxTipWidth(250);
          m\_pTip->Activate(TRUE);
      m\_pTip->AddTool(this, "TEST");
      

      I also call RelayEvent in PreTranslateMessage. This works fine. But in a certain situation I must disable the parent window of the dialog, so the dialog behaves like a modal dialog. I do this just with

      m\_pParentWnd->EnableWindow(FALSE);
      

      But after this call the tooltips in my dialog do not work anymore. Does someone have a hint for me? Thank you

      H Offline
      H Offline
      Hans Dietrich
      wrote on last edited by
      #2

      Install a Windows WH_GETMESSAGE hook for the modeless dialog box. More info here: http://support.microsoft.com/kb/187988/en-us[^]

      Best wishes, Hans


      [CodeProject Forum Guidelines] [How To Ask A Question] [My Articles]

      M 1 Reply Last reply
      0
      • H Hans Dietrich

        Install a Windows WH_GETMESSAGE hook for the modeless dialog box. More info here: http://support.microsoft.com/kb/187988/en-us[^]

        Best wishes, Hans


        [CodeProject Forum Guidelines] [How To Ask A Question] [My Articles]

        M Offline
        M Offline
        madmax0001
        wrote on last edited by
        #3

        Hello Hans, thank you for your answer. I have tried this but it does not work. After calling AfxGetStaticModuleState() in the GetMessageProc, AfxGetApp() returns a NULL pointer within the proc. So I removed AFX_MANAGE_STATE(AfxGetStaticModuleState( )) and then the pointer is OK. (But here is no change in the tooltip behavior)

        LRESULT CALLBACK GetMessageProc(int nCode, WPARAM wParam, LPARAM lParam)
        {
        // Switch the module state for the correct handle to be used.
        AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
        ...

        I think the problem is not that it is a modeless dialog, because when the dialog is in modeless state, the tooltips work (without any GetMessageProc). This means that PreTranslateMessage within my dialog is called. The problem only occurs when I call

        m\_pParentWnd->EnableWindow(FALSE);
        

        in the dialog class. When I set a breakpoint in PreTranslateMessige procedure of my dialog, I can see that RelayEvent is called (But the Tooltip doens not apear): Btw: My modeless dialog is created in the mainframe, it is not in a dll. Any ideas? regards

        1 Reply Last reply
        0
        • M madmax0001

          Hello, I have a problem with a tooltip control in a modeless dialog. I have created the tooltip like this in the dialogs OnInitDialog() function:

          m\_pTip = new CToolTipCtrl();
          m\_pTip->Create(this, TTS\_ALWAYSTIP);
          m\_pTip->SetMaxTipWidth(250);
              m\_pTip->Activate(TRUE);
          m\_pTip->AddTool(this, "TEST");
          

          I also call RelayEvent in PreTranslateMessage. This works fine. But in a certain situation I must disable the parent window of the dialog, so the dialog behaves like a modal dialog. I do this just with

          m\_pParentWnd->EnableWindow(FALSE);
          

          But after this call the tooltips in my dialog do not work anymore. Does someone have a hint for me? Thank you

          K Offline
          K Offline
          KarstenK
          wrote on last edited by
          #4

          You got to activate the tooltip new. If it doesnt work create every tiem a new one.:~

          Greetings from Germany

          M 1 Reply Last reply
          0
          • K KarstenK

            You got to activate the tooltip new. If it doesnt work create every tiem a new one.:~

            Greetings from Germany

            M Offline
            M Offline
            madmax0001
            wrote on last edited by
            #5

            Hi Karsten That's it! I just have to call Activate after disabling the parent wnd. Thank you very much

            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