Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Highlighted
New Developer
Posts: 168
Registered: ‎04-12-2010
My Device: Storm
My Carrier: Verizon

LIstView does not fire onTriggered

I have a TabPane and on one of the tabs I have a Page with a ListView that I include from another QML , I have some test routines where I pass data from C++ to QML so is plugged,

 

I needed different styles for the ListView I accomplished this by passing an extra field in my model and with this I load a different look via definitions of ListComponent, so on on of them I have

 

                    ListItemComponent 
                    {
                        type: "listItemToggle"

                        Container 
                        {
                           
                            
                            Container{
                                topPadding: 14
                                bottomPadding: 20
                                id: itemRoot

                            layout: StackLayout {
                                orientation: LayoutOrientation.LeftToRight
                            }

                            Label {
                                
                                layoutProperties: StackLayoutProperties {
                                    spaceQuota: 0.7
                                }
                                text: ListItemData.setting
                                textStyle {
                                    base: SystemDefaults.TextStyles.TitleText
                                    fontWeight: FontWeight.Normal
                                }
                            }
                            
                            ToggleButton
                            {
                                id:toggly
                                
                                layoutProperties: StackLayoutProperties {
                                    spaceQuota: 0.3
                                }
                                
                                checked: ListItemData.setting_val

                                    //handle the writng back
                                    onCheckedChanged: { // paaas back the new va; for saving
                                        toast.body("here");
                                        toast.show();

                                        _myToolies..save_toggle(ListItemData.setting, toggly.checked);

                                    }

                                }  // toggle

                          
                          		}

                            Container {
                                Divider {
                                }
                            }

                        }

                    }  // listItemToggle

 the onCheckChanged never fires first I thought my routines in C++ are flaking out so I put a popup box which doesn't pop, 

 

So I tried it on the Listview def itself as below same the toast does not pop and my breakpoint never hits

ListView {
id: lv_prefs
dataModel: _myToolies.model 

...

onTriggered: { 
           toast.body("hello"); 
           toast.show(); 
}
 

 

 

 

 What am I missing????

 

   Thanks in advance

New Developer
Posts: 168
Registered: ‎04-12-2010
My Device: Storm
My Carrier: Verizon

Re: LIstView does not fire onTriggered

Anyone???

 

I'm back to this stuff, and I think the issue is the event inside a ListItemComponent doesn't fire

do I need to import/add something or it is just not allowed ... documentation is blurry on this one

this definition renders but I cannot catch that the toggle has changed, if I place a toggle button as an extra

item outside of the ListItemComponent it fires fine

 

                listItemComponents: [

                    ListItemComponent 
                    {
                        type: "listItemToggle"

                        Container 
                        {
                           
                            
                            Container{
                                topPadding: 14
                                bottomPadding: 20
                                id: itemRoot

                            layout: StackLayout {
                                orientation: LayoutOrientation.LeftToRight
                            }

                            Label {
                                
                                layoutProperties: StackLayoutProperties {
                                    spaceQuota: 0.7
                                }
                                text: ListItemData.setting
                                textStyle {
                                    base: SystemDefaults.TextStyles.TitleText
                                    fontWeight: FontWeight.Normal
                                }
                            }
                            
                            ToggleButton
                            {
                                id:toggly
                                
                                layoutProperties: StackLayoutProperties {
                                    spaceQuota: 0.3
                                }
                                
                                checked: ListItemData.setting_val

                                    //handle the writng back
                                    onCheckedChanged: { // pass back the new val for saving
                                        toast.body= "Im' here";
                                        toast.show();

                                    }

                                }  // toggle

                          
                          		}
....