Got it half working. Had to put my strings behind rcptrs. Had to implement a competion_notify thingy, otherwise the listview doesn't get updated when the edit is finished.
class edit_complete
{
public:
void on_task_completion(unsigned taskid, unsigned p_code) {
g_discogs.new_tag_mappings_dialog->refresh_item(taskid);
}
};
LRESULT CNewTagMappingsDialog::OnAddTag(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) {
tag_mapping_entry * entry = new tag_mapping_entry();
entry->tag_name = pfc::rcnew_t<pfc::string8>("");
entry->formatting_string = pfc::rcnew_t<pfc::string8>("");
entry->enable_write = false;
entry->enable_update = false;
entry->freeze_tag_name = false;
entry->freeze_update = false;
entry->freeze_write = false;
tag_mappings->add_item(*entry);
int pos = ListView_GetItemCount(tag_list);
insert_tag(pos, entry);
InPlaceEdit::Start_FromListView(tag_list, pos, 0, 1, entry->tag_name,
completion_notify_create<edit_complete>(edit_complete_inst, pos));
return FALSE;
}
void CNewTagMappingsDialog::refresh_item(int pos) {
tag_mapping_entry entry = tag_mappings->get_item_ref(pos);
listview_helper::set_item_text(tag_list, pos, 0, *(entry.tag_name));
listview_helper::set_item_text(tag_list, pos, 1, *(entry.formatting_string));
}
Still not sure about inplaceedit_v2 or the TableEdit stuff. Wondering if any of that would simplify things.