|
Hi everybody,
in my application i have a GridCtrl on a View.
If the Grid has the focus and i hit a Key, the OnKeyDown Event of the GridCtrl responses.
All nice ...
But if i hit the Escape Key, this stroke will not be catched in the GridCtrl.
Also the F6-Key.
Is there a special thing that i don't know?
Big thanks
|
|
|
|
|
In a text box. you need to override the OnGetDlgCode function as shown to get all keys.
UINT CEdit_Numeric::OnGetDlgCode()
{
return( CEdit::OnGetDlgCode() | DLGC_WANTALLKEYS );
}
Then you can get the keys with
void CEdit_Numeric::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
switch(nChar)
{
case VK_RETURN:
.................
}
CEdit::OnChar(nChar, nRepCnt, nFlags);
}
maybe its the same with a grid control
|
|
|
|
|
Big thanks !
It resolves the problem behind this problem LOL
|
|
|
|
|
Hi,
I am doing some GUI dialogs in MFC. The problem goes like this:
I have a parent dialog which can create a modeless child "keyboard" dialog,with some special prescribed keys. The user is suppose to click on keys on the "keyboard" dialog and the input is suppose to appear on an Edit box on the parent dialog. The issue is that I want the user to have the freedom of using both the physical keyboard and the "Keyboard" dialog. So, I tried to use SetFocus() onto the Parent's Edit box after hitting keys on the "Keyboard" dialog.
The problem is that the after SetFocus() is issued, the blinking text cursor is always at the beginng left end of the Edit box regardless of whether there is any text in the edit box. This poses a problem when the user changes to using the physical keyboard since text will be input at the beginning of the current text rather than from the end of the text in the Edit box.
So my question is how do I set the position of the blinking text cursor to the end of the text after SetFocus()? Thanks alot!
|
|
|
|
|
What about CWnd::SetCaretPos ?
|
|
|
|
|
That may cause a visual indication, but the underlying edit control will maintain its last insertion point.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> 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! See DeleteFXPFiles
|
|
|
|
|
Thanks for the sugestion. At least I now know that blinking cursor is called a caret.
|
|
|
|
|
You could do this:
CEdit *pEdit = static_cast<CEdit *>( GetDlgItem( IDC_THE_EDIT_BOX ) );
int iLength = pEdit->GetWindowTextLength();
pEdit->SetSel( iLength, iLength );
|
|
|
|
|
This is indeed a great method! works nice n sweet. Thanks.
|
|
|
|
|
The SetSel(...) solution is the best, IMHO, although I question the habit of casting the return of CWnd::GetDlgItem(...) unless you really know what you are doing...
You should investigate the MA_NOACTIVATE return value from processing the WM_MOUSEACTIVATE message. I believe that is how you can get an on-screen keyboard to not cause kill focus events to be sent to another window when it is is being used. You may have to rely on mouse position as opposed to button click events if you do this.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> 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! See DeleteFXPFiles
|
|
|
|
|
Thanks for your input. the SetSel method has worked well for me. Dint investigate the WM_MOUSEACTIVATE method as using mouse position may complicated matters for me. anyway, thanks!;)
|
|
|
|
|
Hi All,
I have a little doubt about templates, and no compiler to test this.
Is it possible to have a template member function in a class that is not template, or even a global template function ??
i'm puzzling as i just thought to this...
thanks for your answers guyz
|
|
|
|
|
yes
never say die
|
|
|
|
|
that's a very pragmatic answer, but thanks ! lol
|
|
|
|
|
toxcct wrote: Don't know where to start ?
Refer the Forums Guidelines and ask a friend
(Couldn't resist...)
The answer to your question is 'yes' and Google-ing for "template function" generated these[^] results where the first result screen contains links for code examples of at least template functions that are not class members.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
|
|
|
|
|
Roger Stoltz wrote: (Couldn't resist...)
shame on me ! lol
actually, i asked here because i know that Valuable programmers are here, and will be able to explain things easily.
|
|
|
|
|
toxcct wrote: even a global template function
If I got you right you can have global template functions.
|
|
|
|
|
Dear All,
My problem is that I am sending huge bytes (77 KB) to remote host. But my program sends only 74 KB. How do i resolve this?.
Kindly help me.
Thanks.
|
|
|
|
|
Try sending 80KB. Then it should send 77KB
Just kidding.
How do you know how many bytes are being sent?
Mark
|
|
|
|
|
Do not know if this will work, but you could try looping until all bytes have been sent
Something like:
do
{
bytes = send(......);
} while(bytes < NUMBER_OF_BYTES_TO_SEND);
|
|
|
|
|
How can I include version information in the compiled executable file?
|
|
|
|
|
see the Version component in the resource tab
|
|
|
|
|
I am using VS.NET 2005 to build a Windows Form Application (not MFC). I found a ACL editor program from codeproject.com which I want to incorporate in my application. It has two dll files, FilePermsBox.dll and FilePermsBox.Interop.dll
In section "16. FilePermsBox API" of the article http://www.codeproject.com/win32/accessctrl4.asp, it was mention that the author has rewritten wrappers to allow the program to be called using OLE automation.
I have little knowledge on OLE automation and hence I just tried adding FilePermsBox.Interop.dll as references. This allow me to compile the following code.
array<string^>^ fCollection = gcnew array<string^, 1="">{"C:\test.txt"};
ManagedSecurityBoxWrapper::IManagedSecurityBoxWrapper^ sb = gcnew ManagedSecurityBoxWrapper::ManagedSecurityBoxWrapper();
sb->FileNames = fCollection;
sb->COSecurityBox1(false);
However during runtime I will encounter the following error when ManagedSecurityBoxWrapper constructor is invoked.
An unhandled exception of type 'System.TypeInitializationException' occurred in System.Windows.Forms.dll
Additional information: The type initializer for '<module>' threw an exception.
Is there anything else I need to add in project properties to use it or can someone enlighten me on how to use OLE automation to call this API. I will be more than grateful if someone is willing to download the dlls from codeproject.com under the link
http://www.codeproject.com/win32/accessctrl4/filepermsbox111.zip[^]
and try it out, letting me know whether this is even possible. Thanks a million!
|
|
|
|
|
Hi guys, i am totally new to C programming and i just came over a simple problem which i couldn't solve because i'm not have basic in programming but love to learn it.
this is what surrounded me...
1) A sequence of number, e.g 1120060002600000000790123904122006 (34 digits)
2) i need to view just certain slots of digit from 7th-12th as a record
3) Then from 13th-26th as a values. This getting worse when it come miscounted the numbers.
4) do anyone know how to solve this and kindly can come up with simple code which could read the input and just display the outputs in slots of digits.
5) i am sick of this things.
love it but hardly to own it
-- modified at 4:06 Thursday 18th January, 2007
|
|
|
|
|
chks wrote: 1) A sequence of number,
2) i need to view just certain slots of digit from 7th-12th as a record
3) Then from 13th-26th as a values. This getting worse when it come miscounted the numbers
What is a record (in this context)?
What are values (if not numbers)?
How could you possibly find out if the numbers are miscounted?
If you could find out, could you do anything about it other than rejecting the whole string?
Do you really have to use C, or could you use C++? Or a .NET-Language?
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|