Thread Tools Display Modes
02-04-22, 07:49 PM   #1
Racksoup
A Kobold Labourer
Join Date: Feb 2022
Posts: 1
Ace3 GetWidth() not working

When I try to use GetWidth() or GetHeight() on an Ace3 frame I receive the error message 'attempt to call method 'GetWidth' (a nil value)'.

local basicFrame = ACE_GUI:Create("Frame")
basicFrame:SetHeight(200)
basicFrame:SetWidth(200)
print(basicFrame:GetWidth())

When I use a frame from CreateFrame() I can use GetWidth() and GetHeight().

I am also developing on Classic if that makes a difference.
  Reply With Quote
02-05-22, 08:23 AM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
AceGUI:Create() doesn't directly return a frame handle. It returns a table they call a "widget", though it does contain the frame handle at widget.frame. AceGUI also sets widget.frame.width when you call widget:SetWidth().

Example:
Lua Code:
  1. local ACE_GUI=LibStub:GetLibrary("AceGUI-3.0");--   Assuming you had this defined previously
  2.  
  3. local basicFrame=ACE_GUI:Create("Frame");
  4. basicFrame:SetHeight(200);
  5. basicFrame:SetWidth(200);
  6.  
  7. --  Both of these should print the same value
  8. print(basicFrame.frame.width);
  9. print(basicFrame.frame:GetWidth());
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Ace3 GetWidth() not working

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off