Runes of Magic Wiki
Explore
Main Page
All Pages
Interactive Maps
navigation
Main Page
Recent changes
Community portal
Random page
Admin noticeboard
wiki navigation
Classes
Equipment
Regions and Cities
Quests
Bestiary
Gathering
Processing
Production
Sitemap
Transmutation Chart
Attributes
portals
Runes of Magic
Joint RoM Forum
Official Games Status
RoM Discord Servers
Unofficial Server Status 1
Unofficial Server Status 2
Unofficial Server Status 3
Twitch
RoM-Welten database
Wikia RoM Wiki
Wikidot RoM Wiki
ZAM RoM Wiki
Gamepedia
Gamepedia support
Report a bad ad
Help Wiki
Contact us
FANDOM
Fan Central
BETA
Games
Anime
Movies
TV
Video
Wikis
Explore Wikis
Community Central
Start a Wiki
Don't have an account?
Register
Sign In
Sign In
Register
Runes of Magic Wiki
28,471
pages
Explore
Main Page
All Pages
Interactive Maps
navigation
Main Page
Recent changes
Community portal
Random page
Admin noticeboard
wiki navigation
Classes
Equipment
Regions and Cities
Quests
Bestiary
Gathering
Processing
Production
Sitemap
Transmutation Chart
Attributes
portals
Runes of Magic
Joint RoM Forum
Official Games Status
RoM Discord Servers
Unofficial Server Status 1
Unofficial Server Status 2
Unofficial Server Status 3
Twitch
RoM-Welten database
Wikia RoM Wiki
Wikidot RoM Wiki
ZAM RoM Wiki
Gamepedia
Gamepedia support
Report a bad ad
Help Wiki
Contact us
Editing
Guide to XML frames part2
(section)
Back to page
Edit
VisualEditor
History
Talk (0)
Edit Page
Guide to XML frames part2
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Closing up shop == While we are on the subject of buttons, lets add a close button to our frame so that the user can completely remove the frame from the screen. Admitedly, there is an ulterior motive for doing this as you'll see in the next section, but for now lets pretend we want to allow the player to remove the frame from the screen. We've seen that RoM provides many templates for creating interface panels and one of these virtual objects is a close button. The advantage for the user is that by using this template, the close button will look like every other close button the player has seen in the game and will instantly know what it is and how it is supposed to work. For add-on developers the advantage is that it is pretty much complete and all we really need to do is to tell the game where to anchor the button on our frame. As this is a close button, we need to add it to the <code>Frames</code> section of our frame definition. Add the following: <code><pre> <Button name="$parentCloseButton" inherits="UIPanelCloseButtonTemplate"> <Anchors> <Anchor point="TOPRIGHT" relativePoint="TOPRIGHT"> <Offset> <AbsDimension x="-5" y="6"/> </Offset> </Anchor> </Anchors> </Button> </pre></code> That's all we need to do to get a working close button. All relevant scripts and code snippets are already defined by <code>UIPanelCloseButtonTemplate</code> so no other modifications to our code is needed to make it work. To get the window back after closing it, type the command <code>/run MemViewerFrame:Show()</code> in the chat edit box. === Opening shop again === So adding a close button was simple enough but to make it convenient to get it back we should really add a slash command. We won't discuss slash commands themselves as this is a tutorial on frames and they are also covered in the add-on tutorial on the RoM Wiki. We'll need to add this in our Lua file so open <code>MemViewer.lua</code> and add the following after we create the main variable: <code><pre> --[[ Slash command handler ]]-- SLASH_MemViewer1 = "/mview"; SlashCmdList["MemViewer"] = function(ebox, msg) if(MemViewerFrame:IsVisible()) then MemViewerFrame:Hide(); else MemViewerFrame:Show(); end end </pre></code> This will toggle our frame on and off each time we type <code>/mview</code> in the chat edit box. What we need to note here is how the code is verifying if the frame is visible, and how it shows or hides the frame.
Summary:
Please note that all contributions to the Runes of Magic Wiki are considered to be released under the CC BY-NC-SA
Cancel
Editing help
(opens in new window)
Follow on IG
TikTok
Join Fan Lab