From 4c6ea65bf8d603f10f3df725b59e8d7a45721b4e Mon Sep 17 00:00:00 2001 From: pkv Date: Wed, 21 Sep 2005 15:05:57 +0000 Subject: [PATCH] Updating Mode combobox with the names of components --- src/VISUGUI/VisuGUI_ScalarBarDlg.cxx | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx b/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx index 6a24502f..62a3a4b6 100644 --- a/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx +++ b/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx @@ -506,7 +506,6 @@ void VisuGUI_ScalarBarPane::storeToResources() { */ void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ScalarMap_i* thePrs) { initFromResources(); - myModeCombo->setCurrentItem(thePrs->GetScalarMode()); setPosAndSize( thePrs->GetPosX(), thePrs->GetPosY(), thePrs->GetWidth(), @@ -525,7 +524,27 @@ void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ScalarMap_i* thePrs) { setRange( thePrs->GetMin(), thePrs->GetMax(), /*0.0, 0.0,*/ thePrs->IsRangeFixed() ); setScalarBarData( thePrs->GetNbColors(), thePrs->GetLabels() ); - bool isScalarMode = (thePrs->GetField()->myNbComp > 1); + // + int aNbComp=thePrs->GetField()->myNbComp; + bool isScalarMode = (aNbComp > 1); + // + // update myModeCombo + VISU::TNames& aNamesOfComponents =thePrs->GetField()->myCompNames; + VISU::TNames& aUnitNamesOfComponents=thePrs->GetField()->myUnitNames; + myModeCombo->clear(); + myModeCombo->insertItem(""); + for (int i=1; i<=aNbComp; ++i) { + VISU::TName aNmUn=aNamesOfComponents[i-1]; + VISU::TName& aUnits=aUnitNamesOfComponents[i-1]; + if (!aUnits.empty()) { + aNmUn+=", "; + aNmUn+=aUnits; + } + myModeCombo->insertItem(aNmUn); + } + // + myModeCombo->setCurrentItem(thePrs->GetScalarMode()); + // myModeLbl->setEnabled(isScalarMode); myModeCombo->setEnabled(isScalarMode); -- 2.39.2