|
Perfect! Thanks!!!
~Steve
|
|
|
|
|
I have control that somewhat resembles a tree,
where each control node have one or many group nodes (CGroupNode), and each group node have one or many leaf nodes(CLeafNode).
New requirement is: Decouple control from data.
So that there will be: CTreeControl(draw gui, sends actions) and CTreeDataProvider provides data about group, leaf nodes to CTreeControl.
Any suggestions on what pattern shall I use?
Brian
|
|
|
|
|
I use the Bridge pattern as described by the GOF Book for exactly this. The tree has no idea what it's data source is or what it is displayed. There is an abstract tree container class for this, and the derived class provides the tree data upon request.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
I'm trying to generate file names in a loop:
char fName[10];
for(int i=1;i<5;i++)
{
fName = "file" + i + ".txt";
// rest of the code...
}
is it possible?
Please help.
Thanks.
|
|
|
|
|
CString fName;
for ( i=1; i < 5; i++)
{
fName.Format("file%d.txt", i);
}
===============================
C:
char fName[256];
for(int i=1;i<5;i++)
{
sprintf(fName, "file%d.txt", i);
}
|
|
|
|
|
|
Working with a frame grabber and I have to grab an image at a given point in time (software trigger). Can grab the image save it as a bitmap, jpg etc... The problem is this is of a high speed moving object and it needs deinterlacing. everything I have tried is failing. I objects movement is always horizontal. This cannot be as hard as I am making it, can it?
Scott
|
|
|
|
|
Check out the CxImage library . Maybe it does what you want !
I am the mighty keeper of the book on knowledge . Contact me to get your copy .
|
|
|
|
|
|
At this point I am not... That is what I am looking to do. I cannot use an external tool as this is part of an integrated application. Therefore I have been working on methods of deinterlacing use odd scan line averaging. This does not work all that well. "Yet"
|
|
|
|
|
Ok, you experienced programs will probably get a laugh out of this one but here goes anyway:
Is there any way to have an owner drawn list box be a bitmap (I have successfully loaded it and everything) but still use LB_ADDSTRING and all the other Win32 messages that work on standard list boxes?
When I say bitmap, basically a nicely drawn square "window" with a nice border and nice shading?
If not, what are, if any, the Win32 messages analogous to WM_CTLCOLORLISTBOX that will change the scroll bar and the vertical strip that it lies on...and also the black border around the list box (if created with CreateWindow...)
Thanks in advance.
|
|
|
|
|
You can subclass the listbox and then handle the WM_NCPAINT ! It handles the border and no client region drawing ! In MFC it`s way much simpler ! Derive a class from CListBox and in the WM_NCPAINT do this for a cool border :
FrameRect(HDC,&clientRect,GetSysColorBrush(COLOR_HIGHLIGHT))
with the toolbar ... i didn`t have much luck on it either !
I am the mighty keeper of the book on knowledge . Contact me to get your copy .
|
|
|
|
|
Thanks for that one...subquestion: does your book of knowledge extend a little into regions and how to properly set them for owner drawn buttons so they can be circular instead of square? I have a posted a thread on this: Regions, but haven't gotten any replies unfortunately...
|
|
|
|
|
I have need to convert double values to string representations that exclude a presentation of a decimal and can provide a variable number of significant digits. Should I develop a class to do this or is there some easier/faster way?
double ValueA = 3.9876;
CString TwoSigDigits = "39"
CString ThreeSigDigits = "398"
CString FourSigDigits = "3987"
If it helps the double values will always be positive and less than 1000.
Thanks.
Chris Meech
"what makes CP different is the people and sense of community, things people will only discover if they join up and join in." Christian Graus Nov 14, 2002.
"AAAAAAAAAHHHHHH!!!!! Those leaks are driving me crazy! How does one finds a memory leak in a garbage collected environment ??! Daniel Turini Nov. 2, 2002.
|
|
|
|
|
I don't know of any available code, but it seems like all you need is a function to convert doubles to strings with a given number of significant digits. First you need to round the value and then add insignificant zeros if required.
If you need help writing this code, let me know.
Regards,
Alvaro
Quitters never win. Winners never quit. But those who never win and never quit are idiots. -- despair.com
|
|
|
|
|
Thanks Alvaro. I'll put a class together to do the stuff. It'll be a nice relaxing way to spend the afternoon Maybe I'll post it next week as an article.
Chris Meech
"what makes CP different is the people and sense of community, things people will only discover if they join up and join in." Christian Graus Nov 14, 2002.
"AAAAAAAAAHHHHHH!!!!! Those leaks are driving me crazy! How does one finds a memory leak in a garbage collected environment ??! Daniel Turini Nov. 2, 2002.
|
|
|
|
|
CString z, a;
a.Format("%f", ValueA)
a.Remove('.');
z = a.Left(N);
|
|
|
|
|
Thanks Brian. That's just the ticket.
Chris Meech
"what makes CP different is the people and sense of community, things people will only discover if they join up and join in." Christian Graus Nov 14, 2002.
"AAAAAAAAAHHHHHH!!!!! Those leaks are driving me crazy! How does one finds a memory leak in a garbage collected environment ??! Daniel Turini Nov. 2, 2002.
|
|
|
|
|
Am I doing something wrong here? Because this crashes on the marked line.
Oh and how would I create a DC that is compatible with a bitmap that I want to select into it?
CDC dc;<br />
CBitmap bmp;<br />
<br />
<br />
bmp.CreateCompatibleBitmap(&dc, width, height);<br />
CBitmap *old = (CBitmap*)dc.SelectObject(bmp);<br />
<br />
<br />
dc.SelectObject(old);
|
|
|
|
|
|
I can't believe it compiled with out that.
Jason Henderson "You must be the change you wish to see in the world." - Gandhi
articles profile
|
|
|
|
|
Really eh?
Should have caught that...
|
|
|
|
|
CGDIObject has an override that will cast it to some type that SelectObject likes - but i think it's the wrong value, or it's not attached to the CGDIObject anymore, or something really strange and unexpected.
i've been bitten by it a number of times.
-c
Image tools: ThumbNailer, Bobber, TIFFAssembler
|
|
|
|
|
Jason Henderson wrote:
I can't believe it compiled with out that.
The beauty of conversion operators designed by... um, less experienced designers. If you weren't aware - MFC is (almost?) the hallmark of bad C++ design.
|
|
|
|
|
Ah! I am used to not noticing things like that unless the compiler errors :p
Thanks, I'll see what I can patch up. But what about the 2nd question? How do I create a compatible CD for a bitmap?
|
|
|
|