Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-20580] Windows: can't address to parent on windows phone

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2016-04-07T14:46:08.000+0000
Affected Version/sRelease 5.2.0
Fix Version/sRelease 5.4.0
ComponentsWindows
Labelschildren, parent, qe-5.4.0, windowsphone
Reporterbertelle
AssigneeKota Iguchi
Created2016-03-03T07:15:43.000+0000
Updated2016-06-29T23:01:53.000+0000

Description

Hi, on windowsphone children views can't address parent view function Works fine on android and ios defined as null on windowsphone

Comments

  1. Jebun Naher 2016-03-09

    Hello, Thanks for your report. Please provide your full working environment details like SDK, CLI version etc. Also attach a simple test case and steps to reproduce this issue. Regards.
  2. bertelle 2016-03-15

    {color:#14892c}/*example code*/{color}
       var win = Ti.UI.createWindow({  
           title:'test', backgroundColor:'#fff'
       });
       view=Ti.UI.createView({
       	backgroundColor:'green',
       	width:'100%',
       	height:'100%'
       });
       view.add(Ti.UI.createButton({
       	title:'color change',
       }));
       view.children[0].addEventListener('click',function(){
       	this.parent.setBackgroundColor('red');
       });
       win.add(view);
       win.open();
       
    {color:#14892c}/*end example code*/{color} {color:red}[ERROR] : Application Error: "Runtime Error during click event: undefined is not an object (evaluating 'this.parent.setBackgroundColor')"{color}
       Host OS: Windows 8
       OS Version: 6.2
       OS Arch: x86
       JRE Version: 1.7.0_80
       JRE Vendor: Oracle Corporation
       JRE Home: C:\Program Files (x86)\Java\jdk1.7.0_80\jre
       Appcelerator Studio Version: 4.5.0.201602170821
       Selected Titanium SDK: 5.2.0.GA
       Latest Titanium SDK: 5.2.0.GA
       Titanium SDK Version: 5.2.0.GA
       SDK Modules API Version:2
       Appcelerator Command-Line Interface, version 5.2.0
       Node.JS Version: v0.12.7
       NPM Version: 2.11.3
       Appcelerator CLI core version : 5.2.0
       
  3. Christopher Williams 2016-03-21

    Unless I'm mistaken, there is no "parent" property for views. I see no 'parent' property listed for Ti.UI.Button or Ti.UI.View: http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.Button Does this work on other platforms?
  4. Christopher Williams 2016-03-31

    [~jnaher] Can you try and reproduce on Android/iOS? I don't think a "parent" property exists on any platform (at least not in the docs).
  5. bertelle 2016-03-31

    As said above, example code works fine on iOS and Android. I have already tried it on real devices.
  6. Kota Iguchi 2016-04-05

    https://github.com/appcelerator/titanium_mobile_windows/pull/608
  7. Harry Bryant 2016-06-29

    Verified as fixed, test code no longer throws an error, and color change button correctly affects the backgroundColor of the parent. Tested on: Windows 10 Pro Windows Phone 10.0 (Microsoft Lumia 640 LTE) Appc Studio: 4.7.0.201606220541 Ti SDK: 5.4.0.v20160627224205 Appc NPM: 4.2.7-2 Appc Core: 5.4.0-20 Node: v4.4.4 *Closing Ticket.*

JSON Source