Cardozz 46 Author Share Posted July 4, 2016 Double check the widget parent and child ID, and if they're correct you can try getWidgets().getWidget(84).getChild(26) (but I don't think that'll make a difference). Just curious... not sure it'll help try getting the 84 widget and null checking it and then grab the child... tho..m getChild should throw an error then shouldn't it... hmm So i just found out that if i run the script without the widget child visible (it opens the widget with the child in it correctly) it returns FALSE When i run the script with the widget child visible (the widget with the child already open) it returns TRUE, meaning that the code executed correctly Now that is weird XD Link to comment Share on other sites More sharing options...
Hopewelljnj 46 Share Posted July 4, 2016 So i just found out that if i run the script without the widget child visible (it opens the widget with the child in it correctly) it returns FALSE When i run the script with the widget child visible (the widget with the child already open) it returns TRUE, meaning that the code executed correctly Now that is weird XD Are you grabbing the widget before your script opens it? That would explain the issue Link to comment Share on other sites More sharing options...
Pandemic 2723 Share Posted July 4, 2016 I have quadruple checked the widget child ID. It worked before with the SAME id, but since i ripped the nested code apart (it's correct, no flaws) it needs like 5 loops to see that the child is not null. Oh and i already did that man, i got the above error with getWidgets().getWidget(84).getChild(26). If it worked before and doesn't now, it probably has to do with your code, pastebin the whole method surrounding it. Also, what are you returning in your onLoop? It takes some time for the widgets to update (~600ms or so). Link to comment Share on other sites More sharing options...
Cardozz 46 Author Share Posted July 4, 2016 Are you grabbing the widget before your script opens it? That would explain the issue I indeed just found out that this could be an issue. I put all the variables in the first lines of the method. Which means when the method is called, the widget variable will be null. Though i found it weird but this seems to be the issue (grabbing the child early means that it holds on to the fact that it was invisible at that time, even when it's visible later on. If it worked before and doesn't now, it probably has to do with your code, pastebin the whole method surrounding it. Also, what are you returning in your onLoop? It takes some time for the widgets to update (~600ms or so). I also thought about this. So i waited 2 seconds before continuing the code, and tthen i made it 5 secons. Nothing changed. But the above explanation might be the issue! Link to comment Share on other sites More sharing options...
Hopewelljnj 46 Share Posted July 4, 2016 I indeed just found out that this could be an issue. I put all the variables in the first lines of the method. Which means when the method is called, the widget variable will be null. Though i found it weird but this seems to be the issue (grabbing the child early means that it holds on to the fact that it was invisible at that time, even when it's visible later on. I also thought about this. So i waited 2 seconds before continuing the code, and tthen i made it 5 secons. Nothing changed. But the above explanation might be the issue! The widget grabs all data initially. It does not update each time a method is called on it. Tho an update method might be nice Link to comment Share on other sites More sharing options...
Cardozz 46 Author Share Posted July 4, 2016 Thanks @Hopewelljnj and @Pandemic,, IT WORKS NOW!!! all i had to do was NOT call the widgets on the call of the method (which makes the variable store the state of the widget on call, they don't seem to update when you call them later on). Good lesson learned . Never knew that widget variables held onto the state of the widget. I thought they just stored the widget ID's without "null" or "not null" state. Link to comment Share on other sites More sharing options...
Diddy 265 Share Posted July 4, 2016 I just always check it for !=null & .isVisable tp avoid a nullpointer Link to comment Share on other sites More sharing options...
Hopewelljnj 46 Share Posted July 4, 2016 I just always check it for !=null & .isVisable tp avoid a nullpointer He was but he was questioning why it was null in the first place. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.