|
Ah...found my problem. If I simply use "EDIT" as the class name it works. I guess for some reason I thought I needed a new class for each Edit Control. Thank you Mark for giving me the right clues!
|
|
|
|
|
Give them different names... different IDs.... but different classes?
Glad you got it!
Cheers,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Gilson wrote: I guess for some reason I thought I needed a new class for each Edit Control.
Don't confuse a window class (EDIT) with an MFC class (CEdit ).
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Mark Gilson wrote: If I simply use "EDIT" as the class name it works.
I thought I told you that, or at least I tried with the code snippet...
Glad it works now, but a dialog with 512 edit boxes?
I guess I would close that window and never open it again....
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Mark Gilson wrote: Right...as I said, this isn't my exact code
You may have intended to say it, but that does not mean it got read. Go back and re-read your post. Notice anything missing, like:
"...display. Please note that I have code in addition to the above which displays the textboxes in different locations (topleft & bottomright are changed for each textbox). Does anyone have any suggestions as to why I am unable to view these textboxes?"
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
If David's most accurate reply doesn't help because you've posted code that's not the same as you're trying to build, then I'm curious about what's hidden behind the "controlname " identifier.
Is it really "Edit" for edit boxes, as CEdit::Create() would use, or is it a window class you've registered yourself?
On the other hand, since you're already walking through the array of CEdit pointers and presumably calling SetWindowPos() , you could also call ModifyStyleEx() in order to add the WS_EX_CLIENTEDGE style to your controls.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
I am having problem opening a file after I change the version number. I would like to add an extra variable to class... changed int Version = 6; and said if(Version >5) ar>>newVariable;
void CLineClass::Serialize(CArchive& ar)
{
if(ar.IsStoring()){
int Version= 5;
ar<<Version;
ar<<m_ChannelName<<m_IsAltered<<m_MaxNumberOfBoards<<m_LineAddress<<m_LineColor<<m_ShortChannelName<<
m_LookUpTableFilename<<m_Units<<m_DecimalPlaces<<m_Description<<m_PrivateNotes;
}
else{
int Version;
ar>>Version;
ar>>m_ChannelName>>m_IsAltered>>m_MaxNumberOfBoards>>m_LineAddress>>m_LineColor>>m_ShortChannelName>>
m_LookUpTableFilename;
if(Version>2)
ar>>m_Units;
else
m_Units=0;
if(Version>3)
ar>>m_DecimalPlaces;
if(Version>4)
ar>>m_Description>>m_PrivateNotes;
}
m_COperationArray.Serialize(ar);
m_LookUpTableArray.Serialize(ar);
}
modified on Wednesday, November 12, 2008 12:52 PM
|
|
|
|
|
What you've posted can be considered as "dummy code".
Dummy code only works for explaining a concept, but you've already proven the concept with "version 5".
I suggest you post the real code instead.
What you've posted doesn't even compile due to spelling errors and mismatching braces.
This is to prevent an endless loop where the rest of us find errors in the code you've posted and you go "my real code doesn't look like that". And if no error is found in the dummy code you won't know what's wrong with the real code.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
void CLineClass::Serialize(CArchive& ar)
{
if(ar.IsStoring()){
int Version= 5;
ar<<Version;
ar<<m_ChannelName<<m_IsAltered<<m_MaxNumberOfBoards<<m_LineAddress<<m_LineColor<<m_ShortChannelName<<
m_LookUpTableFilename<<m_Units<<m_DecimalPlaces<<m_Description<<m_PrivateNotes;
}
else{
int Version;
ar>>Version;
ar>>m_ChannelName>>m_IsAltered>>m_MaxNumberOfBoards>>m_LineAddress>>m_LineColor>>m_ShortChannelName>>
m_LookUpTableFilename;
if(Version>2)
ar>>m_Units;
else
m_Units=0;
if(Version>3)
ar>>m_DecimalPlaces;
if(Version>4)
ar>>m_Description>>m_PrivateNotes;
}
m_COperationArray.Serialize(ar);
m_LookUpTableArray.Serialize(ar);
}
|
|
|
|
|
Seriously, what do you reckon the code block and preview buttons do when you're making a post?
|
|
|
|
|
sabdalla80 wrote:
void CLineClass::Serialize(CArchive& ar)
{
if( ar.IsStoring() )
{
int Version = 5;
ar << Version;
ar << m_ChannelName << m_IsAltered << m_MaxNumberOfBoards;
ar << m_LineAddress << m_LineColor << m_ShortChannelName;
ar << m_LookUpTableFilename;
ar << m_Units;
ar << m_DecimalPlaces;
ar << m_Description << m_PrivateNotes;
}
else
{
int Version;
ar >> Version;
ar >> m_ChannelName >> m_IsAltered >> m_MaxNumberOfBoards;
ar >> m_LineAddress >> m_LineColor >> m_ShortChannelName;
ar >> m_LookUpTableFilename;
if( Version > 2 )
{
ar >> m_Units;
}
else
{
m_Units=0;
}
if( Version > 3 )
{
ar >> m_DecimalPlaces;
}
if( Version > 4 )
{
ar >> m_Description >> m_PrivateNotes;
}
}
m_COperationArray.Serialize( ar );
m_LookUpTableArray.Serialize( ar );
}
I've taken the liberty to format the code above to make it more readable since you didn't use the <pre></pre> tags, which you ought to when you're posting code in the forums.
You have to verify that the serialization of all classes for the member variables works properly by using the debugger.
Step through the code in CLineClass::Serialize and see at which line it asserts.
You said you wanted to increase the version number and add a variable to be serialized. Have you tried following the pattern in the code above?
I'm unable to find any error in the code you've posted so far, but you also said that version 5 worked.
Make sure you're not trying to read a file with a higher version number than the code supports by verifying that the version number in the file is less or equal to the version number of the code.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Sorry, didn't notice the buttons....
I got it working with the same code, not exactly why it didn't work the first couple of times I tried it.
Thanks for your help
|
|
|
|
|
sabdalla80 wrote: why it didn't work the first couple of times I tried it.
Obviously you didn't try it enough times!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I am using a CListCtrl with 'LVS_ICON'.
In VS2003 the different icons in the ListCtrl could be selected that caused the default behaviour (Blue Selection-Box). In the newer version of the Visual Studio the Selection-Box does not appear and the icons disappear when selected.
Has anyone an idea what the problem might be?
|
|
|
|
|
The list view control is provided by the operating system,
not Visual Studio.
MrNyquist wrote: Has anyone an idea what the problem might be?
There's a problem in the code
What are all the styles used to create the control?
What does the code look like that adds items?
How are you providing images to the control?
etc...
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: The list view control is provided by the operating system,
not Visual Studio.
OK ... but the problem with the ListCtrl occured with the change of the Visual Studio (change of MFC Version)...
Here some code:
The ListCtrl is created with:
m_ListCtrl.Create(WS_CHILD|WS_VISIBLE|LVS_ICON|LVS_ALIGNTOP|LVS_SINGLESEL|LVS_AUTOARRANGE, rect, this, ID_OFEN_LIST_CTRL);
The ImageList is created with:
m_ImageList.Create(m_nWidthIcons, m_nHeightIcons, ILC_COLOR32, m_nInitial, m_nGrow);
m_ListCtrl.SetImageList(&m_ImageList, LVSIL_NORMAL);
The items were added with the following code (item --> LVITEM):
item.mask = LVIF_IMAGE|LVCFMT_CENTER;
item.iItem = nIndex;
item.iSubItem = 0;
item.iImage = nIndex;
item.state = LVIS_FOCUSED;
m_ListCtrl.InsertItem(&item);
The images are drawn with a CBitmap object:
m_ImageList.Add(&bitmap, RGB(0, 0, 0));
|
|
|
|
|
Excellent info, thanks!
MrNyquist wrote: item.mask = LVIF_IMAGE|LVCFMT_CENTER;
LVCFMT_CENTER is for column definitions. That's going to mess something
up using it as an item mask! Remove that
MrNyquist wrote: item.state = LVIS_FOCUSED;
Not a problem, but this is doing nothing since you haven't specified the
LVIF_STATE mask.
I tested using your control styles with the LVCFMT_CENTER removed and it
worked fine (VS 2008 SP1, Vista Ultimate).
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
hmm just for the heck of it I looked at the values for
LVIF_IMAGE and LVCFMT_CENTER....they are the same, so even though
LVCFMT_CENTER is used incorrectly, it has no effect.
I'm unable to reproduce any problem using your code
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hey Mark!
Thx for your efforts...
I found the mistake in my code.
The image list is now created with the following code:
m_ImageList.Create(width, height, ILC_COLORDDB|ILC_MASK, nInitial, nGrow);
The images were added with:
m_ImageList.Add(&bitmap, m_crFillColor);
'm_crFillColor' is the background color of the list control.
|
|
|
|
|
I need to write some projects both Vc6 and Vc8, so I'm searching to a way to easily convert a project between different compiler version.
I create the project in vc6, then I update it in vc8 correctly. And the program is everytime correcly compiled and run.
But the files and project are in the same folder, this is a problem because every project puts its output in the same Debub and Release subfolder.
A temporary solution is to "clean all" before compile, but i'm not sotisfied because it isn't easy to have the 2 version of the project opened at the same time.
The clean solution that I'm trying to use is to create some folders like
MyProjFolder
Sources (it contains every .cpp, .h and .rc files)
res
vc6 (it contains the project for vc6: files .dsw and .dsp)
Debug
Release
vc8 (it contains the project for vc8: files .sln and .vcproj)
Debug
Release
I linked all the resources (cpp and h files) in every project (contained into the Source folder) but when compiling this error comes:
fatal error C1083: Cannot open precompiled header file: '.\Debug/***.pch': No such file or directory
any tip?
Russell
modified on Wednesday, November 12, 2008 10:03 AM
|
|
|
|
|
Russell' wrote: any tip?
Perhaps you should use a Source Control program and share the source files into both projects.
This does not account for the differences between the compiler support for C++. I don't know how you plan to deal with that but there is a lot of stuff available in VC2008 that is not in VC6. I highly recommend retiring VC6.
led mike
|
|
|
|
|
Perhaps you are right, but the problem doesn't seems a problem regarding the compiler version: simply seems that every version of visual studio doesn't like that you put the source files out of the default folder.
As I told before, the project are correctly compiled with every compilers (I tested it)...the problem comes when I try to use the same phisical files, this is necessary for me to go on this multiplatform develope.
thanks
Russell
|
|
|
|
|
I don't know for sure but it does sound like having separate projects and folder structures using Source Control to share the code files would be a simple solution.
led mike
|
|
|
|
|
led mike wrote: ...having separate projects and folder structures using Source Control to share the code files would be a simple solution.
I agree.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Russell' wrote: every version of visual studio doesn't like that you put the source files out of the default folder.
Not true at all!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|