How to get the CXTPToolBar Runtime class |
Post Reply |
Author | |
Makarand
Senior Member Joined: 27 February 2007 Location: India Status: Offline Points: 140 |
Post Options
Thanks(0)
Posted: 30 March 2007 at 9:29am |
Hi,
Please go through the following code. Code is written for the codejock version 4.2, I am trying to integrate it with 10.4.2.
The function "IsToolBarCreated" return the Menu bar ID (Menu which is closed by user using close button).
----------------------------------------------------------------------------------------------
int CMainFrame::IsToolBarCreated(const char * pszTitle)
{ char cTitle[MAXSTRLENGTH]; // Find a toolbar with the same caption as the caption passed in.
int nID = 0; CControlBar* pBar = NULL; BOOL bNotFound = TRUE; CPtrList& list = m_listControlBars; POSITION pos = list.GetHeadPosition();
while( pos != NULL ) { pBar = (CControlBar*) list.GetNext(pos); //if(pBar->IsKindOf(RUNTIME_CLASS(SECCustomToolBar))) if(pBar->IsKindOf(RUNTIME_CLASS(CXTToolBar))) { pBar->GetWindowText(cTitle, sizeof(cTitle)); if( lstrcmp(cTitle, pszTitle) == 0 ) { // We found it. nID = pBar->GetDlgCtrlID(); bNotFound = FALSE; break; } } } return nID; } ----------------------------------------------------------------------------------------------
Please help me to get the runtime class of CXTPToolBar or Is there another way to display the closed toolbar? Thank You,
Makarand.
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
Toolbars never go to m_listControlBars collection. Use CXTPCommandBars::GetCount, CXTPCommandBars::GetAt to itterate them.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Makarand
Senior Member Joined: 27 February 2007 Location: India Status: Offline Points: 140 |
Post Options
Thanks(0)
|
Hi Oleg,
Thank you for the reply.
I am able to iterate the toolbar by using GetAt(). But I am not able to associate my toolbar with command bar.
I have created the the object of CXTPToolBar class and using the CreateToolBar(..) and LoadToolBar(IDR_WGDTLBAR), I am creating my toolbar.
Now, how can I associate my toolbar with the command bar?
If I creates the toolbar using pCommandBars->Add(..), it shows toolbar with complete background panel. By using CreateToolBar(..) It shows me only the toolbar button (no background panel bar).
Please help me for the same.
Thank You,
Makarand
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
If you use CXTPCommandBars, you have class ->Add and not CreateToolbar.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Makarand
Senior Member Joined: 27 February 2007 Location: India Status: Offline Points: 140 |
Post Options
Thanks(0)
|
Hi,
I want to create toolbar to the child window, in this case how can I use command bar from main window. By using CreateToolBar(..) I can able to see the toolbar but no backgroud panel bar.
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
For Child frame you need to create own CXTPCommandBars.
override your CChildFrame from CXTPFrameWndBase<CMDIChildWnd>
and use same
if (!InitCommandBars())
return -1; CXTPCommandBars* pCommandBars = GetCommandBars();
code see Samples\DockingPane\MDIPanes
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Makarand
Senior Member Joined: 27 February 2007 Location: India Status: Offline Points: 140 |
Post Options
Thanks(0)
|
Hi Oleg,
Thank you very much for the reply.
I am able to set the Toolbar to child window. In codeJock 4.2 we are used CToolBarCtrl object to handle the toolbar for different reasons like HideButton, IsButtonChecked, GetItemRect etc...
---------------------------------------------------------------------------------------------
CToolBarCtrl *CTBC;
CTBC = &(m_wndChildTB.GetToolBarCtrl()); //m_wndChildTB OBJECT OF CXTToolBar
CTBC = &(m_wndCalTB1.GetToolBarCtrl()); CTBC->HideButton(IDMDTLFIRST, TRUE); ---------------------------------------------------------------------------------------------
In codejock 10.4.2 can we use CToolBarCtrl? or Is there any another way to handle the Toolbar?
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi, Use method of CXTPControl/CXTPControls:
pToolBar->GetControl(i)->SetVisible(FALSE);
pToolBar->GetControl(i)->SetEnabled(TRUE);
etc.
but better use Update handlers. |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Makarand
Senior Member Joined: 27 February 2007 Location: India Status: Offline Points: 140 |
Post Options
Thanks(0)
|
Hi Oleg,
Thanks,
I have used following code to set the property of the toolbar button's
----------------------------------------------------------------------------------------------
CXTPControlButton *btToolBar;
btToolBar = (CXTPControlButton*)m_wndChildTB->GetControls()->FindControl(xtpControlButton, IDMDTLFIRST, TRUE, FALSE); btToolBar->SetVisible(FALSE); ----------------------------------------------------------------------------------------------
Please go through the following code. Code is used to set the control on the toolbar.
---------------------------------------------------------------------------------------------- nRtn = m_wndCalTB.SetButtons(NULL, sizeof(calbuttons1)/sizeof(UINT));
// Set up the combo box.
m_wndCalTB.SetButtonInfo(0, IDCAL_COMBO,
TBBS_SEPARATOR, CALCOMBOBOXWIDTH); // Design guide advises a 12 pixel separator between combos and buttons
m_wndCalTB.SetButtonInfo(1, ID_SEPARATOR, TBBS_SEPARATOR, CALCOMBOBOXSEP); // Set up the legend check button.
m_wndCalTB.SetButtonInfo(2, IDMPVLEGEND, TBBS_CHECKBOX, 0); m_wndCalTB.SetButtonInfo(3, ID_SEPARATOR, TBBS_SEPARATOR, 8); ----------------------------------------------------------------------------------------------
Help me to set the control's(combo box, check box) on the toolbar.
Thank You,
Makarand |
|
Makarand
Senior Member Joined: 27 February 2007 Location: India Status: Offline Points: 140 |
Post Options
Thanks(0)
|
Hi Oleg,
How can I get the Toolbar Window Rect (CRect) ?
Waiting for the reply....
Thank You,
Makarand
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
HI,
as any other window:
pToolBar->GetWindowRect(&rc);
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Makarand
Senior Member Joined: 27 February 2007 Location: India Status: Offline Points: 140 |
Post Options
Thanks(0)
|
Hi Oleg,
Please go through the following code. Code is used to set the control on the toolbar on codejock 4.2.
---------------------------------------------------------------------------------------------- nRtn = m_wndCalTB.SetButtons(NULL, sizeof(calbuttons1)/sizeof(UINT));
// Set up the combo box.
m_wndCalTB.SetButtonInfo(0, IDCAL_COMBO,
TBBS_SEPARATOR, CALCOMBOBOXWIDTH); // Design guide advises a 12 pixel separator between combos and buttons
m_wndCalTB.SetButtonInfo(1, ID_SEPARATOR, TBBS_SEPARATOR, CALCOMBOBOXSEP); // Set up the legend check button.
m_wndCalTB.SetButtonInfo(2, IDMPVLEGEND, TBBS_CHECKBOX, 0); m_wndCalTB.SetButtonInfo(3, ID_SEPARATOR, TBBS_SEPARATOR, 8); ----------------------------------------------------------------------------------------------
Help me to set the control's(combo box, check box) on the toolbar.
Also
How can I get the toolbar button count (button or separator )with the help of CXTPToolBar?
Thank You,
Makarand |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hello, Please look through our samples first and check method of CXTPControls in SymbolReference.chm. Samples have a lot of toolbars with comboboxes, checkboxes, split buttons etc.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Makarand
Senior Member Joined: 27 February 2007 Location: India Status: Offline Points: 140 |
Post Options
Thanks(0)
|
Hi,
In codejock 10.4.2 toolbar implementetion how can I add the CXTButton?
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
to add simple button control (not CXTButton) call
pToolbar->GetControls()->Add(xtpControlButtin, ID);
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Makarand
Senior Member Joined: 27 February 2007 Location: India Status: Offline Points: 140 |
Post Options
Thanks(0)
|
Hi Oleg, What is the replacement function for the CheckButton(ID, FALSE); and CTBC->IsButtonChecked(ID); ? |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
Please check CXTPControl and CXTPControls methods in SymboReference.chm and our samples. There are _a lot_ of demonstations how to check/uncheck buttons.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Makarand
Senior Member Joined: 27 February 2007 Location: India Status: Offline Points: 140 |
Post Options
Thanks(0)
|
Hi Oleg, I don't want to allow use to move toolbar window,
How do I set the fix style to the toolbar?
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
Call EnableDocking(0);
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Makarand
Senior Member Joined: 27 February 2007 Location: India Status: Offline Points: 140 |
Post Options
Thanks(0)
|
Hi Oleg,
Thank You very much.
Now I am able to set the toolbar.
I have one grid view child window which is not derive from CXTPFrameWndBase<CMDIChildWnd>. I want to add the toolbar to this window.
Codejock 4.2 tolbar implementation is as follow
---------------------------------------------------------------------------------------------- m_GridToolbar.Create(this, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_FIXED,
IDR_GRIDTOOLBAR); ---------------------------------------------------------------------------------------------- I tried following replacement code
----------------------------------------------------------------------------------------------
if (!InitCommandBars())
return -1; pCommandBars = GetCommandBars(); if(pCommandBars == NULL) { TRACE0("Failed to create command bars object.\n"); return -1; // fail to create } // Create ToolBar m_GridToolbar = (CCmcStyleBar *) pCommandBars->Add(_T("Toolbar"), xtpBarTop); if ( m_wndChildTB->LoadToolBar(IDR_GRIDTOOLBAR)) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create } ----------------------------------------------------------------------------------------------
But this child window class not derive from CXTPFrameWndBase<CMDIChildWnd>.
How can I set the toolbar to this child window?
Thank You,
Makarand.
|
|
Makarand
Senior Member Joined: 27 February 2007 Location: India Status: Offline Points: 140 |
Post Options
Thanks(0)
|
Hi Oleg,
I have one grid view child window which is not derive from CXTPFrameWndBase<CMDIChildWnd>. I want to add the toolbar to this window.
How can I set the toolbar to this child window?
Thank You,
Makarand. |
|
Makarand
Senior Member Joined: 27 February 2007 Location: India Status: Offline Points: 140 |
Post Options
Thanks(0)
|
Hi Oleg,
I have one grid view child window which is not derive from CXTPFrameWndBase<CMDIChildWnd>. I want to add the toolbar to this window.
Codejock 4.2 tolbar implementation is as follow
---------------------------------------------------------------------------------------------- m_GridToolbar.Create(this, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_FIXED,
IDR_GRIDTOOLBAR); ---------------------------------------------------------------------------------------------- I tried following replacement code
----------------------------------------------------------------------------------------------
if (!InitCommandBars())
return -1; pCommandBars = GetCommandBars(); if(pCommandBars == NULL) { TRACE0("Failed to create command bars object.\n"); return -1; // fail to create } // Create ToolBar m_GridToolbar = (CCmcStyleBar *) pCommandBars->Add(_T("Toolbar"), xtpBarTop); if ( m_wndChildTB->LoadToolBar(IDR_GRIDTOOLBAR)) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create } ----------------------------------------------------------------------------------------------
But this child window class not derive from CXTPFrameWndBase<CMDIChildWnd>.
How can I set the toolbar to this child window?
Thank You,
Makarand.
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
Check \Samples\UserInterface\GUI_VisualStudio sample.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Makarand
Senior Member Joined: 27 February 2007 Location: India Status: Offline Points: 140 |
Post Options
Thanks(0)
|
Hi Oleg,
I want to add the separator on toolbar. I have used following code to set the separator.
------------------------------------------------------------------------------------------
m_wndCalTB.GetControls()->Add(xtpControlButton, ID_SEPARATOR);
------------------------------------------------------------------------------------------
Above code shows me the normal toolbar button.
How do I add the separator on toolbar?
Thank You,
Makarand.
|
|
Makarand
Senior Member Joined: 27 February 2007 Location: India Status: Offline Points: 140 |
Post Options
Thanks(0)
|
Hi Oleq,
How do I set the CXTFlatComboBox on Toolbar in CodeJock10.4.2 ? |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hello,
use CXTPControlComboBox instead.
toolbar.GetControls()->Add(new CXTPControlComboBox (), ...);
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Makarand
Senior Member Joined: 27 February 2007 Location: India Status: Offline Points: 140 |
Post Options
Thanks(0)
|
Hi Oleq,
I have created Toolbar on client window by using CreateToolBar(..) method. I put some control and button on the toolbar --> //Control (Combo) m_wndToolBar.GetControls()->Add(xtpControlComboBox, IDCAL_COMBO) //Toolbar button m_wndCalTB.GetControls()->Add(xtpControlButton, IDMPVLEGEND); <-- By using LoadToolBar(..) we can set the toolbar with icons, but in CreateToolBar(..) How we can set the icon on the button? Please help me for the same. Thanks in advance. Waiting for the reply.... |
|
Makarand
Senior Member Joined: 27 February 2007 Location: India Status: Offline Points: 140 |
Post Options
Thanks(0)
|
Hi Oleq,
As per your suggestion I had made the change in my code. I replace the CXTFlatComboBox to CXTPControlComboBox and I am able to display the combo control on the toolbar. Out previous implementation is deferent as we have a structure with having member variable "HWND hComboBox;" which need to intialise with combo control "m_hWnd". CXTPControlComboBox class is not derive from mfc class (CWnd), so we can't get the m_hWnd from the CXTPControlComboBox? Which is the way where we can get the m_hWnd as we can't change our structure? |
|
Makarand
Senior Member Joined: 27 February 2007 Location: India Status: Offline Points: 140 |
Post Options
Thanks(0)
|
Hi Oleq,
Please help to solve above problem. I tried both method to put combo on toolbar, CXTFlatComboBox and CXTPControlComboBox. In CXTPControlComboBox : Not able to get the m_hWnd. In CXTFlatComboBox : Using m_combobox.Create(..) method, I can able to create combo but combo box getting placed on toolbar which already contains buttons. Thanks in advance. Waiting for the reply.... |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
See CXTPControlComboBox methods in SymbolReference.
You need pCombo->GetEditCtrl()->GetSafeHwnd();
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Makarand
Senior Member Joined: 27 February 2007 Location: India Status: Offline Points: 140 |
Post Options
Thanks(0)
|
Hi Oleq,
Thanks for the reply. My combo box is not editable, I am not getting GetEditCtrl()->GetSafeHwnd(); In this case what is the way to get m_hWnd Waiting for the reply.... |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hello,
not editable combobox doesn't have any handle. It draws directly to commanbar.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Makarand
Senior Member Joined: 27 February 2007 Location: India Status: Offline Points: 140 |
Post Options
Thanks(0)
|
Hi Oleg,
I have design the toolbar with com box control using GetControls()->Add(..) method. How can I create the separator as there is not separator XTPControlType. How do I get the rect position of toolbar and specific control or toolbar button? How can I add the CXTButton on toolbar? Please help me.... Waiting for the reply.... |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hello,
1,2. See CXTPControl members in SymbolReference.
3. see Samples\CommandBars\CommandBarControls sample.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Makarand
Senior Member Joined: 27 February 2007 Location: India Status: Offline Points: 140 |
Post Options
Thanks(0)
|
Hi Oleg,
How can I get the Crect value of the Toolbar button. My current implementation is as follow --> //Creating Toolbar VERIFY(m_wndCalTB.CreateToolBar(WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_FIXED, this)); //Setting Button if(!m_wndCalTB.SetButtons(calbuttons1,sizeof(calbuttons1)/sizeof(UINT))){ TRACE0("Failed to SetButtons\n"); nRtn = 0 ; } //Setting control on the toolbar CXTPControl *ctrl; CXTPControlComboBox *btComboBox; ctrl = (CXTPControlButton*)m_wndCalTB.GetControls()->FindControl(xtpControlButton, IDCAL_COMBO, TRUE, FALSE); m_wndCalTB.GetControls()->SetControlType(ctrl, xtpControlComboBox); btComboBox = (CXTPControlComboBox*)m_wndCalTB.GetControls()->FindControl(xtpControlComboBox, IDCAL_COMBO, TRUE, FALSE); btComboBox->SetWidth(nComboBoxWidth+30); //Problem to get the rect of the toolbar button. Crect rect; rect = wndCalTB.GetControl(2)->GetRect(); //rect gives the all value = 0 Please help me to get the rect position of the control/button. Thanks in advance. |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hello,
Yes wndCalTB.GetControl(2)->GetRect(); have return rect. Think toolbar is not moved to right position when you call it. Call RepositionBars to be sure it has right position.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Makarand
Senior Member Joined: 27 February 2007 Location: India Status: Offline Points: 140 |
Post Options
Thanks(0)
|
Hi Oleg,
I tryed function RepositionBars to get the Rect of the tollbar control. My code smiler like the example from CodeJock SAMPLES\DockingPane\MDIPanes\ Implemented same code for toolbar design which is in file ChildFrm.cpp int CChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) In OnCreate(..) function I add my code to get the rect value of ID ID_TOOLS_PROPERTIES CRect rect; rect = pControl->GetRect(); Not able to retrieve the rect value.... :( My child window is derive from CXTPFrameWndBase<CMDIChildWnd> Please Help me .... Waiting for the reply.... |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Makarand
Senior Member Joined: 27 February 2007 Location: India Status: Offline Points: 140 |
Post Options
Thanks(0)
|
Hi Oleg,
What are the replacement function for GetButtonInfo(..) and SetButtonInfo(..) for toolbar buttons? |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hello, What code you need replace?
|
|
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 |