Thread Tools Display Modes
07-03-09, 01:01 AM   #1
ilimo
A Deviate Faerie Dragon
Join Date: Jul 2009
Posts: 15
sending/showing information to frame

hello,
i made a frame which has a background and 1 active button
i can send information using out function .
but it send them to chat window

how can i send inofrmation or just showing texts into my main frame area ?



hope i'm clear and this is the right section to post this



thank you for your help
  Reply With Quote
07-03-09, 02:58 AM   #2
ravagernl
Proceritate Corporis
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 1,176
You would need a FontString in your frame to display text.

Can you list your code?
  Reply With Quote
07-03-09, 03:53 AM   #3
ilimo
A Deviate Faerie Dragon
Join Date: Jul 2009
Posts: 15
//this site is mian source : http://fara.webeddie.com/frames/

AD.xml ::

Code:
<Ui xmlns="http://www.blizzard.com/wow/ui/" 
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 xsi:schemaLocation="http://www.blizzard.com/wow/ui/ 
 ..\..\FrameXML\UI.xsd">
  <Script File="AD.lua"/>
<!-- ///////////////////////////////////////////////////////////////////////////////////////// --> 
<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->
<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->
<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->
<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->
<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->
<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->
<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->


<Frame name="AD_GeneralScripts" hidden="true">
  <Scripts>     
	<OnLoad>  
		AD_OnLoad(); 
	</OnLoad>
  </Scripts>
</Frame>  

<!-- ///////////////////////////////////////////////////////////////////////////////////////// --> 
<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->
<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->
<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->
<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->
<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->
<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->
<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->

<Frame name="AD" hidden="true" toplevel="true" virtual="true" frameStrata="DIALOG" parent="UIParent">

    <Size> 
      <!-- dimension of the Frame seen on the screen --> 
      <AbsDimension x="200" y="200"/> 
    </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="32"/>
                </EdgeSize>
                <BackgroundInsets>
                        <AbsInset left="11" right="12" top="12" bottom="11"/>
                </BackgroundInsets>
        </Backdrop>

</Frame>

<!-- ///////////////////////////////////////////////////////////////////////////////////////// --> 
<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->
<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->
    <!-- we now create this frame, which innherits all of the virtual frame "AD" -->
<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->
<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->
<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->
<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->

   <Frame name="AD1" hidden="true" movable="true" inherits="AD">

<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->

    <Layers> 
      <Layer level="ARTWORK"> 
                <FontString name="$parent_Text" inherits="GameFontNormal" text="Click to Move">
                        <Anchors><Anchor point="CENTER"/></Anchors>
                </FontString>
      </Layer>
    </Layers>

<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->

        <Scripts>
            <OnMouseDown> AD1:StartMoving();  </OnMouseDown>
            <OnMouseUp>  AD1:StopMovingOrSizing(); </OnMouseUp>
            <OnDragStop> AD1:StopMovingOrSizing(); </OnDragStop>
        </Scripts> 

<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->

        <Frames>
                <Button name="AD1_Button" inherits="UIPanelButtonTemplate" text="Hello" id="4">
                 <Size>
                   <AbsDimension x="80" y="22"/>
                 </Size>
                 <Anchors>
                          <Anchor point="TOP" relativeTo="AD1" />
                 </Anchors>
                 <Scripts>
                 <OnClick> AD_OnClick(arg1)</OnClick>
                 </Scripts>
                </Button>

        </Frames>

<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->

   </Frame>

<!-- ///////////////////////////////////////////////////////////////////////////////////////// -->

</Ui>


AD.lua :

Code:
function out(text)
 DEFAULT_CHAT_FRAME:AddMessage(text)
 UIErrorsFrame:AddMessage(text, 1.0, 1.0, 0, 1, 10) 
end

function AD_OnLoad()
  out("AD: OnLoad");

  SLASH_AD1 = "/adad";
  SLASH_AD2 = "/ad";
  SlashCmdList["AD"] = function(msg)
		AD_SlashCommandHandler(msg);
	end
	for i=1,20 do
	  local frame = getglobal("AD" .. i)
      if (frame) then
		tinsert(UISpecialFrames, frame)
	  end
	end
end
 
function AD_SlashCommandHandler(msg)
    out("AD: " .. msg)
	if (msg == "0") then
	 ReloadUI();
	end
 	AD_Toggle(msg);
end
 
function AD_Toggle(num)
   local frame = getglobal("AD" .. num)
   if (frame) then
   if(  frame:IsVisible() ) then
      frame:Hide();
   else
      frame:Show();
   end
   end
end

function AD_OnClick(arg1)
   id = this:GetID();
   out("AD: OnClick: " .. this:GetName() .. " ,ID: " .. id .. " ,Button:" ..arg1);


thank you
  Reply With Quote
07-03-09, 04:39 AM   #4
ravagernl
Proceritate Corporis
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 1,176
So what is this addon supposed to do?
  Reply With Quote
07-03-09, 11:43 AM   #5
ilimo
A Deviate Faerie Dragon
Join Date: Jul 2009
Posts: 15
i understand your asking

the aim of this addon is not to do somthing
but simmply understand how addons work

it's just a way of learning

so if you have any idea to make me understad how send texts or infomations
to this frame , well it would be appreciated

  Reply With Quote
07-03-09, 12:37 PM   #6
ilimo
A Deviate Faerie Dragon
Join Date: Jul 2009
Posts: 15
i think one solution could be
make a frame using lua functions : CreateFrame(..)
  Reply With Quote
07-03-09, 01:19 PM   #7
Akryn
A Firelord
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 479
IMO, get rid of the fontsring creation in XML and replace it with this (put it in your OnLoad function):
Code:
local fstring = AD1:CreateFontString()
fstring:SetFont("GameFontNormal", 9)
fstring:SetAllPoints()
fstring:SetText("this is some text")
  Reply With Quote
07-04-09, 06:17 AM   #8
ilimo
A Deviate Faerie Dragon
Join Date: Jul 2009
Posts: 15
done,but how sending information to show in this frame from any function ??
  Reply With Quote
07-04-09, 06:28 AM   #9
ilimo
A Deviate Faerie Dragon
Join Date: Jul 2009
Posts: 15
well it seems that in lua , when you declare in a function a varialbe, it could be reached by any other function; hmmm well i called

fstring:SetText("this is some text")


from another function and it worked,
hmmm

  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » sending/showing information to frame


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off