Thread Tools Display Modes
10-15-13, 08:16 AM   #1
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Editbox

Every time i try to insert a "&" into an editbox with SetText i get a lua error. Is there any special way to do this?

Also is there any way to copy a string to the clipboard by an addon?

Last edited by Resike : 10-15-13 at 08:41 AM.
  Reply With Quote
10-15-13, 11:34 AM   #2
Malsomnus
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Apr 2013
Posts: 203
Not sure about the ampersand, but I'm reasonably certain you can't copy into the clipboard.
You can do what DBM does: open a frame with an edit box that has what you want to copy, already highlighted, so the user can copy it easily.
__________________
SanityCheck - If you've ever said the words "Sorry, I forgot" then you need this add-on.

Remember, every time you post a comment on an add-on, a kitten gets its wings!
  Reply With Quote
10-15-13, 01:24 PM   #3
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Yep, thats what i wanna do in the first place, the copy to clipboard was the workaround for the isse. But seems like you can't do neither of them.
  Reply With Quote
10-15-13, 02:30 PM   #4
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,360
What's the specific error?
  Reply With Quote
10-15-13, 02:34 PM   #5
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by Dridzt View Post
What's the specific error?
I'm not sure since i was trying to do it in xml, and it just breaks the code after the problem.
  Reply With Quote
10-15-13, 02:53 PM   #6
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,360
Check your Logs\FrameXML.log for errors in the xml portion of the game.

Secondly that changes the whole problem since '&' is not a reserved character in Lua but is in xml depending where in the file you tried to use it.

You needed a psychic to divine that btw with how your original post describes the problem :P
  Reply With Quote
10-15-13, 03:14 PM   #7
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by Dridzt View Post
Check your Logs\FrameXML.log for errors in the xml portion of the game.

Secondly that changes the whole problem since '&' is not a reserved character in Lua but is in xml depending where in the file you tried to use it.

You needed a psychic to divine that btw with how your original post describes the problem :P
Yeah sorry i was before an update and i was in a hurry.
Thats weird i had no idea about xml has to do anythign with &.

Anyway i googled the solution now:

http://stackoverflow.com/questions/1...ersands-in-xml

I tought it some blizzard character encoding issues, with special charaters.

Edit: None of them is worked i think somehow the xml parser doesn't recognizes that my "&" is actually in a function string and not the part of the xml stuff.

So i went with lua. However if anyone can figure it out how to do it in xml then cudos.

Last edited by Resike : 10-15-13 at 03:30 PM.
  Reply With Quote
10-15-13, 03:51 PM   #8
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,360
Well since you solved your immediate issue there's not much point.

We'd still need to see the original xml snippet to offer any suggestion for that part.
  Reply With Quote
10-16-13, 04:55 AM   #9
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by Dridzt View Post
Well since you solved your immediate issue there's not much point.

We'd still need to see the original xml snippet to offer any suggestion for that part.
Well it's a pretty basic stuff.

Lua Code:
  1. <EditBox name = "$parentDamnItsAnEditbox" inherits = "InputBoxTemplate" autoFocus = "false">
  2.                 <Size>
  3.                     <AbsDimension x = "280" y = "20"/>
  4.                 </Size>
  5.                 <Anchors>
  6.                     <Anchor point = "TOP">
  7.                         <Offset x = "0" y = "-70"/>
  8.                     </Anchor>
  9.                 </Anchors>
  10.                 <Scripts>
  11.                     <OnLoad>
  12.                         self:SetText("&") -- Code breaks here not load anything after.
  13.                     </OnLoad>
  14.                     <OnEscapePressed>
  15.                         self:ClearFocus()
  16.                     </OnEscapePressed>
  17.                     <OnEnterPressed>
  18.                         self:ClearFocus()
  19.                     </OnEnterPressed>
  20.                 </Scripts>
  21.             </EditBox>
  Reply With Quote
10-16-13, 06:44 AM   #10
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,360
Since it's a static character you could try the utf8 escape sequence.

self:SetText("\38")
  Reply With Quote
10-16-13, 06:45 AM   #11
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
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">
<EditBox name = "$parentDamnItsAnEditbox" inherits = "InputBoxTemplate" autoFocus = "false">
    <Size>
        <AbsDimension x = "280" y = "20"/>
    </Size>
    <Anchors>
        <Anchor point = "TOP">
            <Offset x = "0" y = "-70"/>
        </Anchor>
    </Anchors>
    <Scripts>
        <OnLoad>
            self:SetScript("OnEscapePressed", self.ClearFocus)
            self:SetScript("OnEnterPressed", self.ClearFocus)
            self:SetText("&#x26;")
        </OnLoad>
    </Scripts>
</EditBox>
</UI>
  Reply With Quote
10-16-13, 06:56 AM   #12
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
self:SetText("&amp;") should work too if that would be easier to remember
  Reply With Quote
10-16-13, 04:39 PM   #13
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by Vrul View Post
self:SetText("&amp;") should work too if that would be easier to remember
Hmm that could work i already tried this but with no ";" in it.
  Reply With Quote
10-17-13, 12:53 AM   #14
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by Dridzt View Post
Since it's a static character you could try the utf8 escape sequence.

self:SetText("\38")
This works also.
  Reply With Quote
10-17-13, 02:42 AM   #15
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Resike View Post
Hmm that could work i already tried this but with no ";" in it.
"&amp" is not a valid character entity. The closing semicolon is required.

Also, don't put spaces around equals signs when you're assigning values to attributes inside XML tags, eg. do this:

<Frame name="MyFrame">

and not this:

<Frame name = "MyFrame">

WoW's XML parser may be forgiving of extra spaces, but not all XML parsers are, so it's better to form good habits rather than bad ones.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
10-17-13, 03:47 AM   #16
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by Phanx View Post
"&amp" is not a valid character entity. The closing semicolon is required.

Also, don't put spaces around equals signs when you're assigning values to attributes inside XML tags, eg. do this:

<Frame name="MyFrame">

and not this:

<Frame name = "MyFrame">

WoW's XML parser may be forgiving of extra spaces, but not all XML parsers are, so it's better to form good habits rather than bad ones.
Never run into any problem about this but i guess you're right.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Editbox


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