Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - CXTPControlComboBox in commandbar issue
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTPControlComboBox in commandbar issue

 Post Reply Post Reply
Author
Message
JerryEvans View Drop Down
Groupie
Groupie
Avatar

Joined: 01 May 2008
Location: United Kingdom
Status: Offline
Points: 39
Post Options Post Options   Thanks (0) Thanks(0)   Quote JerryEvans Quote  Post ReplyReply Direct Link To This Post Topic: CXTPControlComboBox in commandbar issue
    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.

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
JerryEvans View Drop Down
Groupie
Groupie
Avatar

Joined: 01 May 2008
Location: United Kingdom
Status: Offline
Points: 39
Post Options Post Options   Thanks (0) Thanks(0)   Quote JerryEvans Quote  Post ReplyReply Direct Link To This Post 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. :-)
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.