Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Hello All,

I am trying to create a Grid using Brew UI Widgets.
But I am not able to see anything on the screen.
It is just displaying Blank Screen.

Please find the Steps and code snippet I used to create the Grid..

Steps I have followed is ::
1. Created instance for RootContainer.
2. Created instance for Grid Container and used Query interface to get Widget pointer.
3. Using Widget pointer I have set the Extent (IWidget_SetExtent)
4. Inserted the Grid Container into Root Container.
5. Create Image Widgets and inserted them into Grid Container.
6. I have set the descriptor to GridContainer..

** I am not able to see any output. Can anyone tell me the steps I am following is correct or anything is missing from my side.. Like this is very important for me to proceed further..

Code Snippet ::

WidgetExtent extent;
WidgetPos pos;
GridDescriptor Rows[1], Cols[2];
uint16 nRows = 1, nCols = 2;

int nErr = 0;
IWidget *pImageWidget;
IImage *pIImage;

//AEERect rc;

//Step 1 and 2
nErr = ISHELL_CreateInstance(pMe->pIShell, AEECLSID_GRIDCONTAINER, (void **)&(pMe->pIGridContainer));

nErr = IGridContainer_QueryInterface(pMe->pIGridContainer, AEEIID_IWidget, &(pMe->pwMyGridContainer));

//Step 3 setting extent

SETWEXTENT(&extent, 100, 200);
IWidget_SetExtent(pMe->pwMyGridContainer, &extent);

//Step 4 insert into root container..

pos.x = 10;
pos.y = 10;
pos.bVisible = TRUE;

nErr = IRootContainer_Insert(pMe->pIRootContainer,
pMe->pwMyGridContainer,
WIDGET_ZNORMAL,
&pos);

//Inserting four Image widgets into grid container...
// ImageWidget 1 ...
nErr = ISHELL_CreateInstance(pMe->pIShell, AEECLSID_IMAGEWIDGET, (void**)&pImageWidget);
if ( nErr != SUCCESS ) return EFAILED;
pIImage = ISHELL_LoadImage(pMe->pIShell, "image1.bmp");
nErr = IWidget_SetImage(pImageWidget, pIImage);
nErr = IGridContainer_Insert(pMe->pIGridContainer, pImageWidget, WIDGET_ZNORMAL, NULL);
// IWidget_MoveFocus( pMe->pwMyGridContainer, pIConImageWidget );
IWidget_Release(pImageWidget);

// ImageWidget 2 ...
nErr = ISHELL_CreateInstance(pMe->pIShell, AEECLSID_IMAGEWIDGET, (void**)&pImageWidget);
if ( nErr != SUCCESS ) return EFAILED;
pIImage = ISHELL_LoadImage(pMe->pIShell, "image1.bmp");
nErr = IWidget_SetImage(pImageWidget, pIImage);
nErr = IGridContainer_Insert(pMe->pIGridContainer, pImageWidget, WIDGET_ZNORMAL, NULL);

//Last step creating array of grid descriptors and setting that to grid..
Rows[0].iFlag = CELL_SIZE_TO_FIT;
Rows[0].iValue = 0; //ignored for this flag (see Cell types)
Rows[0].iPaddingBefore = 2;
Rows[0].iPaddingAfter = 2;

Cols[0].iFlag = CELL_SIZE_TO_FIT;
Cols[0].iValue = 0; //ignored for this flag (see Cell types)
Cols[0].iPaddingBefore = 2;
Cols[0].iPaddingAfter = 2;

Cols[1].iFlag = CELL_SIZE_TO_FIT;
Cols[1].iValue = 0; //ignored for this flag (see Cell types)
Cols[1].iPaddingBefore = 2;
Cols[1].iPaddingAfter = 2;

nErr = IGridContainer_SetGridDescriptors(pMe->pIGridContainer,Rows,&nRows,Cols,&nCols);

Please guide me to create grid and display it properly.

Regards
Venu

Have you set Image Widget's Extent?

Have you set Image Widget's Extent?

Hi wenmin311,
Thanks for your reply. I have figured out the problem and I am able to see the grid now.
But I don't know exact steps to follow so that I can change focus between grid items.
can you tell me how should I handle focus change in Grid? Do you have any example?
Regards
Venu

Hi wenmin311,
Thanks for your reply. I have figured out the problem and I am able to see the grid now.
But I don't know exact steps to follow so that I can change focus between grid items.
can you tell me how should I handle focus change in Grid? Do you have any example?
Regards
Venu

Hi
I too did in the same way for grid view. I'm unable to see the images. It is showing empty screen. Is there any extra code to see the images.
Thanks
Jithendra

Hi
I too did in the same way for grid view. I'm unable to see the images. It is showing empty screen. Is there any extra code to see the images.
Thanks
Jithendra