Skip to content

Commit

Permalink
After adding a new trigger/alias etc. the new item is selected
Browse files Browse the repository at this point in the history
  • Loading branch information
nickgammon committed Oct 22, 2010
1 parent f296766 commit 10ffb73
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
20 changes: 16 additions & 4 deletions dialogs/world_prefs/genpropertypage.cpp
Expand Up @@ -69,7 +69,7 @@ END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// OnAddItem
// SetUpPage

void CGenPropertyPage::SetUpPage (CString strObjectType,
CObjectMap * ObjectMap,
Expand Down Expand Up @@ -243,12 +243,24 @@ void CGenPropertyPage::OnAddItem(CDialog & dlg)

// add this item to the list view
if (m_bWantTreeControl)
add_tree_item (pItem, pstrObjectName);
{
HTREEITEM hItem = add_tree_item (pItem, pstrObjectName);
m_cTreeCtrl.SelectItem (hItem);
m_cTreeCtrl.EnsureVisible (hItem);
}
else
add_list_item (pItem, pstrObjectName, 0, TRUE);
{
int nItem = add_list_item (pItem, pstrObjectName, 0, TRUE);
m_ctlList->SetItemState (nItem, LVIS_FOCUSED | LVIS_SELECTED,
LVIS_FOCUSED | LVIS_SELECTED);
m_ctlList->EnsureVisible (nItem, FALSE);
}


SetInternalName (pItem, strObjectName); // set name so we can delete one-shot items

m_strSelectedItem = strObjectName; // so it gets selected next time

// resort the list

SortItems ();
Expand Down Expand Up @@ -558,7 +570,7 @@ void CGenPropertyPage::OnChangeItem(CDialog & dlg)
} // end of list control

// redraw the list
// if (GetFilterFlag ())
if (GetFilterFlag ())
LoadList (); // full reload because it may have changed filter requirements

// resort the list
Expand Down
6 changes: 3 additions & 3 deletions dialogs/world_prefs/prefspropertypages.cpp
Expand Up @@ -3049,7 +3049,7 @@ BOOL CPrefsP7::OnInitDialog()
GetSystemMetrics (SM_CXVSCROLL) - // minus vertical scroll bar
m_iColWidth [eColumnAlias]; // minus width of other items

return TRUE; // return TRUE unless you set the focus to a control
return FALSE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
} // end of CPrefsP7::OnInitDialog

Expand Down Expand Up @@ -6808,7 +6808,7 @@ BOOL CPrefsP16::OnInitDialog()
m_iColWidth [eColumnType] - // minus existing column
m_iColWidth [eColumnWhen]; // minus existing column

return TRUE; // return TRUE unless you set the focus to a control
return FALSE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
} // end of CPrefsP16::OnInitDialog

Expand Down Expand Up @@ -7765,7 +7765,7 @@ BOOL CPrefsP18::OnInitDialog()
GetSystemMetrics (SM_CXVSCROLL) - // minus vertical scroll bar
m_iColWidth [eColumnName]; // minus width of other items

return TRUE; // return TRUE unless you set the focus to a control
return FALSE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
} // end of CPrefsP18::OnInitDialog

Expand Down
4 changes: 2 additions & 2 deletions stdafx.h
Expand Up @@ -40,8 +40,8 @@
// disable memory checking for speed
// comment out (middle 2 lines) to re-enable
#ifdef _DEBUG
// #undef DEBUG_NEW
// #define DEBUG_NEW new
#undef DEBUG_NEW
#define DEBUG_NEW new
#endif

#define USE_PYTHON // Nick's "use Python" extension ;)
Expand Down

0 comments on commit 10ffb73

Please sign in to comment.