@@ -214,6 +214,24 @@ namespace RTEGUI {
214
214
m_EditorBase->SetFocus ();
215
215
}
216
216
217
+ // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
218
+
219
+ void GUIEditorApp::SelectActiveControlInList () const {
220
+ if (m_SelectionInfo.Control == nullptr ) {
221
+ m_CollectionBoxList->SetSelectedIndex (-1 );
222
+ return ;
223
+ }
224
+ // Check if this is selected in the editor, and if so, select it in the list too
225
+ if (m_SelectionInfo.Control ->GetID () == " COLLECTIONBOX" ) {
226
+ for (const GUIListBox::Item *listEntry : *m_CollectionBoxList->GetItemList ()) {
227
+ if (listEntry->m_Name == m_SelectionInfo.Control ->GetName ()) {
228
+ m_CollectionBoxList->SetSelectedIndex (listEntry->m_ID );
229
+ }
230
+ }
231
+ if (!m_SelectionInfo.Control ->GetChildren ()->empty ()) { PopulateCollectionBoxChildrenList (dynamic_cast <GUICollectionBox *>(m_SelectionInfo.Control )); }
232
+ }
233
+ }
234
+
217
235
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
218
236
219
237
void GUIEditorApp::AddItemToCollectionBoxList (GUIControl *control, const std::string &indent) const {
@@ -242,11 +260,6 @@ namespace RTEGUI {
242
260
AddItemToCollectionBoxList (collectionBox, " \t " );
243
261
}
244
262
}
245
- // Check if this is selected in the editor, and if so, select it in the list too
246
- if (m_SelectionInfo.Control == collectionBox) {
247
- m_CollectionBoxList->SetSelectedIndex (m_CollectionBoxList->GetItemList ()->size () - 1 );
248
- PopulateCollectionBoxChildrenList (collectionBox);
249
- }
250
263
}
251
264
}
252
265
}
@@ -593,13 +606,16 @@ namespace RTEGUI {
593
606
m_SelectionInfo.ClickY = mousePosY;
594
607
595
608
UpdateControlProperties (m_SelectionInfo.Control , false );
609
+
610
+ SelectActiveControlInList ();
596
611
} else if (control == m_RootControl) {
597
612
// Unselect control
598
613
m_SelectionInfo.GrabbedControl = false ;
599
614
m_SelectionInfo.GrabbedHandle = false ;
600
615
m_SelectionInfo.Control = nullptr ;
601
616
602
617
m_PropertyPage->ClearValues ();
618
+ SelectActiveControlInList ();
603
619
}
604
620
}
605
621
}
0 commit comments