![]() |
CXTPControl -> SetEnable issue |
Post Reply
|
| Author | |
apple
Newbie
Joined: 28 April 2008 Status: Offline Points: 6 |
Post Options
Thanks(0)
Quote Reply
Topic: CXTPControl -> SetEnable issuePosted: 28 April 2008 at 8:23am |
|
Hi:
Please see following code:
CMainFrame* pMainFrame = (CMainFrame*)AfxGetMainWnd();
CXTPCommandBars* pCommandBars = pMainFrame->GetCommandBars(); CXTPControl * button= pCommandBars->FindControl(xtpControlButton,ID_MYID,true,true); button->SetEnabled(false); *ID_MYID: user_defined resource ID.
I try many ways, SetEnable seems as if out of work . i dont know why?
need your help, thx a lot.
|
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 28 April 2008 at 8:57am |
|
Hi, Because by default used MFC Update handlers - and your button will be Enabled in Handler.
As solution you can add line button->SetFlags(xtpFalgManualUpdate);
but I _very_ recommend use update handler instead.
|
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
apple
Newbie
Joined: 28 April 2008 Status: Offline Points: 6 |
Post Options
Thanks(0)
Quote Reply
Posted: 28 April 2008 at 9:44pm |
|
Hi,Oleg:
How can i use update handler? Can you tell me in details about that?
thx in advance. :-)
|
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 29 April 2008 at 12:42am |
|
Hi,
In Message Map add
ON_UPDATE_COMMAND_UI(ID_MYID, OnUpdateMyID)
and such code
void CMainFrame::OnUpdateMyID(CCmdUI* pCmdUI) { pCmdUI->Enable(m_bNeedEnableMyID); } See more in MSDN.
|
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
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 |