|
<b></b>I drived a class from CObject;all like this;
class CPerson :public CObject
{
public:
CPerson();
CPerson(CPerson &person);
CPerson & operator =(CPerson person);
CString m_strName;
};
CPerson::CPerson()
{
m_strNmae=_T("");
}
CPerson::CPerson(CPerson &person)
{
m_strName=person.m_strName;
}
CPerson &CPerson::operator =(CPerson &person)
{
m_strName=person.m_strName;
return *this;
}
but erro happed in compling ;the message is:
d:\microsoft visual studio\vc98\mfc\include\afxtempl.h(255) : error C2558: class 'CPerson' : no copy constructor available
d:\microsoft visual studio\vc98\mfc\include\afxtempl.h(1566) : while compiling class-template member function 'class CPerson __thiscall CArray<class CPerson,class CPerson &>::GetAt(int) const'
Error executing cl.exe.
who can tel me where is the erros!
I am Made!
|
|
|
|
|
Your operator= is defined in .h file incorrectly.
CPerson& CPerson::operator=(CPerson person) ;
It should really be:
CPerson& CPerson::operator=(const CPerson& person) ;
Also if you define an operator= you should also define a copy constructor
CPerson(const CPerson& other) ;
CPerson::CPerson(const CPerson& other)
{
// copy across member variables
}
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
Hi,
I'm writing my first app in VC++6, what I want to do is have one parent window which contains a number of child windows with grids in them to display data. Each grid must be independant (i.e. they are not just different views of the same data, but contain totally independent sets of data.) The entire project must then be saved, i.e. all the data in all the grids stored in a single file.
This suggested to me that I should not be creating multiple views, so I am currently creating a new dialog whenever the user clicks a button on the toolbar, and keeping track of them all using a CTypedPtrList in the document. I created the app using AppWizard, as an SDI app with CFormView as the view class.
Is this the correct / best way to accomplish what I want? Or should I be doing something else? If this is not the best way, an explanation of the advantages/disadvantages would be very much appreciated.
Cheers,
Jonathan.
|
|
|
|
|
Hi,
I'm sorry that this is not a VC++ problem. But i really want to hear some experience from you in this this message board.
I have a new Pioneer CDRW/DVDRW driver (newly published DVR-A04-J). And I have installed some related softwares (Drag and Drop CD, DVDit! SE, MyDVD). Now when i uninstall all of above softwares, the problem occured: The driver cannot be displayed by the exploer. I have try
many methods for deal with this, but i am failured. I used Windows 2000 professional. Is there a method for finding my cd-rom? or i must be re-install the windows 2000?
Thanks in advance!
chen
|
|
|
|
|
Everytime I open Visual C++ dev studio I get a message box with this remark. Two questions:
1.: What the hell is he talking about.
2.: How to get rid of this annoying thing?
thx in advance...
|
|
|
|
|
ViolaCase wrote:
1.: What the hell is he talking about.
He is talking about windows of the ressource editor (dialogs, bitmaps, icons and so on). Because processing the ressource script is somewhat time consuming, he does not reopen this windows at project open time.
ViolaCase wrote:
2.: How to get rid of this annoying thing?
Just ignore it, it's really nothing you need to care about. Or close all ressource windows before exiting VisualStuido
--
Daniel Lohmann
http://www.losoft.de
(Hey, this page is worth looking! You can find some free and handy NT tools there )
|
|
|
|
|
thx for your reply, Daniel
One thing: I really HATE popup windows with stuff I want nothing to do with. Believe me, I am not a dumb.
But... pls..
You sayd: 'Or close all ressource windows before exiting Visual Studio'
Problem: Whatever 'window' I close before exiting VS, this annoying popup msgbox greets me again the next time.
I want to get RID of it...
Hope you will read this, because a lot of posting is going on now here on CP.
|
|
|
|
|
Hm... I always believed it has to do with resource windows.
Just checked it again. It seems to have something to do with the WizardBar. MS calls it a bug. Maybe it helps if you just remove the WizardBar. This knowlegde base article explains the details.
ViolaCase wrote:
Hope you will read this, because a lot of posting is going on now here on CP.
Hey, come on - lots of traffic means wie have a cool forum
--
Daniel Lohmann
http://www.losoft.de
(Hey, this page is worth looking! You can find some free and handy NT tools there )
|
|
|
|
|
Hello,
I am writing a dialog based application in VC++ 6.0
I was wondering if there is a way to detect if a user has chosen to display Large Icons or Large font on his computer using the desktop properties. I will appreciate any input on this. Thanks !!
Sincerely,
Anjum.
|
|
|
|
|
You can detect the font size use the following:
CDC ScreenDC;
ScreenDC.CreateIC(_T("DISPLAY"), NULL, NULL, NULL);
int nLogDPIX = ScreenDC.GetDeviceCaps(LOGPIXELSX),
nLogDPIY = ScreenDC.GetDeviceCaps(LOGPIXELSY);
ScreenDC.DeleteDC();
if(nLogDPIX == 120 && nLogDPIY == 120) { // 120 DPI, Large Fonts
}
else { // 96 DPI, Small Fonts
}
|
|
|
|
|
Yet Another List Control Question
i'm doing a subitem edit on a report-style list control. when the user clicks on a subitem, i put an edit control on top of the list control and the user deposits (types) his junk.
the problem is that the list control holds onto the mouse - you can't mouse-select anything in the edit control. so, i came up with two choices:
1. do a SetCapture/ReleaseCapture thing for the edit control. SetCapture when editing starts, then Release when it loses focus or the user hits Enter. i think this is overkill.
2. disable the list control while the edit control is up. this is ugly, since the list control goes gray.
so, my questions are:
1. if i do #2, is there a good way to control the disabled appearance (maybe just the background color?) or the list control, without doing an owner drawn control?
2. is there another way to make this work?
this is on an Explorer context menu extension, so i don't want to use a full-blown grid control.
-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
|
|
|
|
|
Chris L
This is not an answer to your question. But I am amazed at your ability to create all kinds of nifty custom controls. That really is your speciality.
I must say that of all the custom control stuff on CP yours is the best in my opinion [though I am sorta biased by the fact that I don't think much of those fancy buttons and menus]. I always feel that having a multi colored tooltip or a super-fancy button isn't as useful as having a control that actually does sosme stuff. Like a font selectiopn combo for example which is a lot lot more useful than say a combo box that looks like it walked out of cartoon network.
I raise my hat to you Losinger
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
thanks man.
sadly, i feel that the Clean UI Purist is going the way of the Command Line Purist.
Flash is what the kiddies like
-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
|
|
|
|
|
Chris, it's late, so i may have read this totally wrong, but how about just doing a ReleaseCapture() on the list control prior to displaying the edit control? I'm assuming you're doing this in response to NM_CLICK and not LVN_BEGINLABELEDIT to make it obvious that the cell is editable (not requiring the user to double-click).
Another possible solution, one that i've used and works very nicely (although it takes a bit more effort) is not to wait for the click at all, but instead to float the edit control as soon as the user moves the mouse cursor over the cell. This lets the edit control behave exactly as it would be expected to, without any subclassing.
---
Shog9
If I could sleep forever, I could forget about everything...
|
|
|
|
|
how does this handle mouse selection of text in the edit control?
i think if you have full-row select enabled, the list control eats all the mouse clicks somehow.
-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
|
|
|
|
|
Chris Losinger wrote:
i think if you have full-row select enabled, the list control eats all the mouse clicks somehow.
??? I stopped and did a quick test app, the list control doesn't seem to be doing anything that nasty... You're using an edit control which is a child of the list control, right?
---
Shog9
If I could sleep forever, I could forget about everything...
|
|
|
|
|
I do the same in many list controls in my apps. When the user double-clicks an item I identift it and place an edit control on top of the list control. As long as I made sure it was top most, I never had any problem with the mouse not being able to select text etc in it.
m_EditList.SetWindowPos(&wndTop, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
This code to edit and item is not within the list control itself, its added into the class that has the lst control
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
Can anyone point me in a direction of how to add Checkboxes into a list box?
|
|
|
|
|
use CCheckListBox
-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
|
|
|
|
|
Thanks for the pointer there... Now I go on to the otehr problem I always seem to have, The Create function for CCheckListBox has a parameter that calls for a CWnd for a parent window. I am using the Dialog editor and I don't know how to get a CWnd for that, I have the HWND of the dialog box, but not a CWnd.
Can anyone point me to how to get that?
Quinn
|
|
|
|
|
if you're using the dialog editor, you probably don't need to worry about Create.
put a normal list box on your dialog. then using ClassWizard (or ctrl-dbl-click from the resource editor) make a CListBox member variable attached to that control.
then, go into the header file for that dialog and change the CListBox to CCheckListBox.
now you can use that member variable to control your listbox.
-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
|
|
|
|
|
Just curious how do you implementent UNDO/REDO capabilities in your projects...?
Currently i've been thinking about an idea using templates for implemententing this functionality. Basically drop the object into your code and call your funcitons in reverse order for an undo effect and visa-versa, my object takes care of the rest.
However I started looking for examples of UNDO/REDO and found only a few which weren't very helpful, i'd like to know how others have maybe done this in the past and possibly will do so in the future.
So anyways...how do you do it...?
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
1. make an object that can encapsulate a single change from one state in your data to the next. the info in this object has to be complete enough so that you can use it to go from state N to state N-1.
ex. if you're writing a text editor, each keystroke could create a "state" object that holds the newly-entered keystroke and the cursor position. that way, to undo that state, remove the character at the cursor pos.
every action that changes the state of the data must be recorded, and you must be able to apply this info to go back to the previous state. this may mean copying the whole data set, if the changes are drastic (ex. resizing an image requires that you store the whole image, since you can't reconstruct from the new image).
2. make an undo stack and a redo stack
3. at each state changing event, create a new state object that records the changes you are making to the data (keystroke, and cursor pos, for example) and push it onto the undo stack. clear the redo stack.
4. for an undo, pop the top object off the stack and use the info therein to undo the action (ex. remove the char at pos X). push the object you just popped onto the redo stack.
5. for a redo, pop an object off the redo stack, apply its changes in a negative way (whereas the undo stack removed char X at pos Y, the redo stack will add char X at pos Y). push tat object onto the undo stack.
this will do unlimited undo/redo.
see my colorizing text editor for a working example.
-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
|
|
|
|
|
Chris Losinger wrote:
2. make an undo stack and a redo stack
Most seem to be implemented this way, but I found mine was easier using a single stack.
Other than that we're pretty much on the same wave length...I guess UNDO/REDO implementations aren't all that different from each other...
Thanx alot
cheers
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
I use a 2-way link list. The current position in the list allows undo/redo actions to be performed. This allows the user to navigate up/down the list at will. If the user has undone an action and then does something different, then the "redo" actions in the list are chopped of and deleted.
I typically used a structure in the list which had the undo/redo action ID, and a void* pointer to the undo/redo data. So your code can place nay kind of info into the list.
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|