|
 |
|
|
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.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
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!)
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
 | CEdit |  | Amorevieta | 4: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
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
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!)
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
hi.. can anybody plz tell me how do i set focus back to the edit box after clearing its contents..?
thanx in advance.. pallavi
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
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
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
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
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
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
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
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!]
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
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
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
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!]
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
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!]
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
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! }
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
> 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.
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
|
Try adding this
if(GetStyle() & ES_READONLY) { return( Default() ); // Do Default Behaviour }
at the very beginning of the function CFocusEditCtrl::OnPaste( WPARAM, LPARAM )
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
The project file appears to be missing from the demo app.
| | | |