CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 29 of 29
  1. #16
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Create Combobox with ToolTips

    Quote Originally Posted by symreds View Post
    ...but virtual PreSubclassWindow is already implemented in the code we download. ...
    Perhaps...
    But you haven't shown yet how exactly it is declared/defined in *your* project ...
    Victor Nijegorodov

  2. #17
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Create Combobox with ToolTips

    Quote Originally Posted by symreds View Post
    ...but virtual PreSubclassWindow is already implemented in the code we download. ...
    Perhaps...
    But you haven't shown yet how exactly it is declared/defined in *your* project ...
    Victor Nijegorodov

  3. #18
    Join Date
    Sep 2010
    Posts
    29

    Re: Create Combobox with ToolTips

    Of course I cannot post my code here because my company has rights on it. Anyway the code is more or less this:

    Code:
    CTooltipComboBox *pCombo = (CTooltipComboBox*)GetDlgItem( IDC_... ); // IDC_.... resource index of my combo
    for( number of combo items )
    {
         pCombo->AddString( combo item name );
         pCombo->SetItemTip( counter, tooltip text );
    }
    Last edited by symreds; October 19th, 2011 at 06:40 AM.

  4. #19
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Create Combobox with ToolTips

    Quote Originally Posted by symreds View Post
    Of course I cannot post my code here because my company has rights on it. Anyway the code is more or less this:

    Code:
    CTooltipComboBox *pCombo = (CTooltipComboBox*)GetDlgItem( IDC_... ); // IDC_.... resource index of my combo
    for( number of combo items )
    {
         pCombo->AddString( combo item name );
         pCombo->SetItemTip( counter, tooltip text );
    }
    Are you kidding?
    Where are the decaration/definition of PreSubclassWindow that "is not automatically called"?

    Besides, why are you using GetDlgItem? didn't you implement the control member variable for your combobox?
    Victor Nijegorodov

  5. #20
    Join Date
    Sep 2010
    Posts
    29

    Re: Create Combobox with ToolTips

    Declaration/definition of PreSubclassWindow are in CTooltipComboBox.h/.cpp

    Anyway, I've always used GetDlgItem instead of a control variable... I think it's the same...
    Last edited by symreds; October 19th, 2011 at 07:01 AM.

  6. #21
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Create Combobox with ToolTips

    Quote Originally Posted by symreds View Post
    Anyway, I've always used GetDlgItem instead of a control variable... I think it's the same...
    I don't care what you have "lways used".
    But my question is: do you only "think it's the same" or you are sure?
    And how about the article you referred to:
    To use this combo box, follow the following steps:

    1. Include TooltipComboBox.h, TooltipComboBox.cpp, TooltipListCtrl.h and TooltipListCtrl.cpp in your project.
    2. In the resource editor create a droplist combobox.
    3. Create a control member variable for the combobox in VC's classwizard.
    4. Include TooltipComboBox.h and replace CComboBox with CTooltipComboBox in your .h file. Also include afxtempl.h to support CMap.
    5. To have your own tips, you can either use SetItemTip, SetComboTip functions, or replace GetItemTip function in CTooltipListCtrl, and GetComboTip function in CTooltipComboBox.
    Victor Nijegorodov

  7. #22
    Join Date
    Sep 2010
    Posts
    29

    Re: Create Combobox with ToolTips

    Ok, I'm trying to create a control member variable...
    I use VS2010 => Class View => I find my dialog class => right click => then? (is this the right procedure?)

  8. #23
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Create Combobox with ToolTips

    Victor Nijegorodov

  9. #24
    Join Date
    Sep 2010
    Posts
    29

    Re: Create Combobox with ToolTips

    Ok... got it, now the application doesn't crash anymore (and I hit the breakpoint inside PreSubclassWindow()!) but now AddStrings() is no more working: I created an empty combo... I'm going to investigate...

  10. #25
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Create Combobox with ToolTips

    Quote Originally Posted by symreds View Post
    ... now AddStrings() is no more working: I created an empty combo...
    What is AddStrings() and how do you call it?
    Victor Nijegorodov

  11. #26
    Join Date
    Sep 2010
    Posts
    29

    Re: Create Combobox with ToolTips

    Sorry, typo error, I mean CComboBox::AddString() (without "s")

  12. #27
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Create Combobox with ToolTips

    Quote Originally Posted by symreds View Post
    Sorry, typo error, I mean CComboBox::AddString() (without "s")
    Well, how, when, and where from do you call it?
    Victor Nijegorodov

  13. #28
    Join Date
    Sep 2010
    Posts
    29

    Re: Create Combobox with ToolTips

    Post #18 (of course without initial GetDlgItem()...)

    That code is into MyDialog::OnInitDialog()
    Last edited by symreds; October 19th, 2011 at 09:10 AM.

  14. #29
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Create Combobox with ToolTips

    Quote Originally Posted by symreds View Post
    Post #18 (of course without initial GetDlgItem()...)
    Isn't copy/paste the actual code snippet easier for you than typing in this sentence?

    Quote Originally Posted by symreds View Post
    That code is into MyDialog::OnInitDialog()
    Well, it can be everywhere, but it doesn't help us to see it!
    Victor Nijegorodov

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured