Editbox under slider
Hi. Can I create a slider like this, with the yellow title at the top and the editbox bottom without ace libraries ? If so, how should I proceed?
|
Yeah sure. Just create a slider first and after that editbox under it.
Combine: local slider = CreateFrame("Slider", "MySlider", nil, "OptionsSliderTemplate") slider:SetWidth(144) slider:SetHeight(17) slider:SetOrientation("HORIZONTAL") slider:SetThumbTexture("Interface\\Buttons\\UI-SliderBar-Button-Horizontal") slider:SetMinMaxValues(1,100) slider:SetValueStep(1) slider:SetValue(1) slider.tooltipText = 'Set the size of the note' getglobal(slider:GetName() .. 'Low'):SetText('Left') getglobal(slider:GetName() .. 'High'):SetText('Right') getglobal(slider:GetName() .. 'Text'):SetText('Text!') slider:SetScript("OnValueChanged", function(self, newvalue) UpdateMySlider() end) and local editbox = CreateFrame("EditBox", "MyEditBox", nil) editbox:SetPoint("TOP") editbox:SetPoint("LEFT") editbox:SetPoint("RIGHT") editbox:SetHeight(100) editbox:SetFontObject(GameFontHighlightSmall) editbox:SetTextInsets(2,2,2,2) editbox:SetMultiLine(false) editbox:SetAutoFocus(true) editbox:SetScript("OnEscapePressed", function() editbox:ClearFocus() end) editbox:SetScript("OnEditFocusLost", function(self) editbox:ClearFocus() end) editbox:SetScript("OnShow", function(self) self:SetText("") self:SetFocus() end) Tweak and tune the rest. |
As I build four similar slider in xml, there is a container (frame?) where put everything inside to be used as a model to inherit?
|
Create a new <frame> tag, add the virtual attribute, and place your stuff into <Frames></Frames> within the new frame.
Then use the new frame to inherit from. |
The editbox beneath the slider in ace3 libraries what inherits? I would reproduce the same smooth frame , but I have no idea how to do it :confused:
|
It doesn't inherits from something. They build those widgets from a scratch:
Lua Code:
|
In XML
Code:
... |
Why in gods name are you using xml?
Also, you're creating a global called "editbox", that will definitely create some issues! |
If you really want to use XML (probably because you hate kittens, yourself, life, and the universe in general) then you should be aware that all of your OnLoad, OnEvent, etc. scripts receive the same arguments that those script receive when you define them in Lua. The first argument is always a variable named "self" that refers to the frame. So, you do not need to use your frame's global name inside the script. Just use "self" to refer to it.
But really, don't use XML. It's horrible. |
Could you at least tell me what is the equivalent of SetBackdropBorderColor in XML? :o
|
Code:
editbox:SetBackdrop(ManualBackdrop) Code:
editbox:SetBackdrop({ |
If I want solid color instead of texture?
|
Quote:
Lua Code:
I personally use this for normal EditBoxes, you can remove the title and resize it for sliders if you want: Lua Code:
|
Quote:
|
Your other option for a solid background would be to use a simple texture instead of a "real" backdrop. This would create a 50% opaque red background:
Code:
local bg = frame:CreateTexture(nil, "BACKGROUND") -- does not need a global name |
From this page: "Backdrops are deprecated in favour of the new tiling mechanisms". What it the new tiling mechanism?
|
Backdrops weren't deprecated after all (they're still widely used in the default UI, and work just as they always have) but the "tiling mechanism" is the ability for textures to be tiled. Let's say you have a frame that's 400px square, and a texture file that's 100px square.
Code:
local tex = frame:CreateTexture(nil, "BACKGROUND") Code:
tex:SetHorizTile(true) Code:
tex:SetVertTile(true) There's no way to control the tile size; it will always use the real pixel dimensions of the source file. The idea was that Blizzard was going to use this, plus a series of individual textures to make up the border, and they do use this system on some newer things like the battle pet tooltip, but backdrops are still a thing. |
Since i'm pretty sure i'll need this in the future here is a lua only fancy slider, it's pretty basic yet but still much better then the blizzard ones.
Lua Code:
|
All times are GMT -6. The time now is 03:55 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI