|
|
Comments and Discussions
|
|
 |

|
Sir,
I generate a splitter wnd and attach a frame with toolbar. When run application with your code, it breaks at:
if (!m_wndToolBar.m_SelThresCombo.Create(WS_CHILD|WS_VISIBLE | CBS_AUTOHSCROLL |
CBS_DROPDOWNLIST |
CBS_HASSTRINGS ,
rect, &m_wndToolBar,
IDP_PLACECONTROL2))
BOOL CComboBox::Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd,
UINT nID)
{
CWnd* pWnd = this;
return pWnd->Create(_T("COMBOBOX"), NULL, dwStyle, rect, pParentWnd, nID);
}
And error info is:
Unhandled exception in XXX.exe (MFC420D.dll):0xC0000005: Access Violation
early wait for your help.
Thanks!
|
|
|
|

|
Check the following codes.
CComboBox m_wndSnap;
CMainToolBar m_wndToolBar;
and then,
m_wndToolBar.m_wndSnap.Create(......)
Because m_wndToolBar belongs to CMainToolBar class and m_wndSnap belongs to CComboBox, why does m_wndToolBar.m_wndSnap work?
bonmeepon means pupcorn
|
|
|
|

|
Hi,
I'm trying to catch the user pressing return so I can implement a search on the entered text, but I cannot find where this keypress goes - neither OnChar, OnSelendok or any other function seem to receive this message!
Help!
|
|
|
|

|
I have a toolbar on SDI frame. I am able to add the buttons onto the toolbar at run time. I want to draw line or draw rect on that buttons. I don't want to insert a BMP into it.Can anybody let me know how I can draw line or draw rect on that buttons at run time. Thank you in advance!!!
|
|
|
|

|
Hi Dear Friend.
I have Problem in changing Font of Combobox .
could u please help me?
i have added this codes before AddString("");
but the font has not changed.
CWnd *dcCwnd = CWnd::FromHandle(m_wndToolBar.m_wndSnap.m_hWnd);
CDC *dc = dcCwnd->GetDC();
CFont font;
VERIFY(font.CreatePointFont(120, "Arial", dc));
// Do something with the font just created...
CFont* def_font = dc->SelectObject(&font);
dc->TextOut(5, 5, "Hello", 5);
dc->SelectObject(def_font);
// Done with the font. Delete the font object.
font.DeleteObject();
thanks allot
Koorosh Nosrati Heravi
|
|
|
|

|
Hello
I have a toolbar that one of the buttons has a drop-down / floating menu (the dialog of CFileDialog for example) - how can I get a handle to that menu?
Thanks
Alex
|
|
|
|
|

|
Randy,
How would one use your method of imbeding controls in a toolbar and catching events from those controls (Like a dropdown combobox 'CBN_SELCHANGE')?
Thanks for any info you can provide.
|
|
|
|

|
Hi,
In the View class .h File, delcare the message map function.
afx_msg void OnSelchangeCombo();
DECLARE_MESSAGE_MAP()
Link the function to the corresponding ID in view .cpp file.
BEGIN_MESSAGE_MAP(CControlToolBarView, CView)
ON_CBN_SELCHANGE(IDC_SNAP_COMBO, OnSelchangeCombo)
END_MESSAGE_MAP()
Define the function in View .cpp file.
void CControlToolBarView::OnSelchangeCombo()
{
}
I have tried this from the code that is created by the MFC App wizard for an event.Think this will help you.
Regards
|
|
|
|
|

|
Hi,
I tryed your way to put a ComboBox in a Toolbar, it works well, except that the ComboBox isn't the same as you !!!
It's a big, flat ComboBox.
How can I do to have the same little ComboBox as on the pic ?
Thanks
Phil
|
|
|
|

|
First of all, excuse my english
I have a suggestion for you.
Why no to try this piece of code :
int index = m_wndToolBar.CommandToIndex(IDP_PLACEHOLDER2);
rather than :
int index = 0;
while (m_wndToolBar.GetItemID(index) != IDP_PLACEHOLDER2) index++;
to get the index of the placeholder.
Best regards
Thim;P
|
|
|
|

|
Me again.
#define statements
in the body of the code isn't very convenient.
I like your pedagogy nevertheless
Thim
|
|
|
|

|
I have placed CCombox and CEdit,but it does not work when i place a CStatic!!!
|
|
|
|

|
Hmm, it worked for me, here's the function I created in my custom toolbar:
BOOL CSearchToolBar::CreateStatic(CStatic& txtStatic,
CString strText,
UINT nIndex,
UINT nID,
int nWidth)
{
// Create the combo box
SetButtonInfo(nIndex, nID, TBBS_SEPARATOR, nWidth);
CRect rect;
GetItemRect(nIndex, &rect);
rect.top = 1;
if (!txtStatic.Create(strText, WS_VISIBLE, rect, this, nID))
{
TRACE("Failed to create static window...\n");
return FALSE;
}
return TRUE;
}
|
|
|
|

|
thanks that solves even my problem
to display an image in toolbar
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|

|
I placed an User Control successfully to the toolbar. But how do I catch the event fired from the control ? Please help.
Thanks in advance.
Dominic
|
|
|
|

|
How can I place a menu on a toolbar?
CSZX
|
|
|
|

|
When we use Visual Studio to develop our project,we ofen use the Drop-Down Arrow by the Undo-button to show a window and select more than one steps to undo.I want to
do such a window and tried a lot,but failed.Please give me a solution to show how to make such a window using MFC.
Thanks.
|
|
|
|

|
There are numerous examples on creating an IE style coolbar but they do not show how to create the address band which as a combo box and tool button.
Although you can embed a combo box in a toolbar control it does not resize when moved to a new location in the ReBar.
Marcus Carey
|
|
|
|

|
Hello thanks for the codes. It helped me a lot.
I still have a problem. I wanted to add an event using tab keys.
I have an SDI application. It has a tree view and a list view (like an windows explorer - windows 95 ).
When i press the tab key, i wanted to change the focus ( from the treeview to the listview, from the listview to the combo control, from the combo control back to the treeview ).
I could already change focus from treeview to listview, and listview to combo control. But when changing focus from combo control to treeview i'm not getting the focus of the treeview, it keeps on returning to the combo control. Can you help me with this?
I have attached my codes for changing the focus
BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
{
if( (pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_TAB) )
{
switch( g_intFlag )
{
case 0 :
{
g_bListViewActivated = TRUE;
// set focus to list view
GetRightPane( )->OnActivateView( 1, GetRightPane( ), GetLeftPane( ) );
g_intFlag = 1;
break;
}
case 1 :
{
g_bComboActivated = TRUE;
// set focus to combo box
m_wndCombo.SetFocus( );
g_intFlag = 2;
break;
}
case 2 :
{
g_bTreeViewActivated = TRUE;
g_bXComboActivated = TRUE;
// set focus to tree view
GetLeftPane( )->OnActivateView( 1, GetLeftPane( ), GetRightPane( ) );
g_intFlag = 0;
break;
}
} // end case
} // end if
return CFrameWnd::PreTranslateMessage(pMsg);
}
Also is there any way i could force an object. Like an combo control to lost its focus.
Thanks and more power.
piyer
|
|
|
|

|
How do I handle the capturing of the data in these ToolBar Combo Boxes? I want to handle it the same way it would be done if these comboboxes were in a dialogbar or something like that. I also want to be able to send a message to my application when the item in the combo box is changed. Any thoughts?
One other thing, the combo box doesn't show all of the possible choices in it. It will scroll itself down when the user selects an item that is low on the list as it will display that item as the first item in the list, but when that happens, I can't get to any of the items above that selection. I'm just wondering how to get a scrollbar in the combobox.
|
|
|
|

|
I'm getting an error at the following line of code:
while (m_wndToolBar.GetItemID(index) != IDP_PLACEHOLDER2) index++;
I'm not sure what I'm missing. I must have missed something in the OnCreate before this line of code, but I'm not sure what it is. I created the Toolbar class that I'm using and declared the two CComboBox members. I'm just not uerstanding how to get everything working together.
Thoughts?
|
|
|
|

|
You need to call LoadToolBar(ToolBarID);
|
|
|
|

|
I had to add few codes to make the checkboxes look "enabled" because they looked "DISABLED."
m_wndToolBar.m_wndCenter.SetButtonStyle( BS_AUTOCHECKBOX );
m_wndToolBar.m_wndEdge.SetButtonStyle( BS_AUTOCHECKBOX );
m_wndToolBar.m_wndTrack.SetButtonStyle( BS_AUTOCHECKBOX );
m_wndToolBar.m_wndZoom.SetButtonStyle( BS_AUTOCHECKBOX );
|
|
|
|

|
I created a toolbar in wich I add buttons dinamically. When the number of buttons rise over a certain number or when I resize the browser window, ALL OF THE BUTTONS disappear. I have two questions:
- Have you got any idea on why they disappear all at a time and not one at a time (depending on how much I resize the window)?
- How can I do to put the buttons in excess in a popup at the end of the toolbar? Is this a property of the toolbar itself or do I have to manage it manually?
Thanks in advance
Vale
|
|
|
|

|
Hi,
I want to create a toolbar that has custom colored buttons. the purpose of this is to create a color-chooser for a paint-like application. I need some "standard" colors (red, blue, green, black, white, etc.) and one button for "custom" color that the user will choose with a standard color chooser.
the question is - how do I change the color of the buttons on a toolbar?
Thanks
|
|
|
|

|
Hi,
I have an Outlook Add-in and have to add a button for displaying one of my dialogs in Outlook. I also need to implement the clicking of the button and displaying of my dialog. This Add-in is written using win32 SDK.
I haven't started it and need ideas (couldn't find any).
Thanks in Advance
Ashley
|
|
|
|

|
I use DevStudio and don't use the MFC, ie Visual C (no ++) or Win32 API.
Can you get a resizing toolbar without the classes?
Any I create do not change size if the window changes or the monitors resolution changes.
I also need to put other controls apart from buttons but one step at a time.
|
|
|
|

|
Hi,
When using your code to inserty combobox in a toolbar, we cannot have tooltips on the combobar. I don't understand why (i set the style of the toolbar to CBRS_TOOLTIPS, and it doesn't work !!).
Anybody has an idea ??
Thanks
Jean-Yves
|
|
|
|

|
Hi Jean,
Am also facing similar kind of problem ,not able to see tooltips on a combobox.If you know any solution to this problem please let me know
Thanks
Uma
|
|
|
|

|
This is because placeholder's style is changed to separator. Separators doesn't produce tooltip notification massages.
|
|
|
|

|
Nothing new. Absolutely. Look at CTRLBARS example in MSDN.
I can't help wondering why some people still post articles
while more informative ones can easily be found in MSDN Lib..
|
|
|
|

|
And waht are you contributing? My mother always said that if you don't have anything nice to say about someone then don't say anything at all. So I won't say anything about YOU
|
|
|
|

|
Look around, dear User, how many articles with NEW ideas
can one find on this site? Too few, and it disappoints.
Most contributors receive 4.1-4.8 for their
articles and almost no negative comments. One can post
MS VS addon which almost ruines resource file in a project.
It wasn't merely thought through. This one was not rated below 4. Yes, some comments improved it much, but nobody said "Hey, did you ever tried it by yourself?". And that's the common tendency
I thought that this site was destined for sharing ideas,
not for rising self-esteem. I didn't mean to offend anybody.
Criticism is very stimulating thing, IMHO. But slightly more
hurting than coffee :
|
|
|
|

|
You are right Alex,The Problem you mentioned above are much more serious than here in chinese bbs site. Any guy will be considered as a skilled programmer in chinese bbs if he can read the articles here and translate it into chinse and post it.
Like me heeeheee .
|
|
|
|

|
????????????????,???????
?MSDN????????
???????,???????
????????,?????,???????????????
?????????
This is like me read English.
|
|
|
|

|
Don't display Chinese!
Why my programme have to support English.
|
|
|
|

|
I have to agree with Alex. What is the point in posting a rehash of information that is better presented in MSDN? This doesn't help anyone. I came to this site in hopes of finding something truly informative. Instead all I did was waste time.
The editors of this site do no-one any favors by posting redundant material. It's a nice looking site and all, but I would be more impressed with a plain text format that actually taught me something.
And as for snide rejoinders, I have posted articles elsewhere that I thought filled in missing gaps. I tried not to waste my own time and that of others by posting something I'd already seen elsewhere
|
|
|
|

|
It may be "nothing new", but consider this:
The site can and should contain content for developers of ALL skill levels. It also acts as a central point for developers, grouping related techniques and samples together - something which MSDN often totally fails to do.
As such it is perfectly valid for articles describing and expanding on techniques also addressed in the VC/MSDN documentation to be posted on the site.
If this were not the case, why bother including tutorials?
If you're unhappy with the content of the site you should either try to contribute in a CONSTRUCTIVE manner or don't comment at all. You always have the option of not looking at it if the content annoys you that much
|
|
|
|

|
I totally agree with you, I am new to windows programming and I come here for help and only look for the subject matter that I need help on.
|
|
|
|
|

|
I agree and disagree with your statement. Although the article may be on MSDN who the hell can find it! Almost every search will bring you at least 100 hits of which the 1st 20 are probably not what your looking for. In your defense tis article could have been a bit more detailed. The creation of the toolbar itself is not shown the author should have tried it themselves. I do think it an ok article.
To err is human, therefore I must not be human.
|
|
|
|

|
Actually this article was quite new to me. After wasting a lot of time searching MSDN,
I took a look at the codeproject site. I found Randy's solution immediately, and after
reading your response I also built the CTRLBARS example.
Thanks to Randy for saving me a lot of time!
And thanks to Alexander for pointing me to the CTRLBARS example
(but lose the attitude Alexander).
|
|
|
|

|
How can i add an edit box with a spinner buddy to the toolbar?
|
|
|
|
|

|
Your suggestion on how to add combos or other windows to a toolbar is great. In my application however, the font displayed by the combo box is large - I guess it is using the system font. The buttons however are using a much smalled font.
I tried to use the approach you outline for adding 4 check boxes instead, and this works fine to adjust the combo font. I had to fiddle with the font size to have something that looks like the font used by the toolbar buttons.
Is there a more direct way to pick up the font used by the buttons and to apply it to the combo?
sincerely
fre
|
|
|
|

|
Try using this after creating your control.
myControl.SetFont(myToolbar.GetFont());
This method doesn't require you to create a fon
|
|
|
|

|
Ha! Love it!
Simple trick, but its nice and neat!
Thanks!
Adam Bialowas
|
|
|
|

|
It's been a long time since the question was asked, but I'll post a response for the benefit of others... You can set the font on any CWn by calling the SetFont( &font ) method. To get ahold of the default GUI font from the OS, call CreateStockObject(DEFAULT_GUI_FONT), which creates a CFont for you equivalent to what the rest of windows is using. Dont forget to delete the object when you are done. CFont font; font.CreateStockObject(DEFAULT_GUI_FONT) ); m_cmboZoom.SetFont( &font ); font.DeleteObject(); Hope that helps...
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
|
How to place combo-boxes, edit boxes, progress controls, etc. into toolbars
| Type | Article |
| Licence | |
| First Posted | 12 Jan 2000 |
| Views | 219,723 |
| Bookmarked | 116 times |
|
|