Home > Archive > Smartphone Developer Forum > April 2006 > EM_SETINPUTMODE doesn't work
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
EM_SETINPUTMODE doesn't work
|
|
|
| I am trying to change the input mode for an edit control to be numeric.
So in my initdialog code, I send the EM_SETINPUTMODE message to the
edit control, but the SendMessage returns 0 and the input mode doesn't
change. Also, GetLastError() returns 0. What am I doing wrong, can
anyone help?
....in OnInitDialog method...
.... other init stuff...
m_cwndEdit = GetDlgItem(IDC_PHONE);
if (0 == m_cwndEdit.SendMessage(EM_SETINPUTMODE, 0, EIM_NUMBERS))
{
...debug spew GetLastError()...
}
More information: this is just a portion extracted from working code.
m_cwndEdit is valid, and a SetWindowText() on it works perfectly. I've
also tried the Edit_SetInputMode macro with identical results.
I'm wondering if any other API's or controls interfere with the
operation...for instance, if there are other controls that have the
focus, does this message need to be sent to this control every time it
gets the focus? Is the control supposed to get this message or the
parent (dialog) window? Should there be any particular style bits set
for the control or the dialog? Currently I have ES_AUTOHSCROLL and
ES_NUMBER set on the EDITTEXT control.
PS this code is running on a WM5 SP device.
Any help would be appreciated!
J
| |
| dsr2008 2006-04-12, 8:05 am |
| see: http://www.smartphonedn.com/qa/ime_enable.html
"J144" wrote:
> I am trying to change the input mode for an edit control to be numeric.
> So in my initdialog code, I send the EM_SETINPUTMODE message to the
> edit control, but the SendMessage returns 0 and the input mode doesn't
> change. Also, GetLastError() returns 0. What am I doing wrong, can
> anyone help?
>
> ....in OnInitDialog method...
> .... other init stuff...
>
> m_cwndEdit = GetDlgItem(IDC_PHONE);
>
> if (0 == m_cwndEdit.SendMessage(EM_SETINPUTMODE, 0, EIM_NUMBERS))
> {
> ...debug spew GetLastError()...
> }
>
> More information: this is just a portion extracted from working code.
> m_cwndEdit is valid, and a SetWindowText() on it works perfectly. I've
> also tried the Edit_SetInputMode macro with identical results.
>
> I'm wondering if any other API's or controls interfere with the
> operation...for instance, if there are other controls that have the
> focus, does this message need to be sent to this control every time it
> gets the focus? Is the control supposed to get this message or the
> parent (dialog) window? Should there be any particular style bits set
> for the control or the dialog? Currently I have ES_AUTOHSCROLL and
> ES_NUMBER set on the EDITTEXT control.
>
> PS this code is running on a WM5 SP device.
>
> Any help would be appreciated!
>
> J
>
| |
|
| Thank you for your response, but that link doesn't appear to be related
to my question. Let me try to explain my problem better:
I'm asking about switching the SP's physical keyboard into numeric mode
instead of alpha mode. The SP device I am using has a QWERTY keyboard.
The input mode is indicated in the right hand side of the title bar.
Alpha mode is represented by an underlined "abc" in that area. Press
the function key once, the indicator changes to "Alt" which will allow
numeric input for a single keypress, then revert to alpha mode.
Pressing the function key twice changes to "ALT" which will allow
numeric input until you press the function key again.
When focus gets to my edit control, I want to set the input mode
automatically to the "ALT" mode so that the user can just start entering
numbers without first having to press the function key. I thought
EM_SETINPUTMODE (or Edit_SetInputMode) should do it but it's not working.
Can anyone help?
Jeff
dsr2008 wrote:[color=darkred]
> see: http://www.smartphonedn.com/qa/ime_enable.html
>
> "J144" wrote:
>
>
| |
| Patrick Derks [MS] 2006-04-18, 7:08 pm |
| You cannot set the input mode for a ES_NUMBER edit control.
--
Patrick Derks
This posting is provided "AS IS" with no warranties, and confers no rights.
"J144" <nospam@nospam.com> wrote in message
news:uyGYHROWGHA.3332@TK2MSFTNGP02.phx.gbl...
>I am trying to change the input mode for an edit control to be numeric.
> So in my initdialog code, I send the EM_SETINPUTMODE message to the
> edit control, but the SendMessage returns 0 and the input mode doesn't
> change. Also, GetLastError() returns 0. What am I doing wrong, can
> anyone help?
>
> ...in OnInitDialog method...
> ... other init stuff...
>
> m_cwndEdit = GetDlgItem(IDC_PHONE);
>
> if (0 == m_cwndEdit.SendMessage(EM_SETINPUTMODE, 0, EIM_NUMBERS))
> {
> ...debug spew GetLastError()...
> }
>
> More information: this is just a portion extracted from working code.
> m_cwndEdit is valid, and a SetWindowText() on it works perfectly. I've
> also tried the Edit_SetInputMode macro with identical results.
>
> I'm wondering if any other API's or controls interfere with the
> operation...for instance, if there are other controls that have the
> focus, does this message need to be sent to this control every time it
> gets the focus? Is the control supposed to get this message or the
> parent (dialog) window? Should there be any particular style bits set
> for the control or the dialog? Currently I have ES_AUTOHSCROLL and
> ES_NUMBER set on the EDITTEXT control.
>
> PS this code is running on a WM5 SP device.
>
> Any help would be appreciated!
>
> J
| |
|
| Well thats almost as smart as brain-dead. What's the rationale for that
restriction???
Patrick Derks [MS] wrote:
> You cannot set the input mode for a ES_NUMBER edit control.
>
| |
| Patrick Derks [MS] 2006-04-20, 7:07 pm |
| Ok, a bit more explanation:
The IME should automatically switch to numeric mode (and not allow the input
mode to be changed) when focus is moved to a text edit control with the
ES_NUMBER style set (since thats the point of the ES_NUMBER style, to
restrict input to numbers only). Any attempt to switch the input mode using
EM_SETINPUTMODE will thus be regected. If the IME isn't automatically
switching to numeric mode then thats probably a bug in the IME (you'll need
to contact the vendor that created the IME in this case).
--
Patrick Derks
This posting is provided "AS IS" with no warranties, and confers no rights.
"Patrick Derks [MS]" <patderks@microsoft.com> wrote in message
news:444582dd$1@news.microsoft.com...
> You cannot set the input mode for a ES_NUMBER edit control.
>
> --
> Patrick Derks
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
>
>
> "J144" < > wrote in message
> news:uyGYHROWGHA.3332@TK2MSFTNGP02.phx.gbl...
>
>
| |
|
| That would make sense if it worked. We'll contact the vendor and report
this as a bug.
Thanks for the info!
Patrick Derks [MS] wrote:
> Ok, a bit more explanation:
>
> The IME should automatically switch to numeric mode (and not allow the input
> mode to be changed) when focus is moved to a text edit control with the
> ES_NUMBER style set (since thats the point of the ES_NUMBER style, to
> restrict input to numbers only). Any attempt to switch the input mode using
> EM_SETINPUTMODE will thus be regected. If the IME isn't automatically
> switching to numeric mode then thats probably a bug in the IME (you'll need
> to contact the vendor that created the IME in this case).
>
>
|
|
|
|
|