|
Using Visual C++ 6.0 and MFC
I have populated a CEdit control programmatically. Sometimes the text is longer than the display area.
Can anyone please tell me how to issue a command to scroll back to the start of the text. Currently it always scrolls to the end.
Thanks in anticipation
Sara
|
|
|
|
|
How did you get the such a strange behaviour ... ?
I've just created a MFC dialog-based app with a single line edit control and I tried that code:
1)m_edtText.SetWindowText("I'm the man with the mission");
and that:
2)m_strText = "I'm the man with the mission";
UpdateData(FALSE);
and all works fine (it means - I can't reproduce your app behaviour =).
Anyway - try this code:
m_edtText.SetSel(0,0);
Hope it will help you.
Best regards,
-----------
Igor Soukhov (Brainbench/Tekmetrics ID:50759)
igor_soukhov@yahoo.com | ICQ:57404554 | http://siv.da.ru
|
|
|
|
|
Calling the CEdit member function SetSel(0, 0, FALSE) will scroll it so the first character is visible.
p1514
|
|
|
|
|
Many thanks to Ben, anonymous , markkuk.
As a result of your help (jun 14) I share the next example program that worked very well for my purposes:
// Example about using map
#include <iostream>
#include <string>
#include <utility>
#include
using namespace std;
const int tam=10;
struct stTot {
string stLey;
double dMonto[tam];
};
stTot myTot;
map<string, sttot=""> mpCont;
string clave;
int main()
{
myTot.stLey = "Text one";
for(int i=0; i<tam; i++)
="" mytot.dmonto[i]="i+11;
" mpcont["one"]="myTot;
" mytot.stley="Text two" ;
="" for(i="0;" i<tam;="" clave="two" mpcont[clave]="myTot;
" map<string,sttot="">::iterator it = mpCont.find("one");
cout << (*it).first << " " << (*it).second.dMonto[3] << endl;
it = mpCont.find(clave);
cout << (*it).first << " " << (*it).second.stLey << endl;
return 0;
}
/*
Output obtained for both cases is:
one 14
two Text two
*/
|
|
|
|
|
Unfortunately, some words or characters seems not to be displayable, for example the include files: these are iostream, string, utility and map, all enclosed in angular parenthesis.
There some others but I think these are easy to discover for the interested people.
|
|
|
|
|
They're lost because HTML is parsed in our posts. SO a < > pair is assumed to contain an HTML command and is therefore not shown. To get those signs I used & lt and & gt, without the spaces.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Alternatively you could use the <pre> tag before your code segment and the </pre> after, everything in between should be exactly as you typed it.
Michael Martin
Pegasystems Pty Ltd
Australia
martm@pegasystems.com
+61 413-004-018
|
|
|
|
|
hey guys,
how do i save my drawing, which i make using onDraw(CDC* pDC) in a MFC application as an image file or how do i export it to word or any other software??
Nitish
|
|
|
|
|
GDI+ lets you save images in a variety of formats, at last count GDI supports - none. Sorry
Seriously though, there is code on the CP to save bmp files, if you want a variety of formats, you can go to www.paintlib.de and download paintlib. It supports bmp, gif, jpg, png, tif and if they've finally put in the code I gave them last year, tga as well.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Actually i am facing the problem to open a new dialog window by clicking a hyperlink in the client area of the window--
How is it possible?
Can i insert menu in a dialog window?
|
|
|
|
|
Hi Syjoy !
1)To open dialog you should write a responce code (to a hyperlink click) like the sample below:
CYourDlg dlg;
dlg.DoModal();
please note that rhe example is for a modal dialogs only ... hope it will be enough for you.
2)Yes it's possible.
3)To insert menu into dialog (assuming that you're using MFC, ClassWizard and other usefull stuff =):
a)Insert a new menu into resources ... name it IDR_MENU1
b)select a dialog you'd like menu insert into (Resource View "Tab"->Dialog->)
c)Select diagog properties - (rigth click on the dialog)
d)Select "General" Tab
e)In "Menu" combo select IDR_MENU1.
f)compile project
g)link project
h)debug it a little
i)run it
j)enjoy =)
I'm in a rather good mood today =);P
Best regards,
-----------
Igor Soukhov (Brainbench/Tekmetrics ID:50759)
igor_soukhov@yahoo.com | ICQ:57404554 | http://siv.da.ru
|
|
|
|
|
Actually i am facing the problem to open a new dialog window by clicking a hyperlink in the client area of the window--
How is it possible?
Can i insert menu in a dialog window?
|
|
|
|
|
Hi
Please tell me how to convert from int to BSTR in VC++.I want to create a xml node with an int value.I need to pass BSTR variable to the method createTextNode().
How can I do it?
Thanks.
Pathi
bhikshapathi_g@semanticspace.com
|
|
|
|
|
Convert the integer into a string using itoa and then either type cast it directly to BSTR or copy it first in a CString object and then into a BSTR.
I hope this helps.
|
|
|
|
|
TCHAR szStringRepresentation[32];
wsprintf ( szStringRepresentation, _T("%d"), nYourIntegerValueHere );
pInterface->CreateTextNode ( _bstr_t(szStringRepresentation) );
--Mike--
http://home.inreach.com/mdunn/
#include "buffy_sig"
|
|
|
|
|
I have an MFC application that has some dialogs with there classes. I want to take these dialogs with the classes into a dll. How can I do that.
Please this is urgent...
Anyone knows why Visual C++ compiler causes problems in Windows 2000.
|
|
|
|
|
DLL:
Create an MFC extension DLL project with the App wizard.
Include (copy over) your dialog classes, and resources. (you can open the original apps .rc file and drag and drop the dialog templates to your dll projects resource view).
Add AFX_EXT_DLL to the declaration of your CDialog based classes (after the class keyword).
Compile the dll.
APP:
In the apps that will use it, include the now modified (AFX_EXT_DLL) headers for the dialogs and the defines for the resource ids of the dialogs - try not to conflict with any of the existing apps dialog IDs.
Add the dlls lib file to the apps project link settings.
You should be able to work with the classes in your app, as long as it can find the DLL.
|
|
|
|
|
After posting the above, I ran into some strange problems as I went to test in release - some strange problems with VC that I don't think I have seen before - seems ok now, but could you describe a bit more about the type of workspace you're working and the problems you are having?
Also, what service packs do you have for VC (HKLM\Software\Microsoft\VisualStudio\6.0\ServicePacks)
|
|
|
|
|
I want to show only shared folders in the BrosweforFolder Dialog.Normally it shows the folders / or set folder in the machine + Shared folders in other machine.But i want this default behaviour to be changed and it should show only shared folders in the machine from which it is run.Can any one have a solution ...pls reply....
|
|
|
|
|
For do it, you must use of MCI ...
In MSDN is several example about it ...
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
From memory ( and I could be wrong, LMK and I'll dig up my old source code if this does not work ), you need to select the row and column before doing the insert.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Thanks for the advice although I did try that. I am giving up on the FlexGrid and going with the CListView. It does what I want as well.
Thanks again,
Brad
|
|
|
|
|
OK. I'm sorry - I worked with it nearly two years ago and had constant problems, but it's too long for me to remember much about it. If you come back to Flexgrid, LMK and I'll be happy to dig around some old backup CD's for my source code.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
No problem at all. Actually I am happier using a ListView instead. I feel more comfortable with it.
Anyway, thanks again,
Brad
|
|
|
|
|
christian is right ... you have to set the current row and current column before doing the insert
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|