Print Page | Close Window

CXTPCustomControl with radio buttons

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=1441
Printed Date: 15 July 2025 at 12:49am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPCustomControl with radio buttons
Posted By: RayJ
Subject: CXTPCustomControl with radio buttons
Date Posted: 22 November 2004 at 3:21pm

I'm placing radio buttons in a custom conrol in the OnCreateControl method as follows:

if ((lpCreateControl->nID == IDC_RADIO_COORD_TRACK || lpCreateControl->nID == IDC_RADIO_COORD_LOCATE) && pToolBar->GetBarID() == IDR_TOOLBAR_COORDS){

UINT nID = lpCreateControl->nID;

CXTPControlCustom* pControlOption = (CXTPControlCustom*)CXTPControlCustom::CreateObject();

pControlOption->SetID(nID);

CButton& wndOption = m_wndCoordinateBarRadioOptions[nID-IDC_RADIO_COORD_TRACK];

if (!wndOption.Create(pControlOption->GetCaption(), WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON,
CRect(0, 0, 75, 20),
this, nID))
{
return FALSE;
}

wndOption.SetFont(CXTPPaintManager::GetRegularFont());
wndOption.SetCheck(nID == IDC_RADIO_COORD_TRACK);
pControlOption->SetControl(&wndOption);
pControlOption->SetVerticalPositionOption(xtpVerticalShow );
pControlOption->SetFlags(xtpFlagManualUpdate);

lpCreateControl->pControl = pControlOption;
return TRUE;
}

My problem is that after I exist the program and restart it and undock the toolbar I get both the buttons and the radio items showing up on the toolbar like this:

What am I doing wrong.

Thanks

Ray




Replies:
Posted By: Oleg
Date Posted: 23 November 2004 at 12:42am

from 9.10 you must use CXTPControlCustom::CreateControlCustom:

CButton& wndOption = m_wndCoordinateBarRadioOptions[nID-IDC_RADIO_COORD_TRACK];

if (!wndOption.Create(pControlOption->GetCaption(), WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON,
CRect(0, 0, 75, 20),
this, nID))
{
return FALSE;
}

CXTPControlCustom* pControlOption = CXTPControlCustom::CreateControlCustom(&m_wndOption);

 



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: RayJ
Date Posted: 23 November 2004 at 9:20am

So I must have the latest version for this to work?



Posted By: Oleg
Date Posted: 23 November 2004 at 11:39pm
if you haven't CreateControlCustom method then "yes".

-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



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