Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - in-place editing
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

in-place editing

 Post Reply Post Reply
Author
Message
adrien View Drop Down
Senior Member
Senior Member


Joined: 30 April 2007
Location: New Zealand
Status: Offline
Points: 449
Post Options Post Options   Thanks (0) Thanks(0)   Quote adrien Quote  Post ReplyReply Direct Link To This Post Topic: in-place editing
    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?

 

Back to Top
adrien View Drop Down
Senior Member
Senior Member


Joined: 30 April 2007
Location: New Zealand
Status: Offline
Points: 449
Post Options Post Options   Thanks (0) Thanks(0)   Quote adrien Quote  Post ReplyReply Direct Link To This Post Posted: 13 May 2008 at 2:20am
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.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.188 seconds.