in-place editing |
Post Reply |
Author | |
adrien
Senior Member Joined: 30 April 2007 Location: New Zealand Status: Offline Points: 449 |
Post Options
Thanks(0)
Posted: 13 May 2008 at 2:02am |
Hi Currently the in-place editing seems a bit odd. There are 2 choices as far as I can see. 1. single click to edit. This isn't suitable for many purposes, e.g displaying a list of objects etc. 2. double-click to edit. This doesn't work sometimes either, e.g. if double click is to edit the object. What I want is single click on selected row to edit cell. This is the same behaviour as editing filenames in explorer - first you select, then you click on the label to edit it. It then allows you to select without editing (e.g. for preview), and double-click without editing cell. What are my chances?
|
|
adrien
Senior Member Joined: 30 April 2007 Location: New Zealand Status: Offline Points: 449 |
Post Options
Thanks(0)
|
OK, did it as below.
class SelectedEditableItem;
SelectedEditableItem* pLastClick = NULL;
class SelectedEditableItem : public CXTPReportRecordItemText
{ public: virtual void OnClick(XTP_REPORTRECORDITEM_CLICKARGS* pClickArgs) { if(pClickArgs->pRow->IsSelected() && this == pLastClick) { pClickArgs->pControl->EditItem(pClickArgs); CPoint pt(pClickArgs->ptClient);
pClickArgs->pControl->ClientToScreen(&pt); CXTPReportInplaceEdit* pEdit = DYNAMIC_DOWNCAST(CXTPReportInplaceEdit, CWnd::FromHandle(WindowFromPoint(pt)));
if (pEdit && pEdit->GetItem() == this) { CXTPReportRecordItemEditOptions* pEditOptions = GetEditOptions(pClickArgs->pColumn); if (pEditOptions->m_bSelectTextOnEdit)
{ pEdit->SetSel(0, -1); } else { DoMouseButtonClick(); } } return; } pLastClick = this; CXTPReportRecordItemText::OnClick(pClickArgs);
} }; set control to not editable, and this overrides control behaviour. If you want an item to behave like this, use this class instead.
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |