CXTPControlComboBox in commandbar issue |
Post Reply |
Author | |
JerryEvans
Groupie Joined: 01 May 2008 Location: United Kingdom Status: Offline Points: 39 |
Post Options
Thanks(0)
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. |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
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 |
|
JerryEvans
Groupie Joined: 01 May 2008 Location: United Kingdom Status: Offline Points: 39 |
Post Options
Thanks(0)
|
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. :-)
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |