Skip to main content
Inspiring
November 18, 2021
Answered

.parent() help

  • November 18, 2021
  • 1 reply
  • 345 views

I'm writing a function to get screen position by entering container object and client position,

I have a problem. When I "container object. Parent. Parent", VSC will generate a new window object every time it is debugged

If I can't use. Parent (), do I have any other way to write this function?

This topic has been closed for replies.
Correct answer damomoyu

I found a problem

It is not the continuous use of. Parent, but the use of "Window" related operations (for example, if (XXX instanceof Window) {XXX}, VSC will generate a new window every time it is called,

1 reply

Mylenium
Legend
November 18, 2021

.parent() refers to a UI layout group or property group. If you don't structure your code suitably, of course just daisy-chaining multiple such calls together won't do anything. Maybe you should re-read the scripting guide on how to address property groups and/ or create UI layouts. You haven't really offered any useful info, anyway, like explaining what you are actualyl trying to do or providing the complete code, so nobody can advise specifically.

 

Mylenium

damomoyuAuthor
Inspiring
November 19, 2021

Sorry, I recorded a video to illustrate my problem.

https://www.bilibili.com/video/BV16r4y1k747/

damomoyuAuthorCorrect answer
Inspiring
November 23, 2021

I found a problem

It is not the continuous use of. Parent, but the use of "Window" related operations (for example, if (XXX instanceof Window) {XXX}, VSC will generate a new window every time it is called,