|
is ok i now but i need s1+s2 = sT but my code make this : MessageBox(s1); and then diplay MessageBox(s2); but i need s1 + s2 = sT MessageBox(sT);
How?
Bravoone
|
|
|
|
|
can you change the MessageBox(sT) statement outside the for loop and try.
Regards,
Ram
|
|
|
|
|
Can you try using CListCtrl::GetFirstSelectedItemPosition(), CListCtrl::GetNextSelectedItem()?
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
m_list1.GetFirstSelectedItemPosition() : is not a member of 'CListCtrl'
Bravoone
|
|
|
|
|
Bravoone_2006 wrote: m_list1.GetFirstSelectedItemPosition() : is not a member of 'CListCtrl'
Then whatever you are programming is not Visual C++ / MFC.
Oh, wait, it could still be VC++ 5.0 from the mid-nineties.
Just kidding, but this function *really* should be there.
Failure is not an option - it's built right in.
|
|
|
|
|
Here it is[^? And you didn't find it.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
|
Use these two functions to get the selected items and the text related to them. Store them in some array(if the items selected are variable) and then add them up outside the loop by traversing the array.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
no,no you dont understand the user must not select the items he checks them!!!!!! only items checks i need them to get the value !
Bravoone
|
|
|
|
|
Hello.
I have created a CFormView based program and have added another CFormView class. I have tried to use this: pDoc->SetTitle("First View") for the first view and pDoc->SetTitle("Second View") for the second view. When file->open, the first view appear with the title "AppName - [First View]" but when I clicked on the menu for the second view, the first view title changed to "AppName - [Second View:1]". How can I make the title of the first view unchanged when the second view is opened?
Thanks.
|
|
|
|
|
You should set the caption text of the frame instead of setting the documents title.
GetParent()->SetWindowText("First View");
It's not rocket surgery!
Within you lies the power for good, use it!!!
|
|
|
|
|
er..
How do I use that code?
I've tried replacing it with the old one but the title bar stays the same as the original.
|
|
|
|
|
Aint wrote: How do I use that code?
Why you cant use of it?
|
|
|
|
|
Ive tried but it didnt work.
Do I need to put something extra other than that line?
|
|
|
|
|
Hi,
this is because you have maybe used my answer about the child window (if not, more or less the same that I had). The fact is that you are opening more views from the same document, and the MFC puts automatically the ":1", ":2"... to differenciate them. You can avoid it by overriding CChildFrame::OnPreCreateWindow (CREATESTRUCT& cs) If you re-read (or read for first time :P) the answers I wrote you in your message about the Child Window... You will find a line in the code with pDoc->m_szNewFrame there is where I save the string of the new title to the new window, and the new frame takes the title from that string.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
hi.
Ive tried but I have an error for this part: CMDIChildWnd* pMDIActive = MDIGetActive();
'MDIGetActive' : undeclared identifier.
Is there any header that I need to include?
|
|
|
|
|
It is supposed to work without problems. Are you including the "stdafx.h"?
Did you use the assistant to create the project? or did u implement all by yourself?
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
Hi,
I tried to reproduce your issue. I used MDI, two CFormView Derived class and added to doc template and in its OnInitialUpdate I set GetDocument()->SetTitle("First View") and second view. But I can't reproduce issue ,even i didn't get suffix index 1,2....
In MDI each view has its own document instance right. Would I like to know your setup, did you add multiple views to same doc, and where did you used pDoc->SetTitle();
Best Regards
|
|
|
|
|
yes. multiple views to the same doc.
used pDoc->SetTitle() at OnInitialUpdate() of both views.
thanks.
|
|
|
|
|
Hi,
I reproduced your issue, you are setting the text for the same document instance by pDoc->SetTitle(), this will affect the same string object.
Hence the last string you updated "SECONDVIEW" is the only document title, this is updated to all the views hence the FIRSTVIEW is changed to SECONDVIEW:1;
The frame title of the views are updated by CFrameWnd/CMDIChildWnd::OnUpdateFrameTitle()
we have advanced override for it.
override your frame windows OnUpdateFrameTitle() and do the following
this will set the frame title and overrides the default behaviour.
<br />
CChildFrame::OnUpdateFrameTitle(BOOL bAddToTitle)<br />
{<br />
CString szTitle = m_strTitle;
<br />
if (m_nWindow > 0)
{<br />
szTitle.AppendFormat(_T("%d"), m_nWindow);<br />
}<br />
<br />
SetWindowText(szTitle);
}<br />
then on your view's OnInitialUpdate() do the following
<br />
GetParentFrame()->SetTitle(_T("SECONDVIEW"));
this will set the views frame title which we use at the OnUpdateFrameTitle override
rather than
<br />
pDoc->SetTitle(_T("SECONDVIEW"));
this works verified
Best Regards
May be the same thing will be done by another way.
-- modified at 5:50 Friday 1st June, 2007
|
|
|
|
|
Hey Rajkumar_R,
Thanks for reproducing my issue. Your method works.
To Nelek,
Thanks to you too.
|
|
|
|
|
Hi another time... I'm not going to copy the whole code another time, so open (in a new window) this link:
http://www.codeproject.com/script/comments/forums.asp?msg=2029429&forumid=1647&ForumID=1647&XtraIDs=1647&author=Nelek&sd=21%20Feb%202007&ed=22%20May%202007&stype=1&Page=3#xx2029429xx[^]
Now the explanations about every socket of code.
First: Declare the pDocTemplate.
I used it to have a different Menu to the new Views added, and to have the possibility to use the implementation of MFC about the views of the Document (GetFirstViewPosition and so on). I think this is clear, isn't it?
Second: CreateOrActivateNewFrame
These function has to be implemented in CMainFrm.cpp (and declared in the CMainFrm.h of course). What it makes is to look for kinds of the pDocTemplate that I give as first parameter and check out the second parameter (the name of the element of my project that owns the view) to know if a new frame has to be created or is already created and only need to set it active on the front.
Third: PreCreateWindow
This function is a MFC message already implemented in CChildFrm if you used the assistant... If not... no problem, make it by yourself is a standard MFC message. In this function what I make is to check if it is the MAIN (CScrollView) view or one secondary view (If the document doesn't exist and the m_szNewFrame has nothing in it... is the main one, otherwise a secondary). If it is the main, I leave the default configuration. If it is a secondary (CFormView) I check which of the three different types is, modify the size of the frame and FOR ALL secondary... I set the title of the new frame with cs.lpszName = pDoc->m_szNewFrameName; AND NOT using pDoc->SetTitle () (this only works for the main frame and all the descendents at the same time, not for a independant secondary frame).
Fourth: Using it
In my project I have 3 type of objects visibles in the view. When I make a double click I check if the click was in one of the already placed elements. If there is a match... then I take the name of the element, set the pDoc->m_szNewFrameName string with the element's name and some other things I want to have in the caption of the new window and use the function of the CMainFrame to CREATEorACTIVATE the new view passing the DocTemplate that I want for this specific element and the name of the element (who is going to have the intern ownership).
Fifth: Extras...
This was not written in the other message, but when I open the new CFormView I override the OnInitialUpdate to INMEDIATELY erase the content of pDoc->m_szNewFrameName string. This is to avoid conflicts and to be sure that the main window will have no problems if I choose to open a new document (that is a new CScrollView and all the necessary CFormViews). If you dont do it... then the new MainFrame will be limited to the values of the last CREATESTRUCT that you used...
I hope this time you have understood my explanation... and it works for you as well as for me.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
Hi all,
I have a difficulty in finding difference between two 12 digit number.
my problem is this
9999 9999 9999 - 1111 1111 1111 = 8888 8888 8888.
I wish to do this operation. But i couldnt able to store these two 12 digit numbers as a integer. can anyone please suggest me some ideas?
Thanks in advance.
Regards,
Ram
|
|
|
|
|
use __int64.
__int64 nNum1 = 999999999999;
__int64 nNum2 = 111111111111;
__int64 nResult = nNum1 - nNum2;
nave
|
|
|
|
|
How can i convert sring to _int64? because my "9999 9999 9999" and "1111 1111 1111" is a string. I need to convert these string values to _int64 and do the subtraction. after do the operation, i need to convert the result from _int64 to string. is there any way to do it?
Thanks a lot.
Regards,
Ram
|
|
|
|