Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: InPlaceEdit? (Read 1234 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

InPlaceEdit?

Is there any example / source code anywhere showing how to use this?

I would like to make one of those fancy editable listiews, but I'm pretty lost trying to figure out how to use it. 

InPlaceEdit?

Reply #1
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.

Code: [Select]
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.