PDA

View Full Version : At once have two instance of ITextCtl


bkhe1
06-18-2002, 11:55 PM
How is it possible to have two instance of ITextCtl at the same time.
Eg. have a username text Field and password text field


//username textfield
ISHELL_CreateInstance(pMe->a.m_pIShell,AEECLSID_SOFTKEYCTL,(void **)&pMe->m_PIMenu);
if(pMe->m_pIText != NULL)
{
STR_TO_WSTR("Username",szBuf,sizeof(szBuf));
ITEXTCTL_SetTitle(pMe->m_pIText,NULL,NULL,szBuf);
ITEXTCTL_SetMaxSize(pMe->m_pIText,100);
ITEXTCTL_SetProperties(pMe->m_pIText,TP_FRAME | TP_RAPID_MODE);
ITEXTCTL_SetRect(pMe->m_pIText,&rect);

STR_TO_WSTR("dzf",szBuf,sizeof(szBuf));
ITEXTCTL_SetText(pMe->m_pIText,szBuf,sizeof(szBuf));
ITEXTCTL_SetActive(pMe->m_pIText,TRUE);
}


//password textfield
pMe->m_pIText2= NULL;
SETAEERECT(&rect2,5,80,100,200);
ISHELL_CreateInstance(pMe->a.m_pIShell,AEECLSID_TEXTCTL,(void **)&pMe->m_pIText2);
if(pMe->m_pIText2 != NULL)
{
STR_TO_WSTR("Password",szBuf2,sizeof(szBuf2));
ITEXTCTL_SetTitle(pMe->m_pIText2,NULL,NULL,szBuf2);
ITEXTCTL_SetMaxSize(pMe->m_pIText2,100);
ITEXTCTL_SetProperties(pMe->m_pIText2,TP_FRAME);
ITEXTCTL_SetRect(pMe->m_pIText2,&rect2);

STR_TO_WSTR("",szBuf2,sizeof(szBuf2));
ITEXTCTL_SetText(pMe->m_pIText2,szBuf2,sizeof(szBuf2));
ITEXTCTL_SetActive(pMe->m_pIText2,TRUE);

}


For some reason only the password text field loads up.

any suggestions welcomed

cheers,
Bhavna

arunbangari
06-19-2002, 06:21 AM
Hi,
We also faced similar problems with ITEXTCTL interface. I observed in your code, you are not using ITEXTCTL_Redraw. Iam not sure whether you have used it for both the TEXT CONTROLS. Before you call IDISPLAY_Upadate, call above API.

One more thing you can try is drawing a rectangle over the text control using IDISPLAY_DrawRect or SETAEERECT so that it will appear as a text box present over there.

Regards
Arun Bangari

bkhe1
06-19-2002, 10:19 PM
For some reason it does seems to display the two TextField at the same time

case EVT_APP_START:
SETAEERECT(&rect,5,30,100,200);
IDISPLAY_ClearScreen(pMe->a.m_pIDisplay);
IDISPLAY_DrawRect(pMe->a.m_pIDisplay,&rect,RGB_BLACK,RGB_WHITE,IDF_RECT_FRAME);

ISHELL_CreateInstance(pMe->a.m_pIShell,AEECLSID_TEXTCTL,(void **)&pMe->m_pIText);
if(pMe->m_pIText != NULL)
{
STR_TO_WSTR("Username",szBuf,sizeof(szBuf));
ITEXTCTL_SetTitle(pMe->m_pIText,NULL,NULL,szBuf);
ITEXTCTL_SetMaxSize(pMe->m_pIText,100);
ITEXTCTL_SetProperties(pMe->m_pIText,TP_FRAME | TP_RAPID_MODE);
ITEXTCTL_SetRect(pMe->m_pIText,&rect);

STR_TO_WSTR("dzf",szBuf,sizeof(szBuf));
ITEXTCTL_SetText(pMe->m_pIText,szBuf,sizeof(szBuf));
ITEXTCTL_SetActive(pMe->m_pIText,TRUE);
}
IDISPLAY_Update(pMe->a.m_pIDisplay);

//Setup Password TextBox
SETAEERECT(&rect,5,80,100,200);

IDISPLAY_DrawRect(pMe->a.m_pIDisplay,&rect2,RGB_BLACK,RGB_WHITE,IDF_RECT_FRAME);
IDISPLAY_Update(pMe->a.m_pIDisplay);
ISHELL_CreateInstance(pMe->a.m_pIShell,AEECLSID_TEXTCTL,(void **)&pMe->m_pIText2);
if(pMe->m_pIText2 != NULL)
{
STR_TO_WSTR("Password",szBuf2,sizeof(szBuf2));
ITEXTCTL_SetTitle(pMe->m_pIText2,NULL,NULL,szBuf2);
ITEXTCTL_SetMaxSize(pMe->m_pIText2,100);
ITEXTCTL_SetProperties(pMe->m_pIText2,TP_FRAME);
ITEXTCTL_SetRect(pMe->m_pIText2,&rect);

STR_TO_WSTR("",szBuf2,sizeof(szBuf2));
ITEXTCTL_SetText(pMe->m_pIText2,szBuf2,sizeof(szBuf2));

}

return (TRUE);


case EVT_KEY:

switch((AVKType) wParam)
{
case AVK_DOWN:
ITEXTCTL_SetActive(pMe->m_pIText2,TRUE);
break;
case AVK_UP:
ITEXTCTL_SetActive(pMe->m_pIText,TRUE);
break;
if((pMe->m_pIText != NULL) && (ITEXTCTL_IsActive(pMe->m_pIText)) )

{
ITEXTCTL_HandleEvent(pMe->m_pIText,EVT_KEY,wParam,dwParam);
// if((pMe->m_pIText2 != NULL) && ITEXTCTL_HandleEvent(pMe->m_pIText2,EVT_KEY,wParam,dwParam))
return TRUE;
}

if((pMe->m_pIText2 != NULL) && ITEXTCTL_HandleEvent(pMe->m_pIText2,EVT_KEY,wParam,dwParam))
{
// if((pMe->m_pIText2 != NULL) && ITEXTCTL_HandleEvent(pMe->m_pIText2,EVT_KEY,wParam,dwParam))
return TRUE;
}

arunbangari
06-20-2002, 12:27 AM
Hi,
Iam still not sure, whether ur using ITEXTCTL_Redraw. I could not find that in your piece of code.Iam attaching modified code. Please check my comments. Also, ur calling IDISLAY_Update many times, which is not required, can be called only once everything is redrawn.

Regarding event handling, initially set the second text control inactive. Whenever u press down key make second text box active and fisrst one inactive. Similarly for up event(when second text box is active and first one inactive) do the reverse of above said mathod. In your code you are not making other text box inactive.

Regards
Arun Bangari..