-
September 12th, 2024, 08:47 AM
#1
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.
-
September 12th, 2024, 09:12 AM
#2
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
-
September 12th, 2024, 09:22 AM
#3
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.
-
September 12th, 2024, 10:12 AM
#4
Re: MFC Combobox in visual studio 2022
Originally Posted by pdk5
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
-
September 12th, 2024, 10:39 AM
#5
Re: MFC Combobox in visual studio 2022
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)
-
September 13th, 2024, 03:13 AM
#6
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
-
September 13th, 2024, 03:19 AM
#7
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.
-
September 13th, 2024, 03:28 AM
#8
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)
-
September 13th, 2024, 04:13 AM
#9
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 ...
-
September 13th, 2024, 04:31 AM
#10
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)
-
September 13th, 2024, 04:33 AM
#11
Re: MFC Combobox in visual studio 2022
Originally Posted by pdk5
@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
-
September 13th, 2024, 06:11 AM
#12
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 !!!!
-
September 13th, 2024, 08:04 AM
#13
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)
-
September 13th, 2024, 08:29 AM
#14
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.
-
September 13th, 2024, 10:28 AM
#15
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)
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|