Brew GUI Interview question and answers

Brew GUI Interview question and answers
1.What image formats are supported in BREW?
BREW supports any BMP file with a color depth up to that which is provided on the device it is running on. BREW does not yet support GIF and JPEG images. For now, you need to convert GIF and JPEG images into BMP images. PNG format and BREW Compressed Image (BCI) format will be supported in BREW SDK version 1.1.
In SDK versions prior to 1.1, the emulator is capable of emulating only 1, 4, and 8 bit color depth BMPs. In version 1.1, the emulator can also display 2 bit color depth BMPs.
2.What is the transparent color on color and monochrome phones?
Magenta is the transparent color for color devices. White is the transparent color on monochrome and 4-level gray-scale devices.
3.How can we move the cursor to the end of the text input?
The cursor can be moved to the end of the string by continuously invoking ITEXTCTL_HandleEvent() method n times on the string, where n is the length of the string.
For example:
while(len) {
ITEXTCTL_HandleEvent(pMe->m_pIText, EVT_KEY,
AVK_RIGHT, dwParam);
len--;
}
Note: This does not currently work on the Kyocera 3035, unless dwParam is set to 10 (corresponds to AVK_RIGHT). Kyocera is working on fixing this issue such that dwParam will not need to be explicitly set. Setting dwParam = 10 will not have any adverse affect on the Sharp Z-800 handset.
A new API - ITEXTCTL_SetCursorPos(), will be added in BREW SDK version 1.2 to set the Text Control's cursor position.
4.How can we create a text control with horizontal and vertical scrollbars?
If the text is larger than the Text Control size, then a vertical or horizontal scrollbar will appear and you can navigate through the text using the directional keys.
5.Why do we get memory errors such as "memheap.c 0696" when using IDISPLAY_BitBlt() to draw a bitmap image?
Ensure that you are freeing the memory allocated by CONVERTBMP. Check the last Boolean parameter of CONVERTBMP. If True, a reallocation was done and the memory must be freed using SYSFREE.
For example:
pBmp = CONVERTBMP (pDataBytes, &imageInfo, &bVal);
IDISPLAY_BitBlt (pIDisplay, xDest, yDest, cxDest,
cyDest, pBmp, xSrc, ySrc, dwRopCode);
IDISPLAY_Update (pIDisplay);
if(bVal) //free only if realloc was done
SYSFREE (pBmp);
6.How can we suppress the title area from showing on my IStatic?
The title area cannot currently be suppressed in SDK version 1.0. This has been added in BREW version 1.1.
7.How can we determine the character limit for the display of application names on the phone?
Different phones have different display characteristics, so there is no unique answer to this question. You can determine whether your application name will fit on the phone's display by comparing the width of the application name to the width of the display.
Use IDISPLAY_MeasureText() to determine the pixel width of your application name string. Use ISHELL_GetDeviceInfo() to determine the pixel width of the screen
8.Does BREW support animation?
BREW SDK version 1.0 includes support for animated BMP. This is done by placing the frames side-by-side and specifying the width of each frame with IIMAGE_SetParm with the IPARM-CXFRAME flag. Please see the IIMAGE example in the Examples directory
BREW SDK Version 1.1 has added support for BREW Compressed Image (BCI) animation. A BCI file contains one or more compressed small graphic image(s), each with a specified duration in milliseconds. The duration represents how long you want each image to be shown before it is replaced by the next image in the series. You can use the BCI Authoring Tool included in BREW SDK Version 1.1 to create your BCI file. Please refer to 'Using the BREW Compressed Image Authoring Tool' document included in the SDK for more information.
9.How can we control animation by time?
One way to do this is to use the IImage interface and set the rate of animation (IImage_SetParm). An example in which the animation rate is set to 750ms is shown below:
IIMAGE_SetParm(pMe->m_pIImage, IPARM_RATE, 750, 0);
You can also use a timer to trigger the image display function. Use ISHELL_SetTimer() to set a timer:
ISHELL_SetTimer(pMe->a.m_pIShell, TIMER_RATE,
(PFNNOTIFY)(ManipulateBitmap), pMe);
After TIMER_RATE ms expires, ManipulateBitmap function will be triggered, within which you can manipulate your image.
10.What is the difference between Multi-tap and T9 text entry modes for text input?
In Multi-tap mode, a key must be tapped several times in order to specify a letter. For example, to specify the letter 'r', tap the number '7' three times. In T9 mode, a key is tapped only once per letter. T9 Text Input determines the most commonly used word matching the input numeric sequence. If more than once word matches the sequence, the most common word is selected, with the ability to scroll to the next most commonly used word.
The default text entry mode is Multi-tap. T9 text entry mode is not supported on the emulator.
11.How can we draw a line in a specific color?
IDISPLAY_DrawHLine() and IDISPLAY_DrawVLine() always draw lines in black. Therefore setting CLR_USER_LINE to the desired color and then invoking IDISPLAY_DrawHLine() or IDISPLAY_DrawVLine() will not work.
The definitions of these two IDISPLAY macros are below. To draw a line in a color other than black, use the code contained in the macro definition and change to the desired fill color.
1)define IDISPLAY_DrawHLine(p,x,y,len) \
{AEERect rc;SETAEERECT(&rc,(x),(y),(len),1); IDISPLAY_FillRect((p),&rc,
RGB_BLACK);}
2)define IDISPLAY_DrawVLine(p,x,y,len) \
{AEERect rc;SETAEERECT(&rc,(x),(y),1,(len)); IDISPLAY_FillRect((p),&rc,
RGB_BLACK);}
12.How can we create a dialog?
1. Use the BREW Resource Editor to create a dialog. You can also construct the dialog manually by creating data structures in your application to define the contents of the dialog.
Note: If a bmp file is being used, make sure that the bmp format is supported and that the bmp file is a valid full path, all in lowercase.
2. Once the dialog has been created, it will have a resource ID and a resource file (.bar file). Use ISHELL_CreateDialog() to create the dialog:
ISHELL_CreateDialog(pMe->a.pIShell, SAMPLEAPP_RES_FILE,
RESOURCE_ID, NULL);
// SAMPLEAPP_RES_FILE is the resource file (.bar file) and
// RESOURCE_ID is the resource ID specified in the resource
// editor
3. Process the following events (return TRUE at the very least) in the app handler function:
case EVT_DIALOG_START:
return TRUE;
case EVT_DIALOG_INIT:
return TRUE;
case EVT_DIALOG_END:
return TRUE;
4. Call ISHELL_EndDialog when the dialog object is no longer needed.
ISHELL_EndDialog(pMe->a.pIShell);
13.How can we create a scroll bar if menu is larger than the screen size?
The screen rectangle in which the menu is to be drawn (specified by IMENUCTL_SetRect) must exceed the screen height by at least the height of a single menu item. Otherwise the menu item will be clipped and no scroll bar will appear.
14.How cancwe add images to the items in an IMENUCTL?
We can use the IMENUCTL_AddItemEx method with CtlAddItem structure.
15.Can we remove the multitap item from the softkey menu associated with my text control?
Yes, We can remove it by following the steps outlined below:
1. Associate the soft key menu with your text control using ITEXTCTL_SetSoftKey().
2. Call IMENUCTL_DeleteAll() to delete the Multitap item.
3. Add items using IMENUCTL_AddItem().
16.Is it possible to get/manipulate the palette information of the device?
No. The palettes are hard-coded by the vendor and will vary from device to device.
17.Can we modify the display buffers directly?
No. There is no way for BREW to access these and the display data is stored as the vendor's proprietary format.
18.How do we allow the input of symbols in my text control?
Certain limited symbol entry is available by pressing a certain key (usually 1) multiple times. This set of symbols is OEM dependent. On the Kyocera 3035, the following symbols are available by pressing the '1' key multiple times: .&@,-':;?/"(). On the Sharp Z- 800, the following symbols are available by pressing the 1 key multiple times: .,@:!?/.
To allow a greater breadth of symbol entry in your text control, you must associate your text control to a soft key menu using ITEXTCTL_SetSoftKeyMenu(). The set of symbols available using this method are:
-.&'()_!?*#%":+<>=¿¡""/\@,~{}$[]^;.
ITEXTCTL_SetSoftKeyMenu() adds an item to the Soft Key menu that allows the user to change the text entry mode (the text string for this item is the currently selected mode - for example, MultiTap). When it receives this command, the text control displays a menu allowing the user to select the new text entry mode. After the user selects the new mode, the text control is reactivated and the user may continue to enter text. When entering text, the user may press the Select Key to leave text-edit mode and activate the SoftKey Menu. While the Soft Key menu is active, the user may press the UP key to return to edit mode without making a menu selection.

The following is an example of how to allow multiple input modes in your text control:
// Create text control
ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_TEXTCTL,
(void **)&pMe->m_pIText);
if (pMe->m_pIText) {
// Create soft key menu
ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_SOFTKEYCTL,
(void **)&pMe->m_pISoftKey);
if (!pMe->m_pISoftKey) {
ITEXTCTL_Release (pMe->m_pIText);
pMe->m_pIText = NULL;
return FALSE;
}
}
else {
return FALSE;
}
// Set the soft key menu rectangle
IMENUCTL_SetRect(pMe->m_pISoftKey, &softKeyRect);
// Set text control title, size, properties, rectangle
ITEXTCTL_SetTitle(pMe->m_pIText, NULL, NULL, titleString);
ITEXTCTL_SetMaxSize(pMe->m_pIText, 100);
ITEXTCTL_SetProperties(pMe->m_pIText, TP_FRAME | TP_MULTILINE );
ITEXTCTL_SetRect(pMe->m_pIText, &rect);
// Initialize the softkey menu of the text control.
ITEXTCTL_SetSoftKeyMenu (pMe->m_pIText, pMe->m_pISoftKey);
// Set both the soft key and text control active.
IMENUCTL_SetActive(pMe->m_pISoftKey,TRUE);
ITEXTCTL_SetActive (pMe->m_pIText, TRUE);
In the app's HandleEvent function, you must handle the EVT_KEY and EVT_COMMAND
events as follows:
case EVT_COMMAND:
// Process EVT_COMMAND event - change of input mode
if((pMe->m_pIText != NULL) && ITEXTCTL_HandleEvent(pMe->m_pIText,
eCode, wParam, dwParam)) {
return TRUE;
}
return FALSE;
case EVT_KEY:
if ((pMe->m_pIText != NULL) && ITEXTCTL_HandleEvent(pMe->m_pIText,
EVT_KEY, wParam, dwParam)) {
//Event handled by text control
return TRUE;
}
if(pMe->m_pISoftKey != NULL && IMENUCTL_HandleEvent(
pMe->m_pISoftKey, EVT_KEY, wParam, dwParam)) {
//Event handled by menu control
return TRUE;
}
return FALSE;

No comments: