CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Join Date
    May 2015
    Posts
    512

    MFC Combobox in visual studio 2022

    Hello,

    Im using visual studio 2022 installed in my project.

    I have a combobox, which needs to display negetive floats. ( Internally it is owl combobox, TComboBox )

    Eventhough the string i add is lets say "-6" , but is displaying, "6-" .. Could experts please help with this ?

    Thanks
    Pri
    Last edited by pdk5; September 12th, 2024 at 08:54 AM.

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

    Re: MFC Combobox in visual studio 2022

    What is "owl combobox"?
    What is "TComboBox"?
    Could you show how you add the values in this "TComboBox"?
    Victor Nijegorodov

  3. #3
    Join Date
    May 2015
    Posts
    512

    Re: MFC Combobox in visual studio 2022

    Thankyou very much Victor for the reply and help.

    some gui in our tool is implemented with owl (which is very old )..

    Btw

    Code:
    			// PA-Calculate combo
    			m_pPACombo->ClearList();
    			const IntToStringMap& crMap					= pHelper->GetPAKeyToStringMap();
    			for (IntToStringMap::const_iterator citer	= crMap.begin(); citer != crMap.end(); ++citer)
    			{
    				const int cnIndex = m_pPACombo->AddString(citer->second.c_str());
    				if (cnIndex >= 0)
    				{
    					m_pPACombo->SetItemData(cnIndex, (LPARAM)(citer->first));
    					if (dCurrCarrierPA == cnIndex)
    						nSelIndex = cnIndex;
    				}
    			}
    			m_pPACombo->SetSelIndex(nSelIndex);


    where the values are taken from the follwing PA_NAMES[], which is part of map

    Code:
    			const char*		PA_NAMES[]		= { "-6.00",			"-4.77",         "-3.00",        "-1.77",   "0",    "1" ,  "2",  "3", NULL };
    const double	PA_VALUES[]		= { PA_VAL_Neg_6_00dB, PA_VAL_Neg_4_77dB, PA_VAL_Neg_3_00dB, PA_VAL_Neg_1_77dB, PA_VAL_0dB, PA_VAL_1dB, PA_VAL_2dB, PA_VAL_3dB, -10 };
    const int		PA_INDEXES[]	= { PA_INDEX_Neg_6_00dB, PA_INDEX_Neg_4_77dB, PA_INDEX_Neg_3_00dB, PA_INDEX_Neg_1_77dB, PA_INDEX_0dB, PA_INDEX_1dB, PA_INDEX_2dB, PA_INDEX_3dB, -1};
    Last edited by pdk5; September 12th, 2024 at 09:30 AM.

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

    Re: MFC Combobox in visual studio 2022

    Quote Originally Posted by pdk5 View Post

    Code:
    		
    				const int cnIndex = m_pPACombo->AddString(citer->second.c_str());
    Did you debug your code?
    What values does the debugger show you for citer->second
    Victor Nijegorodov

  5. #5
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,857

    Re: MFC Combobox in visual studio 2022

    What is "owl combobox"?
    owl is Borland's Object Window Library - which was deprecated in 1997 for Visual Component Library (VCL)
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

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

    Re: MFC Combobox in visual studio 2022

    Thank you for info!

    I always thought that I'm the "one and only" such a "retrograde" to still use the obsolete means. For instance I used VC++6.0 and DAO until 2009. Only in 2009 I moved to VS2010 and ADO!
    But there are some other persons that still use more obsolete and deprecated means! LOL!
    Victor Nijegorodov

  7. #7
    Join Date
    May 2015
    Posts
    512

    Re: MFC Combobox in visual studio 2022

    @kaud : thankyou very much for explaining.

    @Victor: Our product has lot of legacy code. When the code base is huge, it becomes very difficult to move all the modules to upgrade. People just leave the old functionality and leave them. Only new features added will be using the new framework. It is because, it becomes a massive effort to upgrade all.

  8. #8
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,857

    Re: MFC Combobox in visual studio 2022

    it becomes a massive effort to upgrade all
    Yes. But when does the effort needed to maintain/update existing old software outweigh the cost of re-implementation using a modern platform? If the required changes are 'trivial' then it probably doesn't make commercial sense to re-implement. But for more substantial/on-going changes then it might.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  9. #9
    Join Date
    May 2015
    Posts
    512

    Re: MFC Combobox in visual studio 2022

    @kaud: I understand. But I myself is rather beginner level in Windows OS stuff . So cant comment on on why they have not done, .
    But at this point, my objective is to make the combobox work for my requirement ? It will be great help, if any pointers on this ...

  10. #10
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,857

    Re: MFC Combobox in visual studio 2022

    Sorry, but my knowledge of OWL got corrupted a long time ago.

    However, in Region & Language settings you can specify whether a negative number is displayed as -n or n-. Have you checked this setting?
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

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

    Re: MFC Combobox in visual studio 2022

    Quote Originally Posted by pdk5 View Post
    @kaud: I understand. But I myself is rather beginner level in Windows OS stuff . So cant comment on on why they have not done, .
    But at this point, my objective is to make the combobox work for my requirement ? It will be great help, if any pointers on this ...
    You haven't answered my questions yet. Why?
    Victor Nijegorodov

  12. #12
    Join Date
    May 2015
    Posts
    512

    Re: MFC Combobox in visual studio 2022

    @Victor: Very sorry for the delay. Yes, I did check the string value in the debugger
    Code:
    			for (IntToStringMap::const_iterator citer	= crMap.begin(); citer != crMap.end(); ++citer)
    			{
    				std::string sPa = citer->second;
    It is displaying first value of sPa as "-6.02" in the debugger !!!!

  13. #13
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,857

    Re: MFC Combobox in visual studio 2022

    ...and the region/language settings?
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  14. #14
    Join Date
    May 2015
    Posts
    512

    Re: MFC Combobox in visual studio 2022

    @kaud : Thankyou so much for willingness to help even with my basic qs

    @Victor: Thankyou too for your willingness to help too

    temp.png
    Last edited by pdk5; September 13th, 2024 at 10:13 AM.

  15. #15
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,857

    Re: MFC Combobox in visual studio 2022

    What's the style used with the TComboBox when it is created? Is it owner draw?
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

Page 1 of 2 12 LastLast

Tags for this Thread

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