Posted by Equalibrium on Thu, 01 Oct 2009 16:09:39
In Lua, how do I create a multi-line edit box? I am specifically having trouble with the graphical portion. There are a couple different ways, but everything I have tried has at least SOMETHING wrong visually that makes it either not work or look glitched to a user. To point at an example of what I want, I would like to carbon-copy the text entry box in the /macro window. I'll need a couple of these for my addon, with variable dimensions for the frames. And again, I'm not having trouble making the editbox per-say, I'm having trouble making the image of an editbox in the location where the editbox resides.
Note: I have asked all over the place, from the #wowuidev IRC to the wow forums about this. The explanations have either been intended to lead me in the right direction, or have simply been misplaced (wrote code, didn't test, no response when I point that out)... I've had a bit of luck on this forum in the past, so now I'm trying here. Sadly, this has put the relevant addon development on hold for the last month or so :(
Posted by jnwhiteh on Wed, 07 Oct 2009 18:29:12
You might find WowLua (addon on wowinterface) to be useful. It does something like this, and I'd be able to answer specific questions about it rather than hypothetical. I'm not really sure what your issue is, so it's very difficult to give you the "solution".
Posted by Equalibrium on Wed, 07 Oct 2009 19:40:59
Wowlua is written combining XML and Lua. Sadly, that makes it unhelpful. Here is what I have, more or less:
FormMultiBox = CreateFrame("EditBox", FormMultiBox, parentFrame)
Form_MultiBox:SetHeight(85) Form_MultiBox:SetWidth(270) Form_MultiBox:SetPoint("TOPLEFT", parentFrame, "TOPLEFT", 40, -285) Form_MultiBox:SetMaxLetters(255) Form_MultiBox:SetMultiLine(true) Form_MultiBox:SetTextInsets(5, 5, 2, 2)
Now, I want some sort of visual box, similar in looks to that of the MLEB in the macro creation interface, or the script-typing place in WoWLua (but their frames are coded in XML, so I can't use them as a reference).
Note that, if I run a slightly more complete version of the above, I can type into a location, and the text will display, but there will be no visual cues as to the area, location, or capacity of the editbox for the user.
Again, I am simply trying to apply a visual to this frame. I might be missing a couple lines from above, but everything in my code after what I've C&P'd is attempts at creating the visual, boxed background (texture?) or a multi-line editbox.
If you're not sure of what I am talking about still: boot up WoW. Type /macro. Hit new macro, pick an icon, make a name, and type the first line of that macro. Stop. That first line of information is inside a multi-line editbox, one that is (dimensions and XML frame-creation aside) IDENTICAL to the frame I am trying to create. The text is contained within this box, if I knew the frame's name I could type: zomg = framename:GetText() and zomg would be a string of the text I had typed.
If that's still confusing, I will go collect a screenshot -.-
TLDR: I want to create a visual for the editbox frame I'm working with. I want to do so in Lua, without using any XML for frame definitions.
Posted by jnwhiteh on Mon, 12 Oct 2009 09:50:46
Why on earth are you so vehemently avoiding XML? It's there for a reason, and you have a number of references that show you how to accomplish what you're trying to do.
There's no sense in limiting yourself, and there's no reason to avoid XML for something like this. Also, you can do a direct translation from any XML code to Lua code.. it's a straightforward transformation.
I don't have an "answer" to your problem.. because you already have a few solutions that you can use as references. That's all I would do, honestly.
Posted by Equalibrium on Tue, 13 Oct 2009 23:27:30
I have looked at XML definitions of how-to's for coding the visual frame on an editbox. I don't understand the translation. I've already written quite a bit of code without XML (at the express encouraging of many of the people who helped me figure out the code I've got so far, including people from #wowuidev and the wow forums), so if I suddenly switch to XML I either have to go back and re-write quite a bit (which isn't inherently a block preventing me from trying it, just a discouraging factor), or I have to figure out how to integrate a couple copy/pasted XML frames with several other Lua frames.
Either way, I'm discouraged by the fact that I've only found one or two examples, and neither map very clearly to what I'm trying for. I've even looked at some of the code for the wow interface that should use a similar process, and I was still confused.
I guess you don't owe me an explanation, but thusfar you're one of the only people to respond to this question in the slightest. Maybe if you could point me at some material that goes over this (is it in your book? I couldn't find it), I'll be able to figure it out better. As it is, I'd already looked everywhere I could think of before I turned to online forums for help. :(
Posted by jnwhiteh on Wed, 14 Oct 2009 07:02:48
Chapter 16 covers some bits about writing addons without XML, but it obviously can't show every single translation from one form of code (xml) to another. We need to do one of two things, you either need to post your entire code somewhere and show what is going wrong, or you need to post an XML snippet and I can show you how to transform that to Lua.
You're overstating a bit how much adding a single component that uses XML would 'cost' you, but I'm willing to help as much as I can. I just don't have the information I need to even begin to start, even if I was overflowing with free time.
Posted by Equalibrium on Wed, 14 Oct 2009 20:17:54
I think I understand what I'll need to do to explain my question a bit better, I just don't have time to get to it right now. I'll post again when I get things together. I'd be willing to pastey my entire code at some point, but I'm pretty sure I don't need to. Actually, in a different addon I spent the weekend working on, I think I've figured out a nice workaround by editing the bgData object I was trying to use to create my background. The thing that's been throwing me is something someone said on the wow forums about a function that "stretches pixels" (which bgData objects do anyways, but they were referring to JUST the horizontal direction). That probably sounds a little crazy unless it sparks a sudden understanding ;P
Anyways, thanks for the feedback. I will return to this as soon as I have the time.