Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Checking Toolbar Items
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Checking Toolbar Items

 Post Reply Post Reply
Author
Message
VeRtEX View Drop Down
Newbie
Newbie


Joined: 12 June 2004
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote VeRtEX Quote  Post ReplyReply Direct Link To This Post Topic: Checking Toolbar Items
    Posted: 12 June 2004 at 8:03am

Hi,

How can i check items of an CXTPToolBar? Using the standard mfc toolbar it worked like this:

CToolBarCtrl& ctrl  = mToolBar.GetToolBarCtrl();
ctrl.CheckButton(....);

But i don't see any fimilar function, can anyone help?

Cheers

Back to Top
msamocha View Drop Down
Newbie
Newbie
Avatar

Joined: 07 March 2004
Location: Israel
Status: Offline
Points: 30
Post Options Post Options   Thanks (0) Thanks(0)   Quote msamocha Quote  Post ReplyReply Direct Link To This Post Posted: 15 June 2004 at 4:06am

Hi,

I would also like to know how can we Add / Delete / Modify menus/submenus (similar to MFC's CMenu InsertMenu, DeleteMenu and ModifyMenu)

Vertex, Did you try to use GetControl()to get a pointer to the control and then use some of the CXTPControl methods to do what you want?



Edited by msamocha
Back to Top
VeRtEX View Drop Down
Newbie
Newbie


Joined: 12 June 2004
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote VeRtEX Quote  Post ReplyReply Direct Link To This Post Posted: 15 June 2004 at 11:47am

how exactly?

CXTPControl* button = mToolbar->GetControls()->FindControl(xtpControlButton, ID_TOOLBAR_WIREFRAME, true, true);


i tried that...but crashed....i want to get the control by mfc id

do you know how i can do that?

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: 18 June 2004 at 2:42am
To check item you must use update hanler. see FAQ.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
VeRtEX View Drop Down
Newbie
Newbie


Joined: 12 June 2004
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote VeRtEX Quote  Post ReplyReply Direct Link To This Post Posted: 18 June 2004 at 9:08am

okay thank you for your help.

i now got it working with:

mToolbar->GetControls()->FindControl(xtpControlButton, ID_TOOLBAR_WIREFRAME, true, true)->SetChecked(app->mShowWireFrame);

i now tried the same to get a control from the menu bar... but doesn't work so i tried another approach:


void CModelViewer2App::UpdateMenuItem(const int id, const bool check)
{
 CMainFrame* mainFrm = (CMainFrame*)GetMainWnd();
 if (mainFrm)
 {
  CXTPControls* controls = mainFrm->mMenuBar.GetControls();
  const int numControls = controls->GetCount();
  LOG("numControls=%i", numControls);
  for (int i=0; i<numControls; i++)
  {
   CXTPControl* control = controls->GetAt(i);

   if (!control)
    break;

   if(control->GetID()==id)
    LOG("found");
  }
}

but my menu has 0 controls...that is a bit strange ;) does anybody of you know how i can get access to my menu items on another way to check / uncheck them?

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: 21 June 2004 at 1:42am

Did you try to open FAQ? think no.

sample:

BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
       ON_UPDATE_COMMAND_UI(ID_PROPERTIES, OnUpdateProperties)

 END_MESSAGE_MAP()

void CMainFrame::OnUpdateProperties(CCmdUI* pCmdUI)
{
 pCmdUI->SetCheck(TRUE);

}

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
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.236 seconds.