Go to Page... |
Thread Tools | Display Modes |
05-09-19, 11:32 PM | #1 |
TitleRegion - Movable Frame on TitleFrame only
Issue: Cant seem to get TitleRegion to work. Making Frame movable via Title Frame only
Method: XML: Using Template Frames. lua on the event of OnMouseDown/OnMouseUp. I can get the whole frame to drag around by doing the OnMouseDown/OnMouseUp events if i place it in my root <Frame />, Which is fine except i dont want it to drag the frame unless im clicking on the title frame Im wandering, can i set the OnMouseDown/OnMouseUp events in the TitleFrame template in order to accomplish what im after? or does that not work?. code: Main Frame (Called Via CreateFrame()) iTrackerFrameTemplate.xml Code:
<Ui> <Script file="iTrackerFrameTemplate.lua" /> <Frame name="iTrackerFrameTemplate" virtual="true"> <Size x="200" y="292" /> <Anchors> <Anchor point="CENTER" relativeTo="UIParent" relativePoint="CENTER" /> </Anchors> <Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background" edgeFile="" tile="true"> <BackgroundInsets> <AbsInset left="11" right="12" top="12" bottom="11" /> </BackgroundInsets> <TileSize val="32" /> <EdgeSize val="32" /> </Backdrop> <Frames> <Frame name="$parent_TitleFrame" parentKey="titleFrame" inherits="iTrackerFrame_TitleFrameTemplate"> <Scripts> <OnLoad> iTrackerFrame_TitleFrameTemplate_OnLoad_SetWidth(self) </OnLoad> </Scripts> </Frame> </Frames> </Frame> </Ui> Code:
<Ui> <Script file="iTrackerFrame_TitleFrameTemplate.lua" /> <Frame name="iTrackerFrame_TitleFrameTemplate" parentKey="titleFrame" virtual="true" movable="true"> <Size x="80" y="50" /> <Anchors> <Anchor point="TOPRIGHT" relativeTo="$parent" relativePoint="TOPRIGHT" y="20" /> </Anchors> <Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background-Dark" edgeFile="" tile="true"> <BackgroundInsets> <AbsInset left="11" right="12" top="12" bottom="11" /> </BackgroundInsets> <TileSize val="32" /> <EdgeSize val="32" /> </Backdrop> <Layers> <Layer level="OVERLAY"> <FontString name="title" parentKey="title" inherits="GameFontNormal" text="<title>"> <Size x="80" y="20" /> <Anchors> <Anchor point="TOPLEFT" relativeTo="$parent" relativePoint="TOPLEFT" /> <Anchor point="BOTTOMRIGHT" relativeTo="$parent" relativePoint="BOTTOMRIGHT" /> </Anchors> </FontString> </Layer> </Layers> </Frame> </Ui> iTrackerFrameTemplate.lua Code:
function iTrackerFrame_TitleFrameTemplate_OnLoad_SetWidth(Frame) -- Set Width Based on title length local title = Frame.title title:SetText(iTracker:GetInfo('AppName')) Frame:SetWidth(title:GetWidth()) end you can just set that to "TITLE OF FRAME" if you want. Last edited by urakkaamyx : 05-09-19 at 11:36 PM. |
|
05-10-19, 12:19 AM | #2 |
More like:
Lua Code:
Lua Code:
The width of the body will size with the header and its height can be set independently so the function name is now a bit misleading, more like TrackerFrame_BodyFrameTemplate_OnLoad_SetHeight. Edited: so the background insets and anchors don't overlay and darken the text.
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. Last edited by Fizzlemizz : 05-10-19 at 12:42 AM. |
|
05-10-19, 05:53 AM | #3 |
Thanks :)
First off, Thanks for replying
THANK you so much. I was a little confused as to the whole width height thing, but once i pasted your code in and gave it a test i figured out what was going on.. Thank you again. ^_^ |
|
WoWInterface » Developer Discussions » Lua/XML Help » TitleRegion - Movable Frame on TitleFrame only |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|