|
Thanks for the suggestion.
|
|
|
|
|
Can someone please point me to the source of info on how to control Edit box cursor?
Function SetDlgItemText(....) sets the text fine but moves the cursor to the beginning of the text. I need the cursor at the end of the set string.
Also would like to be able to erase/delete all current text using ESC or Delete keys only. The "default" Enter key is "routed" to default button. How to I intercept this message?
Thanks for your help.
Vaclav
|
|
|
|
|
Vaclav_Sal wrote: I need the cursor at the end of the set string.
HWND hwndDlg;
HWND hwndEdit = ::GetDlgItem(hwndDlg, IDC_EDIT1);
const TCHAR *szText = _T("Edit Box String");
int nSelPos = _tcslen(szText);
::SetWindowText(hwndEdit, szText);
::SendMessage(hwndDlg, WM_NEXTDLGCTL, (WPARAM)hwndEdit, TRUE);
::SendMessage(hwndEdit, EM_SETSEL , (WPARAM)nSelPos, (LPARAM)nSelPos);
::SendMessage(hwndEdit, (UINT) EM_SCROLLCARET, (WPARAM) 0, (LPARAM) 0);
modified on Friday, May 23, 2008 12:08 PM
|
|
|
|
|
Thank you, works almost as advertised!
Looks like a typo "(WPARAM)m_wndEdit.m_hWnd,", but I already have a focus so I did not need to send this message anyway.
I would have a tough time figuring this out myself, you are very helpful. Thanks again.
Vaclav
|
|
|
|
|
Vaclav_Sal wrote: Looks like a typo "(WPARAM)m_wndEdit.m_hWnd,
yes, i just coded this for MFC, and I assume you were not using MFC, i mapped to win32 soon, Corrected now.
|
|
|
|
|
Rajkumar,
No problem, I did modify your code and it does what I wanted to do.
There is a minor bug in it - after the cursor is moved I can no longer backspace in the Edit box. I'll try to figure out how to do that.
Thanks for your input.
Cheers Vaclav
|
|
|
|
|
what happens when backspace is pressed, what if other keys pressed, i can able to backspace and delete the characters, how do you setfocus, and where you are sending those messages.
|
|
|
|
|
The problem is not with the text / cursor insertion. I have another problem with my program.
When I insert the text and cursor (result of SQL search)and than attempt to do backspace my application continues to do SQL lookups on the inserted text in the list box and gets "out of control" causing it to reinsert the last text.
I'll need to work on that. I'll let you know after I fix it.
Vaclav
|
|
|
|
|
Can any body tell me how to convert UPPER case string to lower case string in Unicode.
|
|
|
|
|
|
sumit.durg wrote: Can any body tell me how to convert UPPER case string to lower case string in Unicode.
CString has the MakeUpper() and MakeLower() functions, but you need to understand that upper case and lower case exists only in English (and may be in those languages that uses English script). It is not a very good idea to make this call on a language like Hindi. I believe you understand it.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
For other languages, could be it done just adding or decreasing the "letter value" by 34 (or whatever value that gives "A" - "a")?
Missunderstood of previous answer
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?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
and what about the language which havent uppercase and lowercase?
|
|
|
|
|
I am talking about those languages which has no UPPER or lower cases. It just would not mean anything do a conversion in that case. I also mentioned "Hindi", in my previous post, as an example.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Sorry, I missunderstood you
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?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
No worries.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Exactly, Some language do not have upper and lower case.They have only one type as you said in hindi.
I agree. But i need to convert Russian language. They have upper and lower case and MakeLower / _tcslwr in not working on russian. Do you have any other solution.
|
|
|
|
|
Yes, I tested with CString::MakeLower() and it isn't working! Fortunately for you, it shouldn't be a daunting task to write your own mapping routine, because there are not too many characters in Russian language. Imagine writing a conversion routine for something like Chinese, if it had UPPER/lower cases!
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
|
Hi..
Use _tcsicmp
Hi..
I am Mnaju.I have Completed my B.E Computers Science.Lokking for a job.I am interested in VC++
manju
|
|
|
|
|
why bothering cast back to TCHAR*, uppercase, then cast back to CString, when the CString class already provides a method to do it ?
moreover, _tcsicmp() doesn't perform a "toUpper" or a "toLower". it just compare 2 strings without taking care of the case.
|
|
|
|
|
manju#123 wrote: Use _tcsicmp
_tcsicmp does a lexicographic comparison between strings. It cannot convert between upper and lower cases. In short, it does some kind of comparison and the OP's requirement is to do some kind of conversion.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Hi All,
Is there any API which I could use to save & load the some entries in the registry in the kernel mode. I require kernel mode as I want to do this at the boot time before the Explorer shell gets launched.
Thank you,
AJ
|
|
|
|
|
Hi,
Does any one have a good idea of exporting MAKE file through Visual Studio 2003??
I use to export MAKE files through Visual Studio 6.0 but now we dont have that option available in 2003.
Please tell me if any other way of exporting the file in VS 2003.
Thanks,
Anand.
|
|
|
|
|
Do you really need it? why?
|
|
|
|