how to get the content of text control immediately before completed? | developer.brewmp.com how to get the content of text control immediately before completed? | developer.brewmp.com

Developer

how to get the content of text control immediately before completed?

Forums:

Hi all:
i am desiging a interface to search word in vocabulary.On the UI a ITEXT control and a menu were placed.when i enter characters in the text control, i want to display the matching words in menu immediately.For example, the character inputed is 'a', then the menu show:
a
an
adeux
...
And then continue to input 'b', the menu will display as following:
abc
abandon
abstract
....

The key problem is how to get the text of ITEXT immediately before finishing inputing. Is there some way?

do da same way u do it using
ITEXTCTL_GetTextPtr

do da same way u do it using
ITEXTCTL_GetTextPtr

dengll wrote:Hi all:
i am desiging a interface to search word in vocabulary.On the UI a ITEXT control and a menu were placed.when i enter characters in the text control, i want to display the matching words in menu immediately.
The key problem is how to get the text of ITEXT immediately before finishing inputing. Is there some way?
Hi,
As standard implementation suggests; You must be calling ITEXTCTL_HandleEvent
() in your Application's main Event Handler.
For your problem; your will've to use same event after filtering it for the EVT-Key events; and calling ITEXTCTL_GetTextPtr() just after that.
e.g.
//App's main Event handler
boolean HandleEvent()
{
...
...
{
ITEXTCTL_HandleEvent ();
ITEXTCTL_GetTextPtr();/* take the text buffer just after HanleEvt of the TextCtl. and perform neceissary opearation. (in your case you will have to populate MenuCtl object with available Vocabulary Matches...*/
...
...
}
....
....

HOpe this will work!!
SoftEast

dengll wrote:Hi all:
i am desiging a interface to search word in vocabulary.On the UI a ITEXT control and a menu were placed.when i enter characters in the text control, i want to display the matching words in menu immediately.
The key problem is how to get the text of ITEXT immediately before finishing inputing. Is there some way?
Hi,
As standard implementation suggests; You must be calling ITEXTCTL_HandleEvent
() in your Application's main Event Handler.
For your problem; your will've to use same event after filtering it for the EVT-Key events; and calling ITEXTCTL_GetTextPtr() just after that.
e.g.
//App's main Event handler
boolean HandleEvent()
{
...
...
{
ITEXTCTL_HandleEvent ();
ITEXTCTL_GetTextPtr();/* take the text buffer just after HanleEvt of the TextCtl. and perform neceissary opearation. (in your case you will have to populate MenuCtl object with available Vocabulary Matches...*/
...
...
}
....
....

HOpe this will work!!
SoftEast

softeast,thanks for your suggestion! I have tried the way you told me but failed.This time i can't enter any letters into the ITEXT at all, it seems that the ITEXT control don't receive or display the letters . Following are the codes added for test purpose:
case EVT_KEY:
// Add your code here...
if (ITEXTCTL_HandleEvent(pApp->m_pText, eCode, wParam, dwParam))
{
switch(wParam)
{
case AVK_2:
case AVK_3:
case AVK_4:
case AVK_5:
case AVK_6:
case AVK_7:
case AVK_8:
case AVK_9:
pApp->m_pKeyWord = ITEXTCTL_GetTextPtr(pApp->m_pText);
IMENUCTL_AddItem(pApp->m_pMenu, NULL, 0, 0, pApp->m_pKeyWord, 0);
IMENUCTL_Redraw(pApp->m_pMenu);
return TRUE;
}

softeast,thanks for your suggestion! I have tried the way you told me but failed.This time i can't enter any letters into the ITEXT at all, it seems that the ITEXT control don't receive or display the letters . Following are the codes added for test purpose:
case EVT_KEY:
// Add your code here...
if (ITEXTCTL_HandleEvent(pApp->m_pText, eCode, wParam, dwParam))
{
switch(wParam)
{
case AVK_2:
case AVK_3:
case AVK_4:
case AVK_5:
case AVK_6:
case AVK_7:
case AVK_8:
case AVK_9:
pApp->m_pKeyWord = ITEXTCTL_GetTextPtr(pApp->m_pText);
IMENUCTL_AddItem(pApp->m_pMenu, NULL, 0, 0, pApp->m_pKeyWord, 0);
IMENUCTL_Redraw(pApp->m_pMenu);
return TRUE;
}

Thanks,friends. I have worked it out.
Add the above codes at the beginning of the main HandleEvent function.
if (ITEXTCTL_HandleEvent(pApp->m_pText, eCode, wParam, dwParam))
{
switch(wParam)
{
case AVK_2:
case AVK_3:
case AVK_4:
case AVK_5:
case AVK_6:
case AVK_7:
case AVK_8:
case AVK_9:
pApp->m_pKeyWord = ITEXTCTL_GetTextPtr(pApp->m_pText);
IMENUCTL_Reset(pApp->m_pMenu);
IMENUCTL_AddItem(pApp->m_pMenu, NULL, 0, 0, pApp->m_pKeyWord, 0);
IMENUCTL_Redraw(pApp->m_pMenu);
break;
}
return TRUE;
}

Thanks,friends. I have worked it out.
Add the above codes at the beginning of the main HandleEvent function.
if (ITEXTCTL_HandleEvent(pApp->m_pText, eCode, wParam, dwParam))
{
switch(wParam)
{
case AVK_2:
case AVK_3:
case AVK_4:
case AVK_5:
case AVK_6:
case AVK_7:
case AVK_8:
case AVK_9:
pApp->m_pKeyWord = ITEXTCTL_GetTextPtr(pApp->m_pText);
IMENUCTL_Reset(pApp->m_pMenu);
IMENUCTL_AddItem(pApp->m_pMenu, NULL, 0, 0, pApp->m_pKeyWord, 0);
IMENUCTL_Redraw(pApp->m_pMenu);
break;
}
return TRUE;
}