Languages

Menu
Sites
Language
Default enabled LIST_ANNEX_STYLE_ONOFF_SLIDING

I create a list view with some custom items. The style of the items are LIST_ANNEX_STYLE_ONOFF_SLIDING

How can i set the slider value to on, on construction? Now the default is off.

 

Thanks in advance

Responses

8 Replies
Alex Ashirov

Hi,

Please use:

result Tizen::Ui::Controls::ListView::SetItemChecked (int index, bool check)     

 

Byron Gavras

At first it didn't work. I added the code inside CreateItem method and it worked.

Thank you Alex. 

Levan Gogohia

please show me how you added it to your code.:-) 

Alex Ashirov

Hi Levan,

Just add

__pList->SetItemChecked(index, true);

into your CreateItem() method.

Gary V

Hi,

SetItemChecked() might not work inside CreateItem(). The documentation mentions: "This method should be called only after list items are created." At least TableView always returns E_INVALID_OPERATION inside CreateItem().

In OnInitializing(), try calling UpdateList() to pre-create all ListView items, followed by SetItemChecked().

Gary

Levan Gogohia

Hmm... SetItemChecked() work inside CreateItem. 

Levan Gogohia

Hmm... SetItemChecked() work inside CreateItem. 

Byron Gavras

Here is my code Levan Gogohia

// IListViewItemProvider implementation
ListItemBase* UiFrameModeForm::CreateItem(int index, int itemWidth) {   

CustomItem* pItem;
    if (DEBUG)AppLog("Called Create Item %d and item width %d in ACTIVE PANEL %d", index, itemWidth,currentPanel);

        switch (index)
         {
            case 0:
                pItem = new CustomItem();
                pItem->Construct(Dimension(400, 200), style);
                pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL ,Color(0xffC7C7C7));
                 pItem->AddElement(Rectangle(30, 30, 64, 64), ID_CALL_STRING3, *callsBitmap, null,null);
                 __pListViewMain->SetItemChecked(0,true);
                break;

                   .

                   .

                   .

                   .