Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

display.newRect() has critical issue!
Started by Kangmin Won Apr 24 2018 12:18 AM

4 replies to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

Kangmin Won

[GLOBAL: userInfoPane.html]
Kangmin Won
  • Contributor

  • 151 posts
  • Corona SDK

This may not be the only problem with newRect (). The code below works differently. Calling insert () is normal and does not appear on the screen if you include the parent.

 

I received an error report several times from Fabric.io. The problem is that the first argument to newRect () is not a number. The first argument in my code was a group.

 

correct ::

local box = ...

local gap = display.newRect(0, 0, 320, 150)
gap.y = 150
box:insert(gap)

Attached File  correct.png   369.09KB   0 downloads

 

 

Incorrect ::

local box = ...

local gap = display.newRect(box, 0, 0, 320, 150)
gap.y = 150

Attached File  incorrect.png   361.81KB   0 downloads



[TOPIC: post.html]
#2

Glitch Games

[GLOBAL: userInfoPane.html]
Glitch Games
  • Contributor

  • 597 posts
  • Corona SDK

Will need more code to actually fix this but are you sure that "box" is definitely a group? It's not somehow been set to something else by mistake somewhere or gone out of scope somewhere so that when you try to insert something into it it's not a group anymore?



[TOPIC: post.html]
#3

Kangmin Won

[GLOBAL: userInfoPane.html]
Kangmin Won
  • Contributor

  • 151 posts
  • Corona SDK

Thank you for your reply. :-)

The box is a group absolutely. Because you can see the screenshots between insert() code and parameter code.



[TOPIC: post.html]
#4

nick_sherman

[GLOBAL: userInfoPane.html]
nick_sherman
  • Corona Geek

  • 1,491 posts
  • Corona SDK

We need more detail to be able to help. If display.newRect really had a critical issue, it would have picked up at some point in the last 8 years.

So something else must be going on.

[TOPIC: post.html]
#5

davebollinger

[GLOBAL: userInfoPane.html]
davebollinger
  • Corona Geek

  • 1,167 posts
  • Enterprise

any chance display.newRect has been replaced?  (aka "monkey-patched", similar to the way the widgets lib replaces display.newGroup)

if so, then perhaps the replacement isn't properly handling the 5-argument form.

 

at top of main.lua do:  print(display.newRect)

then do again just prior to the use shown in this post, and see if they print out the same function address




[topic_controls]
[/topic_controls]