|
also try taking out the bitfields, making them full-sized values... i always had problems with those bitfields and their quirks
- Roman -
|
|
|
|
|
I have already tried getting rid of the bitfields.... same result. Thanks, though.... I'll try stepping in to the []'s soon to see what's up.
JennyP
|
|
|
|
|
Hello Jenny
I have had your problems. Apparently you cannot have a CArray of structs and a struct contains a CArray as a member. if you change all your structs to classes then there will be no problem. Just declare those classes with everything public.
Anyway, I would suggest a std::vector instead of CArray. I think this will work with structs as well
Best regards,
Alexandru Savescu
|
|
|
|
|
Alexpro wrote:
I have had your problems. Apparently you cannot have a CArray of structs and a struct contains a CArray as a member. if you change all your structs to classes then there will be no problem. Just declare those classes with everything public.
Excuse me, but I can't believe that.
There is no syntactical difference in C++ between a struct and a class. The one and only difference is, that the default visibility of a struct is public and the default visiblity of a class is private.
You are really sure you changed nothing, but made "class" where was "struct" and only added a "public:"? No additional constructors, no assignment operators no super class?
--
Daniel Lohmann
http://www.losoft.de
|
|
|
|
|
Thanks everyone. I think I'll put a little extra time/care in to the code and create separate classes for each of my structs replete with data access methods with light error checking. This will also make all of my top level data access code more readable.
I don't know what vectors are or how to use them, so out of expedience, I'll make classes.
Thanks!
JennyP
|
|
|
|
|
you should use vectors, they're rather simple to use:
struct MyStruct
{
int v1;
int v2;
};
std::vector<MyStruct> a;
a.push_back(MyStruct(5,6));
a.insert(a.begin() + 0,MyStruct(5,6));
a.erase(a.begin() + 1);
a[0].v1 = a[0].v2;
as you can see, vectors aren't at all complicated and will save you much time debugging a collection class manually made (those sometimes have bugs )
- Roman -
|
|
|
|
|
A text report I print from my MFC program is different in Print Preview versus hard copy.
In fact zooming in and out in Print Preview changes what's displayed.
Example: one column in my report might be:
My dog has fleas.
But in Print Preview, this might show as:
My dog has fl
Given Microsoft Word also shows these sorts of anomalies in Print Preview, I've always assumed it's a difference between rendering on the screen versus rendering on the printer.
So, a sanity check please: should I worry about a bug in my program or not?
(PS I've spent an hour checking the web for something that says "print preview is only an approximation and may never be an accurate representation of the printed output" - but haven't found any such statement.)
Russell Robinson (russellr@rootsoftware.com)
Author of TTMaker (Advanced Timetabling Software)
http://www.rootsoftware.com
|
|
|
|
|
print preview is only an approximation and may never be an accurate representation of the printed output.
print preview does a whole lot of scaling to do what it does. sometimes it totally messes up font sizes (which may be why your text is being chopped - font didn't scale along with a clip box around it). the real test is the printer. if it works on the printer, i usually ignore whatever PP is doing.
-c
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
if you have Acrobat Distiller or PDFWriter, print to that and see if the PDF that comes up has the same problem... if it does, go into Acrobat and explore through all the objects (text boxes, white filled rectangle boxes) that are there, see if something is getting printed over the text or if the textbox for the text is too small to fit the entire text (maybe miscalculated the width of the text)
- Roman -
|
|
|
|
|
In my app, I have the ability to create a text box in the view. The text box dialog has an Edit box in it that allows for multiple lines to be entered and allows for carriage returns. When I get the text back from the edit box, though, the carriage returns are supplemented with two characters -- newline and carriage return. I want to display the text from this edit box in exactly the same way as it is entered but when the text box shows up in the view, it has two strange box looking characters in it where the newline and carriage return should be and everything is on one with no line breaks. Any thoughts on how I can get this to change so that I can have the text box show up properly in the view.
|
|
|
|
|
how are you drawing the text in the view?
-c
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
Here is the code that displays the text in the view:
pDC->SetTextColor(Color);
pOldFont = pDC->SelectObject(&m_TextFont);
pDC->TextOut(m_StartPoint.x, m_StartPoint.y, m_String);
pDC->SelectObject(pOldFont);
If this gives you any idea of what I'm doing wrong...
|
|
|
|
|
try using pDC->DrawText
-c
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
make sure the destination text box (the one in your view, right?) also has the ES_MULTILINE window style (its also multi-line)
- Roman -
|
|
|
|
|
Stew wrote:
two strange box looking characters
These are actually a '\n' followed by a '\r'. If you switch it, i.e. make the '\r' followed by a '\n', it will be correctly displayed.
Check this link.
Anyway, could you post the code you use ? Because if you retrieve your text in a CString and redisplay it, it should not be any display problem.
~RaGE();
|
|
|
|
|
here is the code if it helps:
pDC->SetTextColor(Color);
pOldFont = pDC->SelectObject(&m_TextFont);
pDC->TextOut(m_StartPoint.x, m_StartPoint.y, m_String);
pDC->SelectObject(pOldFont);
|
|
|
|
|
My question is, does anyone have an example of code that would mimic the group selection functionality of the Power Point type applications using DrawDragRect or some other function?
I'm trying to use the DrawDragRect() function in my app for group selection purposes much like in Power Point, etc... I want to be able to traw the rectangle and stretch it to enclose certain objects in my view. I'm using the function and I'm using the Halftone brush. I understand how that works with the background and foreground colors and all. My question, though, is in regards to the brush used when drawing the rectangle. When I start to draw the rectangle, the view is shown completely in the halftone brush format (Dithered) and the inside of the rectangle is drawn transparent only when it is dragged from the bottom right of the screen to the top left of the screen.
|
|
|
|
|
I already know how to do windows programing using only the win 32 api. Now I am learing Visual C++ .NET. How easy is it to mix the two?
For instance could I create a dialog box class with VC++ and then use it in a win 32 api program?
Are there any potential problem of which I should be aware?
Would it be better to create the dialog box as a dll?
|
|
|
|
|
|
Actually I am more interested in calling MFC from a win 32 api application.
For example if I wrote a game, I would want to use win 32 api for everything except the dialog boxes which would be done with MFC.
Can I just add the files that define dialog boxes to my win 32 project and then use them the same as I would from MFC?
Or would I have to create a MFC project and then use the win 32 api calls to create the main window?
Would creating the MFC Dialog as a DLL help?
|
|
|
|
|
You're confusing several things. Visual C++ is not a language, it's the development environment. When you make a dialog with the VC resource editor, it doesn't restrict you to any particular flavor of C++, whether it's straight APIs, MC++, etc.
.NET and MFC are class libraries. .NET (from my second-hand knowledge of it) is pretty much a complete abstraction layer away from the Win32 API, whereas with MFC you can (and will!) use a lot of your API knowledge.
As for mixing, you can freely mix straight APIs, ATL, WTL, and (with the right compiler settings) MFC. You can also mix managed and normal code with VC.NET, although you can use .NET only in managed code.
--Mike--
Just released - RightClick-Encrypt v1.3 - Adds fast & easy file encryption to Explorer
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
I understand that Visual C++ is a collection of classes (MFC) and Wizzard that automate the construction of those classes. And I know that you can use the win 32 api functions from MFC.
What I didn't know till now is whether I can take a win 32 api project and then inport MFC classes as needed.
For example if I write a game I would want it to be a win 32 api application because MFC is too inefficient and inflexible for serious game programing. (Plus I hear it doesn't play nice with Direct X and possible Open GL). But I would like to use MFC for setting and what not.
What compiler setting would I need to add an MFC dialog box to a win 32 api application?
|
|
|
|
|
Hi all,
I'm looking for a training project that can help me to learn C++ more easily and also efficiently.
Please let me know if you have any good training project in mind or any website that I can find C++ training project. Thanks in advance.
|
|
|
|
|
beginner-beginner level: simple console application to print out say, the fibonacci sequence
intermediate-beginner level: a console app to apply simple encryption to a raw data stream from a binary file ("somefile.dat") and output it to ("outfile.dat") then revert it back
expert-beginner level: a console app to parse a mathematical function expression string (e.g. "sqrt(9) + 5 ^ x * 2.1 + 1") and print out the result
just some suggestions
- Roman -
|
|
|
|
|
Hi all,
I'm looking for a training project that can help me to learn C++ more easily and also efficiently.
|
|
|
|