• 0

    posted a message on Frame inheiritance problem
    Quote from Xinhuan
    Fix your code:
    <OnClick>
        <!--AreYouReadyConfig_RadioButton1:SetChecked(1)
        ChatFrame1:AddMessage(self:GetName())-->
        self:SetChecked(1)
        ChatFrame1:AddMessage(self:GetName())
        outtype=0
    </OnClick>
    Note that your code makes outtype a global here. Also in this case, the checkbox gets set checked everytime. All :GetName() returns is a string, you can't call :SetChecked() on a string.



    How would I uncheck the other buttons this way now?
    Posted in: Need Help?
  • 0

    posted a message on Frame inheiritance problem
    Now I would expect this to work and solve all of my problems, but of course it doesn't

        <CheckButton name="$parent_RadioButton1" inherits="SendMailRadioButtonTemplate" id="17">
                            <Anchors>
                                    <Anchor point="TOPLEFT">
                                            <Offset>
                                                    <AbsDimension  x="23" y="-150"/>
                                            </Offset>
                                    </Anchor>
                            </Anchors>
                            <Scripts>
    				<OnClick>
    					<!--AreYouReadyConfig_RadioButton1:SetChecked(1)
    					ChatFrame1:AddMessage(self:GetName())-->
    					self:GetName():SetChecked(1)
    					self:GetName():SetChecked(nil) 
    					self:GetName():SetChecked(nil) 
    					ChatFrame1:AddMessage(self:GetName())
    					outtype=0
                                    </OnClick>
                            </Scripts>
    	</CheckButton>
    Posted in: Need Help?
  • 0

    posted a message on Frame inheiritance problem
    I'm not sure that you solved my problem exactly, let me explain what my situation is.

    My addon is used for multiple classes, and each class has a seperate frame for options, each frame inheirits the same three radiobuttons. However the problem is radiobuttons need to have OnClick that sets the other buttons to unticked and the clicked button to checked (just so it can't be unchecked).

    If the name of the button is using $parent then I don't know how the template frame can do the onclick stuff when $parent can be different things.
    Posted in: Need Help?
  • 0

    posted a message on Frame inheiritance problem
    Quote from Phanx
    The problem is that your template frame has sub-frames with static names. So, the first frame you create from the template has a sub-frame named "RadioButton1", and the second frame you create from the template also has a sub-frame named "RadioButton1". The second one's name overwrites the first in the global namespace, so when you click on either one, and your script looks for "RadioButton1", it only finds (and affects) the second one.


    Well the reason I did this is because want the setting of the radiobuttons to be saved variables and they have to be properly set each time so would that only be possible if I just made them $parent_RadioButton1,2,3 and set if they're checked/unchecked for every frame?

    And also how would I use OnClick for the template when it depends on which frame is being used?
    Posted in: Need Help?
  • 0

    posted a message on Frame inheiritance problem
    I was wondering if theres any problems with two frames inheiriting the same buttons because I'm doing this and the OnClick only works for one of the two frames here the code

    <Frame name="AreYouReady" hidden="true" toplevel="true" virtual="true" parent="UIParent" frameStrata="DIALOG">    <Size> 
          <AbsDimension x="260" y="260"/> 
        </Size> 
        <Anchors> 
    		<Anchor point="CENTER" /> 
        </Anchors> 
           <Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true">
                    <TileSize>
                            <AbsValue val="32"/>
                    </TileSize>
                    <EdgeSize>
                            <AbsValue val="26"/>
                    </EdgeSize>
                    <BackgroundInsets>
                            <AbsInset left="9" right="10" top="10" bottom="9"/>
                    </BackgroundInsets>
            </Backdrop>
        <Layers> 
          <Layer level="BACKGROUND"> 
            <Texture name="$parent_Background" setAllPoints="true">
              <Color r="0" g="0" b="0" a="0.4" /> 
            </Texture> 
          </Layer> 
          <Layer level="ARTWORK"> 
    	   	<FontString name="$parent_Text" inherits="GameFontNormal" text="|cFF00CCFFAreYouReady|r">
    			<Anchors>
    			  <Anchor point="LEFT" relativePoint="TOPLEFT">
    				<Offset>
    					<AbsDimension x="13" y="-20"/>
    				</Offset>
    			  </Anchor>
    			</Anchors>
    		</FontString>
          </Layer> 
          <Layer level="ARTWORK"> 
    	   	<FontString name="ChatTextOnly" inherits="GameFontNormal" text="Chat text only">
    			<Anchors>
    			  <Anchor point="LEFT" relativePoint="TOPLEFT">
    				<Offset>
    					<AbsDimension x="42" y="-157"/>
    				</Offset>
    			  </Anchor>
    			</Anchors>
    		</FontString>
          </Layer> 
             <Layer level="ARTWORK"> 
    	   	<FontString name="ErrorFrameOnly" inherits="GameFontNormal" text="Error frame message only">
    			<Anchors>
    			  <Anchor point="LEFT" relativePoint="TOPLEFT">
    				<Offset>
    					<AbsDimension x="42" y="-177"/>
    				</Offset>
    			  </Anchor>
    			</Anchors>
    		</FontString>
          </Layer> 
          <Layer level="ARTWORK"> 
    	   	<FontString name="Both" inherits="GameFontNormal" text="Both">
    			<Anchors>
    			  <Anchor point="LEFT" relativePoint="TOPLEFT">
    				<Offset>
    					<AbsDimension x="42" y="-197"/>
    				</Offset>
    			  </Anchor>
    			</Anchors>
    		</FontString>
          </Layer> 
        </Layers> 
        <Frames>
        <CheckButton name="RadioButton1" inherits="SendMailRadioButtonTemplate" id="17">
                            <Anchors>
                                    <Anchor point="TOPLEFT">
                                            <Offset>
                                                    <AbsDimension  x="23" y="-150"/>
                                            </Offset>
                                    </Anchor>
                            </Anchors>
                            <Scripts>
                                    <OnClick>
    					RadioButton1:SetChecked(1)
    					RadioButton2:SetChecked(nil) 
    					RadioButton3:SetChecked(nil) 
    					ChatFrame1:AddMessage("EXAMPLE")
    					outtype=0
                                    </OnClick>
                            </Scripts>
    	</CheckButton>
                    <CheckButton name="RadioButton2" inherits="SendMailRadioButtonTemplate" id="18">
                            <Anchors>
                                    <Anchor point="TOPLEFT">
                                            <Offset>
                                                    <AbsDimension  x="23" y="-170"/>
                                            </Offset>
                                    </Anchor>
                            </Anchors>
                            <Scripts>
                                    <OnClick>
    					RadioButton2:SetChecked(1)
                                            RadioButton1:SetChecked(nil) 
    					RadioButton3:SetChecked(nil) 
    					UIErrorsFrame:AddMessage("EXAMPLE",1.0,1.0,0,1,10)
    					outtype=1
                                    </OnClick>
                            </Scripts>
                    </CheckButton>
    		<CheckButton name="RadioButton3" inherits="SendMailRadioButtonTemplate" id="19">
                            <Anchors>
                                    <Anchor point="TOPLEFT">
                                            <Offset>
                                                    <AbsDimension  x="23" y="-190"/>
                                            </Offset>
                                    </Anchor>
                            </Anchors>
                            <Scripts>
                                    <OnClick>
    					RadioButton3:SetChecked(1)
    					RadioButton2:SetChecked(nil) 
    					RadioButton1:SetChecked(nil) 
    					UIErrorsFrame:AddMessage("EXAMPLE",1.0,1.0,0,1,10)
    					ChatFrame1:AddMessage("EXAMPLE")
    					outtype=2
                                    </OnClick>
                            </Scripts>
                    </CheckButton>
    	</Frames>
      </Frame>
    Posted in: Need Help?
  • To post a comment, please or register a new account.