Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Child Frames/Fields #16

Closed
ChrisKader opened this issue Sep 24, 2021 · 4 comments
Closed

Child Frames/Fields #16

ChrisKader opened this issue Sep 24, 2021 · 4 comments
Labels
question Further information is requested

Comments

@ChrisKader
Copy link
Collaborator

I noticed that child frames or fields created by default when some Frame Types are created are not included in the type defs.

Example would be:

local f = CreateFrame("CheckButton", nil, UIParent)

If I reference f.text I am told by the extension in VSCode that it is an undefined field. However, .text is created as a FontString at the root of f and is the text that is attached to the button. The only way I have found around this is to define a custom class, like shown below, that extends the default class to include the field.

---@class CheckButton_E : CheckButton
---@field text FontString
local f = CreateFrame("CheckButton", nil, UIParent)
f.text:SetText("Test")
@Ketho
Copy link
Owner

Ketho commented Sep 24, 2021

Do you mean the CheckButton frame type has a text field by default? But /dump CreateFrame("CheckButton").text returns nil for me. Or are you using some kind of inherited template?

Note that EmmyLua class inheritance is currently kinda broken https://github.com/sumneko/lua-language-server/issues/660
edit: it still pinged them huh :(

@Ketho Ketho added the question Further information is requested label Sep 27, 2021
@Ketho Ketho closed this as completed Sep 29, 2021
@ChrisKader
Copy link
Collaborator Author

Looks like .text does come from an inherited template, my apologies.

@Ketho
Copy link
Owner

Ketho commented Oct 1, 2021

So something like #15, although I don't really know a solution for that

@ChrisKader
Copy link
Collaborator Author

You are right, my apologies for opening a duplicate. I will look at 15 and see what can possibly be done. I am familiar with typescript but I think the limitations of EmmyLua may not easily allow for it :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants