View Single Post
09-03-15, 10:25 AM   #4
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
You haven't mention SetAdvancedInterfaceOptionsButtons(self) anywhere in the code so I'm not sure where this comes into it.

Your XML creates two checkbuttons called MyFrameCheckBoxOne and MyFrameCheckBoxTwo.

Assuming you want to use this as a template and in this example MyFrameCheckBoxOne is your "parent" and you want a generic way to call ToggleMyOptions for MyFrameCheckBoxTwo every time the parent is clicked then:

Code:
<Frame name="MyFrame" hidden="true" parent="InterfaceOptionsFramePanelContainer" virtual="true">
	<CheckButton name="$parentCheckBoxOne" inherits="InterfaceOptionsCheckButtonTemplate">
		<Anchors>
			<Anchor>
			</Anchor>
		</Anchors>
		<Scripts>
			<OnLoad>
				self:RegisterEvent("PLAYER_ENTERING_WORLD")
				self.panel = "GROUPS_AND_RAID_FINDER"
				self.name = "ParentCheckBox"
				self.root = true
			</OnLoad>
			<OnEvent>
				self:UnregisterEvent("PLAYER_ENTERING_WORLD")
				SetMyOptionsButtons(self)
			</OnEvent>
			<OnClick>
				ToggleMyOptions(self)
				ToggleMyOptions(_G[self:GetParent():GetName().."CheckBoxTwo"])
			</OnClick>
		</Scripts>
	</CheckButton>
	<CheckButton name="$parentCheckBoxTwo" inherits="InterfaceOptionsSmallCheckButtonTemplate">
		<Anchors>
			<Anchor>
			</Anchor>
		</Anchors>
		<Scripts>
			<OnLoad>
				self:RegisterEvent("PLAYER_ENTERING_WORLD")
				self.variable = "variable"
				self.name = "ChildCheckBox"
				self.parent = "ParentCheckBox"
			</OnLoad>
			<OnEvent>
				self:UnregisterEvent("PLAYER_ENTERING_WORLD")
				SetMyOptionsButtons(self)
			</OnEvent>
			<OnClick>
				ToggleMyOptions(self)
			</OnClick>
		</Scripts>
	</CheckButton>
</Frame>
MyFrame is not a great name for a top level frame but I'm assuming it's just an example.

You can also do this all in lua and avoid creating a bunch of global functions and the headache of debugging xml.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 09-03-15 at 10:57 AM.
  Reply With Quote