Print Page | Close Window

Edit new item

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=3911
Printed Date: 11 May 2024 at 2:42am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Edit new item
Posted By: dmitklg
Subject: Edit new item
Date Posted: 30 March 2006 at 6:17am
InplaceEdit not visible

why?

     m_wndReport.SetFocus();
CXTPReportRecord* pRecord = m_wndReport.AddRecord(new CXTPReportRecord());    
pRecord->AddI tem(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);В  ;   
}



Replies:
Posted By: sserge
Date Posted: 01 April 2006 at 5:50am
Hi,

1) m_wndReport.SetFocusedRow(pRow) is not necessary because .EditItem() makes the edited cell focused automatically. Please delete this line.

2) Before calling EditItem please ensure that all editing restrictions are enabled. For example, for your method it might be necessary to call in the beginning:

m_wndReport.AllowEdit(TRUE);
m_wndReport.GetColumns()->GetAt(1)->SetEditable();


--
WBR,
Serge


Posted By: dmitklg
Date Posted: 03 April 2006 at 12:11am
InplaceEdit is visible
but it CRect is bad
please veiw code

void CXTPReportInplaceEdit::Create(XTP_REPORTRECORDITEM_ARGS* pItemArgs){    SetItemArgs(pItemArgs);&n bsp;   m_pSelectedConstraint = NULL;
    XTP_REPORTRECORDITEM_METRICS metrics;    metrics.strText = pItem->GetCaption(pColumn);    pItemA rgs->pRow->FillMetrics(pColumn, pItem, &metrics);
    CRect rect = pItemArgs->rcItem; <<<<

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


Posted By: sserge
Date Posted: 03 April 2006 at 1:25pm
Do you have your GetItemMetrics() event handlers?


Posted By: dmitklg
Date Posted: 04 April 2006 at 12:10am
no


Posted By: dmitklg
Date Posted: 05 April 2006 at 1:29am
it need?


Posted By: sserge
Date Posted: 05 April 2006 at 8:18am
Actually, no, but there a rect might be changed. Need to look at your methods in more details for further investigations. If you have a sample illustrating the problem, it would be useful to look at. You can also submit it as an issue into Customer area...

--
WBR,
Serge


Posted By: dmitklg
Date Posted: 06 April 2006 at 12:24am
i need insert new row and edit it from code

my code
void CMenuDialog::OnDbAdd()
{
    CString str;
    ULONG id;
    str = m_sTXTAlias + " - вставка";
    CInputDialog dlg;
    dlg.SetTitle(str);

    if (dlg.DoModal() == IDOK && !dlg.m_sInput.IsEmpty()) {

        str = dlg.m_sInput;
        TRY
        {
            theApp.m_MysqlConnection.ExecuteSQLV("insert into %s (id,%s) values (NULL,'%s')",m_sTableName,
                m_sTXTField,str);
            id = theApp.m_MysqlConnection.GetLastID();
            m_wndReport.SetFocus();
            CXTPReportRecord* pRecord = m_wndReport.AddRecord(new CXTPReportRecord());
            pRecord->AddItem(new CXTPReportRecordItemNumber(id) );
            pRecord->AddItem(new CXTPReportRecordItemText(str));
            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);
            }
        }
        CATCH(CSQLException, e)
        {
            e->ReportError();
        }
        END_CATCH
    }
}

inplace edit created but not visible
CRect for inplace edit invalid
rect = (39,0,235,0)


Posted By: sserge
Date Posted: 06 April 2006 at 2:07pm
Hi,

Delete this line: m_wndReport.SetFocusedRow(pRow); -- as I mentioned it is not necessary.

See also sample method: void CTaskListView::OnAddTask()

Let me know whether this helped.

--
WBR,
Serge


Posted By: dmitklg
Date Posted: 07 April 2006 at 1:02am
            CXTPReportRecord* pRecord = m_wndReport.AddRecord(new CXTPReportRecord());
            pRecord->AddItem(new CXTPReportRecordItemNumber(4444) );
            pRecord->AddItem(new CXTPReportRecordItemText("new item"));
            m_wndReport.Populate();
            CXTPReportRow* pRow = m_wndReport.GetRows()->Find(pRecord);
    if (pRow)
    {            
        XTP_REPORTRECORDITEM_ARGS itemArgs(&m_wndReport, pRow, m_wndReport.GetColumns()->Find(1));
        m_wndReport.EditItem(&itemArgs);
    }

inplace edit created but not visible

my version xtreme toolbar is 9.61
my be it is bug 9.61 ?


Posted By: dmitklg
Date Posted: 11 April 2006 at 4:36am
my solution

    while ( ::PeekMessage( &iMsg, NULL, NULL, NULL, PM_NOREMOVE ) )
    {
        ::AfxGetThread()->PumpMessage();   // pump messages until queue is
        // empty
    }


Posted By: sserge
Date Posted: 11 April 2006 at 10:08am
Nice to hear that you've found the solution.
If you'll have the same problem with the latest version of the library, please raise this issue again.

--
WBR,
Serge


Posted By: dmitklg
Date Posted: 12 April 2006 at 12:10am
now i need delete row from Report if user Canceled edit

it possible?


Posted By: dmitklg
Date Posted: 12 April 2006 at 1:02am
            while ( ::PeekMessage( &iMsg, NULL, NULL, NULL, PM_NOREMOVE ) )
            {
                ::AfxGetThread()->PumpMessage();   // pump messages until queue is
                // empty
            }
it don't work if scrollbar is visible :(((

InplaceEdit show in invalid place :((


Posted By: sserge
Date Posted: 12 April 2006 at 10:55am
For the last problem calling AdjustLayout() first could help.

--
WBR,
Serge


Posted By: dmitklg
Date Posted: 13 April 2006 at 12:09am
now i need delete row from Report if user Canceled edit

it possible?


Posted By: sserge
Date Posted: 13 April 2006 at 8:22am
After editing you'll have to check whether any item of a newly added record differs from the initial value. If there are no any changes, then just delete a record.

--
WBR,
Serge


Posted By: dmitklg
Date Posted: 14 April 2006 at 12:04am
please write sample code



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