 |
|
 |
I tried copying text with the keyboard and pasted with CTRL+V and doesn't work. It only works when right click and select pasted.
|
|
|
|
 |
|
 |
Have you tried Ctrl+Insert to paste?
This may sound odd, considering that the Ctrl+X/C/V keys were all you had in the old/Win16 days (anyone remember 84-key keyboard layouts?), it seems that you are more likely to have the Ctrl/Shift+INSERT/DELETE work than the X/C/V ones.
Anyway, in my demo app, Ctrl+V works to paste - at least, it does if you are not filtering input. The bug appears to be in CFocusEditCtrl::PreTranslateMessage(...).&bnsp; the calls to Get*KeyState(...)should be passing 'V', not 'V' (uppercase, not lowercase).
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
 |
 | CEdit  |  | Amorevieta | 3:10 18 Oct '05 |
|
 |
Hi, I´m working with Edit Control, in visual C++, I can set the focus to the CEdit I want, but I´m not able to select the initial text, to let the user write once he opens the window.
I mean, when the user open the window which contains the CEdit, this CEdit has the focus, but the initial text it contains is not selected, then the user has to remove this initial text and later write the new text.
Does anybody know which function should I use to do what I need?
Thanks in advance,
Adilia
|
|
|
|
 |
|
 |
GetWindowTextLength to get the length of text, SetSel to select it.
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
 |
|
 |
hi..
can anybody plz tell me how do i set focus back to the edit box after clearing its contents..?
thanx in advance..
pallavi
|
|
|
|
 |
|
 |
Call CWnd::SetFocus(...).
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites
|
|
|
|
 |
|
 |
hi.. thanx.. Still can't come out of VB and expect everything after a dot (.)... Anyways.. learning VC++ .. The focus always goes to the first edit box on the window.. i have two different fields .. how do i do this? Regards Pal
|
|
|
|
 |
|
 |
I think you have to specify the ID of the edit box you want to set the focus on, it seems you always use the first ID.
Kind regards,
Amorevieta
|
|
|
|
 |
|
 |
The EIN (Tax ID) format is NN-NNNNNNN whereas the SSN format is NNN-NN-NNNN.
Other than that, a very nice piece of work.
Cheers,
Tom Archer
Inside C#, Extending MFC Applications with the .NET Framework
It's better to listen to others than to speak, because I already know what I'm going to say anyway. - friend of Jörgen Sigvardsson
|
|
|
|
 |
|
 |
Correct. Thanks.
Peace!
-=- James (Sonork:100.21837)
[Tip for SUV winter driving survival: "Professional Driver on Closed Course" does not mean "your Dumb Ass on a Public Road"!] [Get Check Favorites 1.6 Now!]
|
|
|
|
 |
|
 |
The release program file seems to work just fine, but when I try to compile the project I get the following errors:
c:\Documents and Settings\Jocke\My Documents\Visual Studio Projects\FocusEditDemo\FocusEditCtrl.cpp(179): error C2065: 'afxEmptyString' : undeclared identifier
c:\Documents and Settings\Jocke\My Documents\Visual Studio Projects\FocusEditDemo\FocusEditDemo.cpp(51): warning C4996: 'CWinApp::Enable3dControls' was declared deprecated
c:\Documents and Settings\Jocke\My Documents\Visual Studio Projects\FocusEditDemo\FocusEditCtrl.cpp(179): error C2440: '=' : cannot convert from ''unknown-type'' to 'CString'
c:\Documents and Settings\Jocke\My Documents\Visual Studio Projects\FocusEditDemo\FocusEditCtrl.cpp(179): error C2593: 'operator =' is ambiguous
c:\Documents and Settings\Jocke\My Documents\Visual Studio Projects\FocusEditDemo\FocusEditCtrl.cpp(201): error C2440: '=' : cannot convert from ''unknown-type'' to 'CString'
c:\Documents and Settings\Jocke\My Documents\Visual Studio Projects\FocusEditDemo\FocusEditCtrl.cpp(201): error C2593: 'operator =' is ambiguous
/Joachim
|
|
|
|
 |
|
 |
As shown at the top of the article, this article and its code are targeted to VC5 and VC6, not to VC.Net. And I bet you are trying to build it with VC.Net, because VC.Net has a redesigned/rewritten CString/CStringT/CSimpleStringT implementation. This new CString implementation does not use afxEmptyString as the shared reference for an empty string, hence the errors.
You should be able to make the code work by replacing afxEmptyString with _T(""), or by replacing the entire assignment statement with a call to CString::Empty() (which is really CSimpleStringT::Empty()).
Peace!
-=- James (Sonork:100.21837)
[Tip for SUV winter driving survival: "Professional Driver on Closed Course" does not mean "your Dumb Ass on a Public Road"!] [Get Check Favorites 1.5 Now!]
|
|
|
|
 |
|
 |
Hi!
Launch demo project, copy "qwerty" to clipboard, try pasting it to Tax Id field. Ooops ?
|
|
|
|
 |
|
 |
Explain the problem... "ooops" does not explain the possible issue.
-=- James (Sonork:100.21837)
[Tip for SUV winter driving survival: "Professional Driver on Closed Course" does not mean "your Dumb Ass on a Public Road"!] [Get Check Favorites 1.5 Now!]
|
|
|
|
 |
|
 |
The application gets into infinite loop in CFocusEditCtrl::StripFilteredChars
|
|
|
|
 |
|
 |
Fix for the StripFilteredChars function... The memmove was not moving the NULL caracter at the end of the string void CFocusEditCtrl::StripFilteredChars( LPTSTR cpBuffer ) { int iChars = ::_tcslen( cpBuffer ); int iSizeofChar = sizeof( TCHAR ); if( ( m_bIncludeMask ) && // If Using An Include Mask ( !m_sIncludeCharMask.IsEmpty() ) ) // And Including Certain Characters { TCHAR *pWhere = NULL; pWhere = ::_tcsspnp( cpBuffer, m_sIncludeCharMask );// Look For Characters Not In Include Mask while( pWhere ) // While "Bad" Characters Found { int iLeft = ( ( ( iChars - 1 ) * iSizeofChar ) - ( pWhere - cpBuffer ) ); // Calculate The Amount Of Memory To Move ::memmove( pWhere, ( pWhere + 1 ), iLeft + 1); // Shift Memory Over pWhere = ::_tcsspnp( cpBuffer, m_sIncludeCharMask ); // Look For Characters Not In Include Mask } } else if( ( m_bExcludeMask ) && // If Using An Exclude Mask ( !m_sExcludeCharMask.IsEmpty() ) ) // And Excluding Certain Characters { TCHAR *pWhere = NULL; pWhere = ::_tcspbrk( cpBuffer, m_sExcludeCharMask );// Look For A "Bad" Character while( pWhere ) // While "Bad" Characters Found { int iLeft = ( ( ( iChars - 1 ) * iSizeofChar ) - ( pWhere - cpBuffer ) ); // Calculate The Amount Of Memory To Move ::memmove( pWhere, ( pWhere + 1 ), iLeft + 1); // Shift Memory Over pWhere = ::_tcspbrk( cpBuffer, m_sExcludeCharMask ); // Find Next "Bad" Character } } return; // Done! }
|
|
|
|
 |
|
 |
The control allows to paste when its status is disabled or readonly.
|
|
|
|
 |
|
 |
> The control allows to paste when its status is disabled or readonly.
Yep. I do not get the paste operation caught in PreTranslateMessage when the control is read-only(!).
I have added a AllowPaste(...) function that determines if a Paste (or a file drop) operation can be allowed.
The new archives will be uploaded shortly...
BTW: You can now demo the file dropping ability by dropping a file onto the first edit control.
Peace!
-=- James.
|
|
|
|
 |
|
 |
Try adding this
if(GetStyle() & ES_READONLY)
{
return( Default() ); // Do Default Behaviour
}
at the very beginning of the function
CFocusEditCtrl::OnPaste( WPARAM, LPARAM )
|
|
|
|
 |
|
 |
The project file appears to be missing from the demo app.
|
|
|
|
 |
|
 |
The demo app has been updated with a new project file.
cheers
Chri
|
|
|
|
 |
|
|
 |