Print Page | Close Window

CXTPControlComboBox in commandbar issue

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=11205
Printed Date: 07 January 2025 at 11:01pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPControlComboBox in commandbar issue
Posted By: JerryEvans
Subject: CXTPControlComboBox in commandbar issue
Date Posted: 25 June 2008 at 9:19am
I've got 2 problems - any pointers appreciated.

Background:

In my CXTPFrameWnd derived frame class I create a command bar with an embedded CXTPControlComboBox. This displays itself properly and can be accessed in the ON_XTP_EXECUTE() handler embedded in my view class. I store the pointer to the combo box in the frame class. Call it m_pAddress.

1. I set up an accelerator to set focus to the combo box - in the event handler if I call m_pAddress->SetFocused(TRUE) then I get a fault

2. In my OnClose handler in the frame class I want to read and store the combo contents. Again if I call m_pAddress->GetCount() I get an exception. The debugger shows my that the pointer to the commandbar instance is garbage.

Question: Is the pointer returned by CXTPToolbar->GetControls()->Add() a temporary ?

Also WTH is the Post New Topic editor so bloody small?????

THx.




Replies:
Posted By: Oleg
Date Posted: 25 June 2008 at 3:41pm
Hi,
 
Its quite dangerous to save pointer to combobox this way - after you load state it will be not valid, or your user can remove it from toolbar.
 


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


Posted By: JerryEvans
Date Posted: 25 June 2008 at 6:55pm
Oleg - this kind of thing needs to be documented. Given that the commandbar setup persists over the lifetime of the frame window storing a pointer is not completely unreasonable. perhaps a bit devil may care but not entirely stupid. :-)



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