|
Did you add the cpp file to the project? I don't mean the paths to folders where the cpp or header is sitting, i mean the file itself? If not, could it be that the unresolved symbols are defined in that cpp?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
of course I did. I added both the .h and the .cpp file in the solution explorer.
|
|
|
|
|
Sounds to me like you're linking against something that claims to be a .lib or .obj file, but isn't - could that be the header file?
I think you actually want to be adding the .h and .cpp files to your project and building them into it.\, from your question.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I did it. I added the .h and .cpp file in the solution explorer and build the project. but it doesn't work.
|
|
|
|
|
MozhdehQeraati wrote: doesn't work
'Doesn't work' encapsulates sooo many ba things...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
A question is such:overload a function OnSize(). I want, that buttons at the stretch of basic window either upwards or to the right saved the positions in relations to the overhead and right edges of main window.
Code:
void CMobileTISDlg::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);
if(Flag)
{
int nCount = ResData.size();
for(int i=0;i<nCount;i++)
{
GetDlgItem(ResData[i].nID)->SetWindowPos(&wndTop, cx - ResData[i].aPoint.x, cy - ResData[i].aPoint.y, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
}
}
}
ResData is a vector, containing structures
Код:
struct ResizeStruct
{
CPoint aPoint;
UINT nID;
};
Filling of structure:
void CMobileTISDlg::SetResData(UINT nID)
{
ResizeStruct Res;
CRect rc, rcForm;
GetDlgItem(nID)->GetClientRect(&rc);
GetClientRect(&rcForm);
Res.aPoint.x = rcForm.right - rc.left; Res.aPoint.y = rcForm.bottom - rc.top;
Res.nID = nID;
ResData.push_back(Res);
}
A problem is such: at testing of the program the buttons appear in one place in the left corner of the program.
Started a debugger? top and right of Rect rc in function SetResData() are always equal to the zero. What is my error in?
modified on Wednesday, August 26, 2009 1:56 AM
|
|
|
|
|
Instead of this:
zhenek91 wrote: GetDlgItem(nID)->GetClientRect(&rc);
try this:
GetDlgItem(nID)->GetWindowRect(&rc);
ScreenToClient(&rc);
Also, read this[^] and pay attention what the remarks section says.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
It's not an answer to your question, but you might be interested in this section[^] in the articles. Why redoing something that has probably already be done ?
|
|
|
|
|
Thank you, first variant helped me to solve problem
modified on Wednesday, August 26, 2009 2:45 AM
|
|
|
|
|
Hi,
I read the article about "Adding Checkboxes to a list control" and it was really helpful.
But what I want to do is to add a checkbox in every column and every row. And I want to be able to read and set the checking.
Is there any way to do it?
At the moment my code looks like this:
listCtrl.SetExtendedStyle(listCtrl.GetStyle()|LVS_EX_CHECKBOXES);<br />
CString str;<br />
str.Format("Col0");<br />
listCtrl.InsertColumn(0, str, LVCFMT_LEFT, 100);<br />
str.Format("Col1");<br />
listCtrl.InsertColumn(1, str, LVCFMT_LEFT, 100);<br />
str.Format("Col2");<br />
listCtrl.InsertColumn(2, str, LVCFMT_LEFT, 100);<br />
<br />
int nItem;<br />
<br />
nItem = listCtrl.InsertItem(0, "Row0");<br />
str.Format("Col1");<br />
listCtrl.SetItemText(nItem, 1, str);<br />
<br />
nItem = listCtrl.InsertItem(0, "Row1");<br />
str.Format("Col2");<br />
listCtrl.SetItemText(nItem, 2, str);
Thanks for every help,
Moritz
|
|
|
|
|
I think the standard list control does not have such a feature, you have to do it yourself with owner drawn items and handling clicks in the list.
Sidenote: Why are you combining the normal styles with an extended style here:
Member 4709444 wrote: listCtrl.SetExtendedStyle(listCtrl.GetStyle()|LVS_EX_CHECKBOXES);
? Isn't that suposed to be GetExtendedStyle() instead of GetStyle() in there?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Member 4709444 wrote: Is there any way to do it?
I used XListCtrl for this.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Thanks for the help.
As I am very unexperinced with this, CListCtrl looks like an overkill to me.
Is there any easier way? I only need checkboxes, not animated lists
Thanks,
Moritz
|
|
|
|
|
Member 4709444 wrote: CListCtrl looks like an overkill to me.
Then why would you ask how to use checkboxes with it?
Member 4709444 wrote: I only need checkboxes, not animated lists
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Ahhh, sorry.
I meant, XListCtrl looks like an overkill to me.
X and C are so close together.
I understand how to use the CListCtrl.
The only thing I want additionally are checkboxes in more columns.
Thanks,
Moritz
|
|
|
|
|
Member 4709444 wrote: The only thing I want additionally are checkboxes in more columns.
And you can either do all of it yourself (which is not a trivial exercise), or you can use the control that Hans has already put together.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Thanks for the help.
As CListCtrl looks to complx for me for my small app, i decided to do all the click capturing manually and just to draw different background colors in stead of checkboxes.
There I only included this project for the colors: Adding color to Listview with customdraw[^]
Thanks again,
Moritz
|
|
|
|
|
Member 4709444 wrote: As CListCtrl looks to complx for me for my small app...
How can a list control be too complex here...
Member 4709444 wrote: There I only included this project for the colors: Adding color to Listview with customdraw[^]
...but not here? I'm not convinced you know what it is that you do want.
The XListCtrl link I provided you required you to: 1) add two files to your project, 2) replace CListCtrl with XListCtrl , and 3) call the control's SetCheckbox() method for those columns you want to contain a checkbox. It does not get any simpler.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I would like some example code in visual c++ for reading a access file . Pass a file name and receive the data back.
An example would work really well.
thanks.
Merlin Vilhauer
merlin Vilhauer
|
|
|
|
|
|
I will be given a char *text="cat sad cattle saddle"
I need to check if my char *pattern="ca" match any of the text
there are rules like "." matches any character
[rt] and as long as it match one of the character in the []...
this is crazy, anyone can sugguest a function in c++ that will do the job?
|
|
|
|
|
ayeosq wrote: ...anyone can sugguest a function in c++ that will do the job?
The string class has many methods. Have you looked? The CRT has functions like strstr() that might also interest you.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Your idea seems to be basic regular expressions evaluation system.Read this article how to build your own regex parser.
Life is a stage and we are all actors!
|
|
|
|
|
hi
I need the help for , How to connect the sql server using MFC
Thanks !
~~~~~~~~Raju~~~~~~~~~~~~~
|
|
|
|
|
Using CDatabase and CRecordSet is possible solution but there is some other ways too.There is plenty of samples at codeproject how to use these classes just see here and and here.
Life is a stage and we are all actors!
|
|
|
|