Print Page | Close Window

HOWTO: Emulate CBS_DROPDOWNLIST style

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=18378
Printed Date: 07 July 2025 at 12:46am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: HOWTO: Emulate CBS_DROPDOWNLIST style
Posted By: mgampi
Subject: HOWTO: Emulate CBS_DROPDOWNLIST style
Date Posted: 16 May 2011 at 8:41am
Hi;

I'm trying to create a report item with constraint edit that behaves like standard combobox dropdownlist controls. So I want the item to open the dropdown list as soon as the user clicks into the item rectangle.
Setting EditOnClick(TRUE) shows the edit control with dropdown button but the list is not open.
I tried several setting but without success.


-------------
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022



Replies:
Posted By: mgampi
Date Posted: 20 May 2011 at 6:55pm
Isn't this possible?
Can't believe it!


-------------
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022


Posted By: ABuenger
Date Posted: 20 May 2011 at 8:45pm
Hi,

please set CXTPReportPaintManager::m_bShowNonActiveInPlaceButton to TRUE and call AddComboButton(TRUE) to have the combo box inside the cell.

You also need to derive your own class from CXTPReportRecordItem.

void CMyReportRecordItem::OnBeginEdit(XTP_REPORTRECORDITEM_ARGS *pItemArgs)
{
   CXTPReportRecordItem::OnBeginEdit(pItemArgs);

   CXTPReportRecordItemEditOptions *pEditOptions = GetEditOptions(pItemArgs->pColumn);
   pEditOptions->arrInplaceButtons.GetAt(0)->Activate();
}

You could also call CXTPReportInplaceButton::Activate() at an other event handler instead of deriving your own item class.

I'll add a dropdown style to the toolkit.

Andre



-------------
Codejock support


Posted By: mgampi
Date Posted: 21 May 2011 at 3:34am
Thanks Andre;

I'll try it...


-------------
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022


Posted By: StuartB
Date Posted: 08 August 2011 at 11:18am
I achieved this thusly, inheriting from CXTPReportRecordItemText:

void CMyReportRecordItem::OnBeginEdit (XTP_REPORTRECORDITEM_ARGS *pItemArgs)
{
    CXTPReportRecordItemText::OnBeginEdit(pItemArgs);

    CXTPReportControl               *pControl       = pItemArgs->pControl;
    CXTPReportRecordItemEditOptions *pEditOptions   = GetEditOptions(pItemArgs->pColumn);
    CXTPReportInplaceButtons        *pInpaceButtons = &pEditOptions->arrInplaceButtons;

    if (!pEditOptions->m_bAllowEdit && pInpaceButtons->GetSize() > 0)
    {
        CXTPReportInplaceButton *pBtn = pInpaceButtons->GetAt(0);
        OnInplaceButtonDown(pBtn);
        if (!pControl->IsEditOnClick())
            pBtn->Activate();
    }
}

I took the bulk of the code from ToolkitPro v15.0.02. I'm using v15.1.1 at the moment.

Did you, "add a dropdown style to the toolkit" ?



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