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
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"?
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};
Re: MFC Combobox in visual studio 2022
Quote:
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
Re: MFC Combobox in visual studio 2022
Quote:
What is "owl combobox"?
owl is Borland's Object Window Library - which was deprecated in 1997 for Visual Component Library (VCL)
Re: MFC Combobox in visual studio 2022
Thank you for info! :thumb:
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!
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.
Re: MFC Combobox in visual studio 2022
Quote:
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.
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 ...
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?
Re: MFC Combobox in visual studio 2022
Quote:
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?
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 !!!!
Re: MFC Combobox in visual studio 2022
...and the region/language settings?
1 Attachment(s)
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 :)
Attachment 36115
Re: MFC Combobox in visual studio 2022
What's the style used with the TComboBox when it is created? Is it owner draw?