 |
|
 |
Hi,
I'd like to initialize the colorpicker combo box to a previously selected color.
I'm using
m_ColorPicker.SetSelectedColorValue(m_ColorPickerColor);
in OnInitDialog.
I verified that m_ColorPickerColor is a valid COLORREF value but the drop box is blank and the variable m_ColorPickerColor is 0H when the following is executed in OnOK
m_ColorPickerColor = m_ColorPicker.GetSelectedColorValue();
I guessing I need more than SetSelectedColorValue.
Thanks
|
|
|
|
 |
|
 |
When CColorPickerCB running in based on dialog app is OK.
But when I dynamic creating it, I get an assertion in winctrl1.cpp line 186:
void CComboBox::MeasureItem(LPMEASUREITEMSTRUCT)
{ ASSERT(FALSE); }
My source code as follows:
// in .h file:
CColorPickerCB m_wndColorPicker;
// in .cpp file:
int CMyWnd::OnCreate() {
bRet = m_wndTextColor.Create( WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST | // <-- Assert!
CBS_OWNERDRAWFIXED | CBS_SORT | CBS_HASSTRINGS | WS_VSCROLL,
CRect(0,0,0,0), this, IDC_CHATOPAREA_TEXTCOLOR );
...
......
}
Why?
|
|
|
|
 |
|
 |
jrmd wrote: My source code as follows:CColorPickerCB <code>m_wndColorPicker</code>;
int CMyWnd::OnCreate() {
bRet = <code>m_wndTextColor</code>.Create( WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_SORT | CBS_HASSTRINGS | WS_VSCROLL,
CRect(0,0,0,0), this, IDC_CHATOPAREA_TEXTCOLOR ); Well, for starters, the CColorPickerCB class is used for the m_wndColorPicker member, but your code is failing when you try to create whatever class the m_wndTextColor member is.
If you have a good look at the point where the ASSERT is firing, you will see that it is firing in the CComboBox base class, and not within CColorPickerCB.
Peace!
-=- James Please rate this message - let me know if I helped or not!
If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
 |
|
 |
Now is OK because I added a virtual member function for CColorPickerCB:
void CColorPickerCB::MeasureItem( LPMEASUREITEMSTRUCT lpMeasureItemStruct )
{
}
|
|
|
|
 |
|
 |
Its really a very good program.
But i am getting an exception when i add a new member variable to CClorPickerCB.
Any solution plz........
|
|
|
|
 |
|
 |
OK - the first thing that anyone having trouble has to do is take the example application, build it, and test it. If the unmodified test app fails, then post a problem.
If it works correctly, it should be used as a guide to how to use the control.
If you are going to post without any further details on the problem (code being used, errors and/or exceptions encountered, call stack, debug vs. release issues, etc.) then there is no help I can provide.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
 |
|
 |
Dynamically changing (enlarging) the Font results in a very ugly and unreadable output because the line spacing between the different colors is not adjusted.
Is there an easy way to overcome this problem?
My control is on a full-page CFormView and I shrink/enlarge the font together with all the controls on the formview to account for the different screen resolutions.
I tried overiding OnMeasureItem in the view, but this is not called when I change the font.
|
|
|
|
 |
|
 |
Please send me a minimal application (zipped and encrypted) that demonstrates what you are trying to do. I will have a look at it.
Send it to spam(at)jrtwine(dot)com (yes, that is a real address).
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
 |
|
 |
Well, 9 months later... My apologies, I'm sorry.
I have found the simple (when you know it) answer myself. Something along the lines:
m_ColorCode.SetItemHeight(0, iHeight);
seems to do the trick nicely.
|
|
|
|
 |
|
 |
when I run my debug build of my app I get an assertion in winctrl1.cpp line 202. I create the variable and then call create and it is created on the toolbar. I know the code is correct until I get to the creation of your control because if I change the variable to CComboBox then it works fine. Plus it doesn't do anything wrong when I build it in release mode or in debug it does ok if I hit ignore. What could be the problem. Here is where I create it. Let me know if this would be the problem and why. m_wndToolBar.m_wndSnap.Create(WS_CHILD|CBS_DROPDOWNLIST|CBS_OWNERDRAWFIXED|CBS_HASSTRINGS, rect, &m_wndToolBar, IDC_SNAP_COMBO);
m_wndSnap is an instance of your control. Please help.
|
|
|
|
 |
|
 |
Please send me a minimal application (zipped and encrypted) that demonstrates what you are trying to do. I will have a look at it.
Send it to spam(at)jrtwine(dot)com (yes, that is a real address).
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
 |
|
 |
in order to solve this problem all you have to do is override the
MeasureItem() method...that's it.
virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);
do it with the wizard.
|
|
|
|
 |
|
 |
Hello everybody,
I'm trying to make a color combobox control. I set CBS_HASSTRINGS and CBS_OWNERDRAWFIXED styles and handle virtual function DrawItem(). It works great with CBS_DROPDOWNLIST style, but when I make combobox with CBS_DROPDOWN or CBS_SIMPLE my colors are lost. Can anyone tell me what I'm doing wrong?
Thanks in advans.
|
|
|
|
 |
|
 |
The control only supports the CBS_DROPDOWNLIST style of combobox.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
 |
|
|
 |
|
 |
Great code......
can you help me with mine, See I need to draw a line which will have a constant lenght according to the choices user select on the combo box the problem is, combo box is a string how can I interpret each string as a long integer so that I can apply those values for my line?
and do you know how to set line color with option buttons (Radio Buttons);)
thanks in advance
[BORN_TO_BE_GOOD]
|
|
|
|
 |
|
 |
You can use the Item's Data to store the length of the line you need to draw. That way, you can still present the user with textual information (if you choose to show both text and a line), or just use the Item's Data for drawing a line in the client area.
Setting line color, if I understand your question, would be as simple as waiting for a button to be pressed, and making the control change the color it uses to draw the lines. An additional COLORREF member would be how I would do it.
Sorry that I cannot provide more information, or some example code (as I want to do) but I am working on-site now and currently find myself with little free time.
Peace!
-=- James (Sonork:100.21837)
[Tip for SUV winter driving survival: "Professional Driver on Closed Course" does not mean "your Dumb Ass on a Public Road"!] [Get Delete FXP Files Now!]
|
|
|
|
 |
|
 |
Hi,
Thats great to see color combo box, as i needed.
Thanks for it.
I want to know , can this combo be made to look flat like (XP) style ?
Please reply.
|
|
|
|
 |
|
 |
The best (not the easiest) way I can think to do this is to take an existing implementation of a flat combo box (there are several out there), and simply "drop in" my item drawing code.
It should not be that hard to do...
Peace!
-=- James (Sonork:100.21837)
[Tip for SUV winter driving survival: "Professional Driver on Closed Course" does not mean "your Dumb Ass on a Public Road"!] [Get Check Favorites 1.6 Now!]
|
|
|
|
 |
|
 |
I need to use my custom colors, and a few methods would be useful for me, I think:
void RemoveAllColors();
btw, is control being updated?
|
|
|
|
 |
|
 |
I need to use my custom colors, and a few methods would be useful for me, I think: void RemoveAllColors();
You could just not call either of the stock Initialize... functions thus resulting in no colors needing to be removed and add your own. Although a new function to remove them all may be useful.
btw, is control being updated?
Yes, but only when I fix or add something.
Peace!
-=- James (Sonork:100.21837)
[Tip for SUV winter driving survival: "Professional Driver on Closed Course" does not mean "your Dumb Ass on a Public Road"!] [Get Check Favorites 1.6 Now!]
|
|
|
|
 |
|
 |
I want to create a comboBox in toolbar,But I don't know how to!
hope someone can help me!
Don't Look At Me That Way!
|
|
|
|
 |
|
 |
You need to create a Dialog bar, is easy.
best Regards And Happy Friday
Carlos Antollini.
|
|
|
|
 |
|
 |
Is it impossible to create a ComboBox in toolbar without creating a Dialog bar?
to be Ace.
|
|
|
|
 |
|
 |
You can create combobox in toolbar. I have one right now. But the easiest way is to use dialog bar.
|
|
|
|
 |