Print Page | Close Window

in-place editing

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=10607
Printed Date: 15 November 2024 at 8:16pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: in-place editing
Posted By: adrien
Subject: in-place editing
Date 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?

 



-------------
http://www.wingate.com - http://www.wingate.com



Replies:
Posted By: adrien
Date 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.


-------------
http://www.wingate.com - http://www.wingate.com



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net