Print Page | Close Window

CXTPReportControl edit mode

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=3862
Printed Date: 05 February 2025 at 1:02pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPReportControl edit mode
Posted By: dmitklg
Subject: CXTPReportControl edit mode
Date Posted: 24 March 2006 at 5:40am

How can I edit the label of the new CXTPReportRecordItem? (using code, not by user action).

 

The new row must be visible, selected and the first cell must be in edit mode, so the user can change the text.



my code don't work
    CXTPReportRow * pRow = m_wndReport.GetRows()->GetAt(m_wndReport.GetRows()->Ge tCount()- 1);
    m_wndReport.EnsureVisible(pRow);
    m_wndReport.GetSelectedRows()->Select(pRow);
    m_wndReport.SetFocusedRow(pRow);
    CRect rc;
    CXTPReportRow * pRow = m_wndReport.GetFocusedRow();   
    if (pRow) {
        CXTPReportRecordItemText * pName = (CXTPReportRecordItemText *)pRow->GetRecord()->GetItem(1);
        rc = pRow->GetItemRect(pName);
        pRow->OnDblClick(rc.TopLeft());
        CXTPReportInplaceEdit* pEdit = pRow->GetControl()->GetInplaceEdit();
        pEdit->SetSel(0,-1);
    }



Replies:
Posted By: sserge
Date Posted: 24 March 2006 at 7:49am
Hi,

Instead of direct use of inplace edit control there you'd better call CXTPReportControl::EditItem()

--
WBR,
Serge


Posted By: sserge
Date Posted: 24 March 2006 at 7:54am
ps: just change your if() to following:

    XTP_REPORTRECORDITEM_ARGS args(&m_wndReport, pRow, m_wndReport.GetColumns()->GetAt(1));
    m_wndReport.EditItem(&args);



Posted By: dmitklg
Date Posted: 26 March 2006 at 11:26pm
i test this code but it don't work

InplaceEdit not visible

    m_wndReport.SetFocus();
    CXTPReportRecord* pRecord = m_wndReport.AddRecord(new CXTPReportRecord());
    pRecord->AddItem(new CXTPReportRecordItemNumber(0,">") );
    pRecord->AddItem(new CXTPReportRecordItemText("new line"));
    m_wndReport.Populate();

    CXTPReportRow * pRow = m_wndReport.GetRows()->Find(pRecord);
    if (pRow) {
        m_wndReport.SetFocusedRow(pRow);
        XTP_REPORTRECORDITEM_ARGS args(&m_wndReport, pRow, m_wndReport.GetColumns()->GetAt(1));
        m_wndReport.EditItem(&args);
    }


Posted By: dmitklg
Date Posted: 26 March 2006 at 11:34pm
void CXTPReportInplaceEdit::Create(XTP_REPORTRECORDITEM_ARGS* pItemArgs)
{
    SetItemArgs(pItemArgs);
    m_pSelectedConstraint = NULL;

    XTP_REPORTRECORDITEM_METRICS metrics;
    metrics.strText = pItem->GetCaption(pColumn);
    pItemArgs->pRow->FillMetrics(pColumn, pItem, &metrics);

    CRect rect = pItemArgs->rcItem; <<<<

rect = (39,0,235,0)
whi  is it?



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