WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   sending/showing information to frame (https://www.wowinterface.com/forums/showthread.php?t=25166)

ilimo 07-03-09 01:01 AM

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

ravagernl 07-03-09 02:58 AM

You would need a FontString in your frame to display text.

Can you list your code?

ilimo 07-03-09 03:53 AM

//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
:)

ravagernl 07-03-09 04:39 AM

So what is this addon supposed to do?

ilimo 07-03-09 11:43 AM

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

:)

ilimo 07-03-09 12:37 PM

i think one solution could be
make a frame using lua functions : CreateFrame(..)

Akryn 07-03-09 01:19 PM

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")


ilimo 07-04-09 06:17 AM

done,but how sending information to show in this frame from any function ??

ilimo 07-04-09 06:28 AM

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

:cool:


All times are GMT -6. The time now is 07:07 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI