|
05-20-17, 12:53 PM | #1 |
Creating a frame within a frame
Hello, I am trying to create a dropdown menu using this tutorial http://wow.gamepedia.com/Using_UIDropDownMenu
But instead of having in on UIParent, I want to stick it inside my addon frame. Here's my code, i changed 'UIParent' to 'Main' (my frame) as 3rd argument but the list is still drawn on on parent. I tried I to write 'Main:CreateFrame...' but the dropdown list dissapears completely. lua Code:
Last edited by Asalas77 : 05-20-17 at 01:03 PM. |
|
05-20-17, 01:38 PM | #2 |
If Main is the name of your frame, it needs to be enclosed within quotes. (and you should use a more unique name to avoid potential namespace conflict) Otherwise, the Main variable is not available in this scope.
If that doesn't help, you should include all of your code, including the Main frame.
__________________
Grab your sword and fight the Horde! |
|
05-20-17, 01:56 PM | #3 |
Ok so here's the full code.
lfg.lua Lua Code:
lfg.xml Code:
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Script file="lfg.lua" /> <Frame name="Main" movable="true" enableMouse="true"> <Size x="200" y="325" /> <Anchors> <Anchor point="CENTER" x="0" y="0" /> </Anchors> <Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true"> <BackgroundInsets> <AbsInset left="10" right="10" top="10" bottom="10" /> </BackgroundInsets> <TileSize> <AbsValue val="32" /> </TileSize> <EdgeSize> <AbsValue val="32" /> </EdgeSize> </Backdrop> <Layers> <Layer level="OVERLAY"> <FontString inherits="GameFontNormalSmall" text="Raid"> <Anchors> <Anchor point="TOPLEFT" x="20" y="-20" /> </Anchors> </FontString> <FontString inherits="GameFontNormalSmall" text="Tank"> <FontHeight val="10"/> <Anchors> <Anchor point="TOPLEFT" x="20" y="-60" /> </Anchors> </FontString> <FontString inherits="GameFontNormalSmall" text="Heal"> <Anchors> <Anchor point="TOPLEFT" x="20" y="-80" /> </Anchors> </FontString> <FontString inherits="GameFontNormalSmall" text="Dps"> <Anchors> <Anchor point="TOPLEFT" x="20" y="-100" /> </Anchors> </FontString> <FontString inherits="GameFontNormalSmall" text="Min GS"> <Anchors> <Anchor point="TOPLEFT" x="20" y="-160" /> </Anchors> </FontString> <FontString inherits="GameFontNormalSmall" text="Info"> <Anchors> <Anchor point="TOPLEFT" x="20" y="-180" /> </Anchors> </FontString> <FontString inherits="GameFontNormalSmall" text="Teamspeak"> <Anchors> <Anchor point="TOPLEFT" x="20" y="-140" /> </Anchors> </FontString> <FontString inherits="GameFontNormalSmall" text="Channel name"> <Anchors> <Anchor point="TOPLEFT" x="20" y="-220" /> </Anchors> </FontString> <FontString inherits="GameFontNormalSmall" text="Auto send"> <Anchors> <Anchor point="TOPLEFT" x="20" y="-240" /> </Anchors> </FontString> <FontString inherits="GameFontNormalSmall" text="Msg delay"> <Anchors> <Anchor point="TOPLEFT" x="20" y="-260" /> </Anchors> </FontString> </Layer> </Layers> <Frames> <Button name="10_Button" inherits="UIPanelButtonTemplate" text="10"> <Size x="30" y="15" /> <NormalFont style="GameFontNormalSmall"/> <Anchors> <Anchor point="TOPLEFT" x="100" y="-40" /> </Anchors> <Scripts> <OnClick> Button10_OnClick() </OnClick> </Scripts> </Button> <Button name="25_Button" inherits="UIPanelButtonTemplate" text="25"> <Size x="30" y="15" /> <NormalFont style="GameFontNormalSmall"/> <Anchors> <Anchor point="TOPLEFT" x="140" y="-40" /> </Anchors> <Scripts> <OnClick> Button25_OnClick() </OnClick> </Scripts> </Button> <Button name="tankMinus" inherits="UIPanelButtonTemplate" text="-"> <Size x="15" y="15" /> <Anchors> <Anchor point="TOPLEFT" x="100" y="-60" /> </Anchors> <Scripts> <OnClick> tankMinus_OnClick() </OnClick> </Scripts> </Button> <Button name="tankPlus" inherits="UIPanelButtonTemplate" text="+"> <Size x="15" y="15" /> <Anchors> <Anchor point="TOPLEFT" x="160" y="-60" /> </Anchors> <Scripts> <OnClick> tankPlus_OnClick() </OnClick> </Scripts> </Button> <Button name="healMinus" inherits="UIPanelButtonTemplate" text="-"> <Size x="15" y="15" /> <Anchors> <Anchor point="TOPLEFT" x="100" y="-80" /> </Anchors> <Scripts> <OnClick> healMinus_OnClick() </OnClick> </Scripts> </Button> <Button name="healPlus" inherits="UIPanelButtonTemplate" text="+"> <Size x="15" y="15" /> <Anchors> <Anchor point="TOPLEFT" x="160" y="-80" /> </Anchors> <Scripts> <OnClick> healPlus_OnClick() </OnClick> </Scripts> </Button> <Button name="dpsMinus" inherits="UIPanelButtonTemplate" text="-"> <Size x="15" y="15" /> <Anchors> <Anchor point="TOPLEFT" x="100" y="-100" /> </Anchors> <Scripts> <OnClick> dpsMinus_OnClick() </OnClick> </Scripts> </Button> <Button name="dpsPlus" inherits="UIPanelButtonTemplate" text="+"> <Size x="15" y="15" /> <Anchors> <Anchor point="TOPLEFT" x="160" y="-100" /> </Anchors> <Scripts> <OnClick> dpsPlus_OnClick() </OnClick> </Scripts> </Button> <Button name="closeButton" inherits="UIPanelButtonTemplate" text="Close"> <Size x="80" y="20" /> <NormalFont style="GameFontNormalSmall"/> <Anchors> <Anchor point="TOPLEFT" x="100" y="-290" /> </Anchors> <Scripts> <OnClick> MinimapButton_OnClick() </OnClick> </Scripts> </Button> <Button name="sendButton" inherits="UIPanelButtonTemplate" text="Send"> <Size x="80" y="20" /> <NormalFont style="GameFontNormalSmall"/> <Anchors> <Anchor point="TOPLEFT" x="20" y="-290" /> </Anchors> <Scripts> <OnClick> sendButton_OnClick(); </OnClick> </Scripts> </Button> <EditBox name="tankCount" autoFocus="false" inherits="InputBoxTemplate"> <Size x="20" y="20" /> <Anchors> <Anchor point="TOPLEFT" x="130" y="-57.5" /> </Anchors> </EditBox> <EditBox name="healCount" autoFocus="false" inherits="InputBoxTemplate"> <Size x="20" y="20" /> <Anchors> <Anchor point="TOPLEFT" x="130" y="-77.5" /> </Anchors> </EditBox> <EditBox name="dpsCount" autoFocus="false" inherits="InputBoxTemplate"> <Size x="20" y="20" /> <Anchors> <Anchor point="TOPLEFT" x="130" y="-97.5" /> </Anchors> </EditBox> <EditBox name="delay" autoFocus="false" inherits="InputBoxTemplate"> <Size x="20" y="20" /> <Anchors> <Anchor point="TOPLEFT" x="130" y="-257.5" /> </Anchors> </EditBox> <EditBox name="gs" autoFocus="false" inherits="InputBoxTemplate"> <Size x="40" y="20" /> <Anchors> <Anchor point="TOPLEFT" x="120" y="-157.5" /> </Anchors> </EditBox> <EditBox name="info" autoFocus="false" inherits="InputBoxTemplate"> <Size x="80" y="20" /> <Anchors> <Anchor point="TOPLEFT" x="100" y="-177.5" /> </Anchors> </EditBox> <EditBox name="channel" autoFocus="false" inherits="InputBoxTemplate"> <Size x="80" y="20" /> <Anchors> <Anchor point="TOPLEFT" x="100" y="-217.5" /> </Anchors> </EditBox> <CheckButton name="teamspeakCheck" inherits="UICheckButtonTemplate" id="1"> <Size x="20" y="20" /> <Anchors> <Anchor point="TOPLEFT" x="127.5" y="-137.5" /> </Anchors> </CheckButton> <CheckButton name="autosendCheck" inherits="UICheckButtonTemplate" id="2"> <Size x="20" y="20" /> <Anchors> <Anchor point="TOPLEFT" x="127.5" y="-237.5" /> </Anchors> </CheckButton> </Frames> <Scripts> <OnLoad> tinsert(UISpecialFrames, self:GetName()); OnLoad(); self:RegisterForDrag("LeftButton"); tankCount:SetScript("OnEscapePressed", function(self) self:ClearFocus() end) healCount:SetScript("OnEscapePressed", function(self) self:ClearFocus() end) dpsCount:SetScript("OnEscapePressed", function(self) self:ClearFocus() end) </OnLoad> <OnDragStart> self:StartMoving(); </OnDragStart> <OnDragStop> self:StopMovingOrSizing(); </OnDragStop> </Scripts> </Frame> <Button name="MinimapButton" parent="Minimap" movable="true" enableMouse="true"> <Size> <AbsDimension x="33" y="33" /> </Size> <Anchors> <Anchor point="TOPLEFT" /> </Anchors> <Layers> <Layer level="BACKGROUND"> <Texture name="MyMod_MinimapButton_Icon" file="Interface\Icons\INV_Misc_QuestionMark"> <Size> <AbsDimension x="21" y="21" /> </Size> <Anchors> <Anchor point="TOPLEFT"> <Offset> <AbsDimension x="7" y="-6" /> </Offset> </Anchor> </Anchors> </Texture> </Layer> <Layer level="OVERLAY"> <Texture file="Interface\Minimap\MiniMap-TrackingBorder"> <Size> <AbsDimension x="56" y="56" /> </Size> <Anchors> <Anchor point="TOPLEFT" /> </Anchors> </Texture> </Layer> </Layers> <Scripts> <OnLoad> this:RegisterForClicks("LeftButtonUp","RightButtonUp") </OnLoad> <OnClick> MinimapButton_OnClick() </OnClick> </Scripts> <HighlightTexture file="Interface\Minimap\UI-Minimap-ZoomButton-Highlight" alphaMode="ADD" /> </Button> </Ui> Sorry if this is some basic stuff I'm missing, I just started learning lua today. |
|
05-20-17, 02:02 PM | #4 |
Probably need to see toc file as well.
|
|
05-20-17, 02:04 PM | #5 |
There's really not much to it.
Code:
## Title: LFG Assistant ## Version: 1.0 ## Author: adamz ## Interface: 30300 lfg.xml |
|
05-21-17, 01:40 AM | #6 | |
Oops, Ketho also made the same comment :-)
__________________
Better to fail then never have tried at all. |
||
05-20-17, 03:59 PM | #7 |
Your script file loads before the Main frame is created. One way to fix it that require minimal change would be to add raidDrop:SetParent(Main) to OnLoad. Might need to do SetPoint after that. Not sure.
__________________
Grab your sword and fight the Horde! |
|
05-20-17, 04:50 PM | #8 |
ok that worked thank you for your help
|
|
05-20-17, 05:14 PM | #9 |
05-21-17, 02:20 AM | #10 |
Yeah, I'm writing this for WotLK
|
|
05-21-17, 04:53 AM | #11 | |
Please note that
|
||
05-21-17, 12:01 PM | #12 |
What he said ^^.
|
|
WoWInterface » Developer Discussions » Lua/XML Help » Creating a frame within a frame |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Switch to Linear Mode |
Hybrid Mode |
Switch to Threaded Mode |
|
|