I am trying to implement a grid fully from resource , as it would be a static one only . I have done till this . Right now I want to show some text in it .My problem is that the grid do not show . Do I need to add something ?
I am implementing the view class as the container for grid .Code:RESOURCE GRID r_selectiongrid { //height = 5; // in items //width = 10; flags = EAknListBoxSelectionGrid; style = r_selectiongrid_style; array_id = r_selectiongrid_items; } RESOURCE GRID_STYLE r_selectiongrid_style { layoutflags = EAknGridHorizontalOrientation |EAknGridLeftToRight | EAknGridTopToBottom; primaryscroll = EAknGridFollowsItemsAndLoops; secondaryscroll = EAknGridFollowsItemsAndLoops; itemsinprimaryorient = 3; itemsinsecondaryorient = 3; gapwidth = 5; gapheight = 5; width = 50; height = 50; } RESOURCE ARRAY r_selectiongrid_items { items = { LBUF { txt = "aaa"; }, LBUF { txt = "bbb"; }, LBUF { txt = "ccc"; }, LBUF { txt = "ddd"; }, LBUF { txt = "eee"; }, LBUF { txt = "fff"; }, LBUF { txt = "ggg"; }, LBUF { txt = "hhh"; }, LBUF { txt = "iii"; } }; }
Code:void CSimpleGridAppView::ConstructL( const TRect& aRect ) { CreateWindowL(); // Set the windows size SetRect( aRect ); // Activate the window, which makes it ready to be drawn ActivateL(); iGrid = new( ELeave ) CAknGrid; iGrid->SetContainerWindowL( *this ); TResourceReader reader; CEikonEnv::Static()->CreateResourceReaderLC(reader, R_SELECTIONGRID); iGrid->ConstructFromResourceL(reader); iGrid->ActivateL(); // Setup text foreground and background colors to default AknListBoxLayouts::SetupStandardGrid( *iGrid ); // Setup the graphics subcell AknListBoxLayouts::SetupFormGfxCell( *iGrid, // Reference to grid control iGrid->ItemDrawer(), // Pointer to the item drawer 0, // Column index 0, // Left position 0, // Top position 0, // Right - unused 0, // Bottom - unused 50, // Width 32, // Height TPoint(0,0), // Start position TPoint(32, 32)); // End position AknListBoxLayouts::SetupFormTextCell( *iGrid, // Reference to grid iGrid->ItemDrawer(), // Pointer to the item drawer 1, // Column index LatinBold12(), // Font 215, // Color (215 = black) 0, // Left margin 0, // Right margin - unused 50 - 3, // Baseline 50, // Text width CGraphicsContext::ECenter, // Text alignment TPoint(0, 32), // Start position TPoint(50, 50)); // End position iGrid->SetFocus(ETrue); iGrid->DrawNow(); CleanupStack::PopAndDestroy(); }


Reply With Quote



