WoW:Creating standard left-sliding frames: Difference between revisions
(demoted headings) |
m (Move page script moved page Creating standard left-sliding frames to Creating standard left-sliding frames without leaving a redirect) |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
The container (bag) frames have their own custom code which uses SetPoint to adjust them relative to each other, but frames like the CharacterInfo and Merchant use common functions from UIParent.lua. To make use of this common code you need to define UI Panel layout attributes for your frame after you create it. You can do it in Scripts/OnLoad section of XML or right after you call CreateFrame in Lua. | |||
MyFrameName:SetAttribute("UIPanelLayout-defined", true) | |||
MyFrameName:SetAttribute("UIPanelLayout-enabled", true) | |||
MyFrameName:SetAttribute("UIPanelLayout-area", "left") | |||
MyFrameName:SetAttribute("UIPanelLayout-pushable", 5) | |||
MyFrameName:SetAttribute("UIPanelLayout-width", width) | |||
MyFrameName:SetAttribute("UIPanelLayout-whileDead", true) | |||
'UIPanelLayout-area' is left (most frames), middle (menu or if two left frames are open), fullscreen (map), doublewide (auction), or center (main menu).<br> | |||
'UIPanelLayout-pushable' specifies the priority of your window. If two other "left" windows are already open, when a third frame opens, the one with the lowest priority is closed.<br> | |||
'area' is left (most frames), middle (menu or if two left frames are open), fullscreen (map), doublewide (auction), or center (main menu).<br> | 'UIPanelLayout-width': The effective width of the UI panel, used as an override for frame:GetWidth() | ||
'pushable' specifies the priority of your window. If two other "left" windows are already open, when a third frame opens, the one with the lowest priority is closed.<br> | 'UIPanelLayout-whileDead' specifies that the frame can be opened while the player is dead. Leave this field out (or set it to nil) to prevent the player from accessing the frame while dead. | ||
'whileDead' specifies that the frame can be opened while the player is dead. Leave this field out (or set it to nil) to prevent the player from accessing the frame while dead. | |||
Finally, you'll need to use ShowUIPanel(frame) and HideUIPanel(frame) instead of frame:Show() / Hide(); | Finally, you'll need to use ShowUIPanel(frame) and HideUIPanel(frame) instead of frame:Show() / Hide(); | ||
[[Category: HOWTOs|Make frames arrange like standard frames (sliding over from the left)]] | [[Category: HOWTOs|Make frames arrange like standard frames (sliding over from the left)]] |
Latest revision as of 04:47, 15 August 2023
The container (bag) frames have their own custom code which uses SetPoint to adjust them relative to each other, but frames like the CharacterInfo and Merchant use common functions from UIParent.lua. To make use of this common code you need to define UI Panel layout attributes for your frame after you create it. You can do it in Scripts/OnLoad section of XML or right after you call CreateFrame in Lua.
MyFrameName:SetAttribute("UIPanelLayout-defined", true) MyFrameName:SetAttribute("UIPanelLayout-enabled", true) MyFrameName:SetAttribute("UIPanelLayout-area", "left") MyFrameName:SetAttribute("UIPanelLayout-pushable", 5) MyFrameName:SetAttribute("UIPanelLayout-width", width) MyFrameName:SetAttribute("UIPanelLayout-whileDead", true)
'UIPanelLayout-area' is left (most frames), middle (menu or if two left frames are open), fullscreen (map), doublewide (auction), or center (main menu).
'UIPanelLayout-pushable' specifies the priority of your window. If two other "left" windows are already open, when a third frame opens, the one with the lowest priority is closed.
'UIPanelLayout-width': The effective width of the UI panel, used as an override for frame:GetWidth()
'UIPanelLayout-whileDead' specifies that the frame can be opened while the player is dead. Leave this field out (or set it to nil) to prevent the player from accessing the frame while dead.
Finally, you'll need to use ShowUIPanel(frame) and HideUIPanel(frame) instead of frame:Show() / Hide();