Giter Club home page Giter Club logo

stdui's People

Contributors

doadin avatar dotrich avatar jakobud avatar kaminariss avatar liangyuxuan avatar pwilkowski avatar sragia avatar wipie avatar wutname1 avatar x157 avatar xatan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

stdui's Issues

Creating Tabs / fil them? :)

Hey guys,

So I try to create Tabs with your GUI, not sure if they completly in yet.
I am curious, how I fil the Tabs with Content or how I can redesign the Buttons? Also if I do a 4 Tab Menu, the 4th Button seems not to work.

Also I am curious if there is a way to make "General Settings" Global and 2/3/4 Settings class Specific? :)

Hope you guys can Show me a example :) Thanks

My example Code is:

local function TestMenu()

local tabs = {

{
name = 'firstTab',
title = 'General Settings',

},
{
name = 'secondTab',
title = TEstSettings',
},
{
name = 'thirdTab',
title = Test Settings'
},
{
name = 'thirdTab',
title = Test Settings'
}
}
local window = StdUi:TabPanel(UIParent, 700, 500, tabs, vertical)
window:SetPoint('CENTER');

end

Text-Table documentation

Hey,
i love working with your library, but I encountered a problem, that my text table was completely empty, except for the header. After reading the source of the text table, if found out, that the header field has to be named index instead of dataIndex. Unfortunately dataIndex is the documented field (https://github.com/kaminaris/StdUi/wiki/Text-Table). Keep up the good work.

Lua Error when hovering on Muilt Line Editbox

I tried to use StdUi in my addon. When I was testing with AuctionFaster enabled and hovering mouse on my addon's window's buttons, I got this lua error. But I failed to reproduce when I do the same thing on AuctionFaster's window.

UPDATE: I was wrong about this. This lua error can be reproduced by hovering on Muilt Line Editbox, but not buttons. And reproduceable with only one StdUi loaded.

5x AuctionFaster\Libs\StdUi\StdUi-4.lua:90: attempt to index field 'stdUi' (a nil value)
[string "@AuctionFaster\Libs\StdUi\StdUi-4.lua"]:90: in function <AuctionFaster\Libs\StdUi\StdUi.lua:81>

Locals:
self = <unnamed> {
 panel = <unnamed> {
 }
 0 = <userdata>
 scrollFrame = <unnamed> {
 }
}
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = "attempt to index field 'stdUi' (a nil value)"

This is my code.

local StdUi = LibStub('StdUi')
local window = StdUi:Window(UIParent, 600, 400, 'Paste')
window:SetPoint('CENTER')
StdUi:EasyLayout(window, { padding = { top = 40 } })

local editbox = StdUi:MultiLineBox(window, 200, 300, '')
local button = StdUi:Button(window, nil, 20, "Execute")
button:SetScript('OnClick', function()
    -- blablabla
end)

window:AddRow():AddElement(editbox)
window:AddRow():AddElement(button)
window:DoLayout()

Action Buttons in a ContextMenu need the Click to go to the OnClick handler, not the OnMouseUp handler

Blizzard have changed Action Buttons in Dragonflight Beta so that the Down argument is not passed to its OnClick handler.
This is to support the new Press and Hold action button repeated casting implementation.
This means that Action Buttons now only work if they register and handle the Up state of the mouse button.
That is, itemFrame:RegisterForClicks("LeftButtonUp") for type1 / macrotext1 action button, for example.
However, the ContextMenu uses an OnMouseUp handler to intercept the Up mouse click to close a context menu item.
The problem is that the OnMouseUp handler eats the Action Button Click before it gets to the standard Action Button OnClick handler.
So the Action Button macro/spell does not get executed and it fails silently.
The proposed solution is to set "data.hookOnClickIndicator = true" when defining a menu item which is constructed with a SecureActionButton.
The data.hookOnClickIndicator will not be set by any existing addons which use StdUi lib.
So this meta-data-driven approach ensures that only new addons which choose to use the custom data.constructor and data.hookOnClickIndicator setting will create custom Action Buttons.
This ensures that the Context Menu will Hook the OnClick handler (to receive the Click after the Action Button has executed the macro/spell),
instead of Set the OnMouseUp handler (which eats the Click), to close a menu item context.

The proposed coding change to the ContextMenu CreateItem method is simply:

	if data.hookOnClickIndicator then
		itemFrame:HookScript('OnClick', ContextMenuItemOnMouseUp)
	else
		itemFrame:SetScript('OnMouseUp', ContextMenuItemOnMouseUp)
	end

This has been tested with Context Menus which have a mixture of menu item Action Buttons which inherit SecureActionButonTemplate and normal menu item buttons.
Both types of menu item buttons co-exist in a ContextMenu and behave as expected, with no side-effects.
The change has backwards compatibility with existing addons that use StdUi lib.

Dragonflight Bug: Button Constructor sets Highlight Texture to Nil

Line 112 of Button.lua
button:SetHighlightTexture(nil);
causes a lua error that the SetHighlightTexture(nil) call is invalid syntax.
I guess blizzard check the arguments passed in now and a nil argument is invalid.

Please fix this urgently so that all addons using the StdUi library will have the fix installed, to prevent breaking other addons using StdUi.
This can be tested in the Dragonflight 10.0 Beta or PTR now.

Question regarding code annotations

I have been using Ketho's WoW API to add more IntelliSense and better lining into VS Code (https://marketplace.visualstudio.com/items?itemName=ketho.wow-api) I see StdUi has some form of linting, but it is not compatible with the current EmmyLua implementation in VS Code. Is it simply out of date and could I open a PR to add better support for StdUi or is it meant for a different linter engine to utilize? Changes I have made so far to resolve most issues: Wutname1@3b5c0eb

Action Buttons as Context Menu items need to have a Name and a Template

A custom constructor & custom renderer are required to construct & update/display SecureActionButtons with a Name and also inherit from SecureActionButtonTemplate, to be used as ContextMenu items which can execute a macro or cast a spell etc.
This is needed to allow a user to quickly execute restricted/protected commands/macros/spells via an easy-to-use popup ContentMenu with Action Buttons in the menu items.
This provides a lot of power to a UI and makes the UI fast and easy to use, in an object-oriented context-sensitive manner.

Dynamic Context Menu

I have a function, that generates me an option list, for a context menu. Unfortunately the callback for the context menu entry is only generated on creation, so that the DrawOptions() call updates the text, but not the behavior. The same goes for custom, which is only set on creation and also the events, if someone is overriding them Me for example, to change the text color OnEnter/OnLeave (Which would also be nice to be an option in the context menu. I use SetTextColor with a configured highlightTextColor.)

Out of the box resizable windows, etc

I have been messing with how to make Windows resizable. You gotta do this essentially:

local window = StdUi:Window(UIParent, 500, 500, 'Title');
window:SetResizable(true);
window:SetPoint('CENTER');

local resizeAnchor = CreateFrame("Button", nil, window)
resizeAnchor:SetSize(16, 16)
resizeAnchor:SetPoint("BOTTOMRIGHT", window, "BOTTOMRIGHT")
resizeAnchor:SetNormalTexture("Interface\\ChatFrame\\UI-ChatIM-SizeGrabber-Up")
resizeAnchor:SetHighlightTexture("Interface\\ChatFrame\\UI-ChatIM-SizeGrabber-Up")
resizeAnchor:SetPushedTexture("Interface\\ChatFrame\\UI-ChatIM-SizeGrabber-Down")
resizeAnchor:SetScript("OnMouseDown", function(self, button)
    if button == "LeftButton" then
        window:StartSizing("BOTTOMRIGHT")
        window:SetUserPlaced(true)
    end
end)
resizeAnchor:SetScript("OnMouseUp", function(self, button)
    if button == "LeftButton" then
        window:StopMovingOrSizing()
    end
end)

I would like to work on adding this functionality directly into the Window widget so that it just works without doing all this extra. Something like this:

window:SetResizable(true, { direction: "BOTTOMRIGHT"});

And then it would just set up all the scripting and resize anchor frame creation and everything behind the scenes. Is this something you'd be interested in seeing added in? I'm not a pro LUA developer but I don't think it would be too complicated. I think I could handle it.

Are there any Widgets besides Window that this would make sense to add to? Should this functionality be added to the Window widget or the Frame?

Haunted borders

Just borders randomly becoming bold on random edges. It's that one good old bug.

WowClassic_DCiChqGW17

My UI scale is set to 1.0. Other than that, I have no clue on other possible ways to reproduce this. I figured it might just be caused by some scaling rounding errors or likewise.

Error in sortable tables example

3x MyAddon\Libs\StdUi\StdUi-3.lua:65: Usage: <unnamed>:SetWidth(width)
[C]: in function `SetWidth'
MyAddon\Libs\StdUi\StdUi-3.lua:65: in function `SetObjSize'
...MyAddon\Libs\StdUi\widgets\Basic.lua:13: in function `Frame'
...MyAddon\Libs\StdUi\widgets\Basic.lua:23: in function `Panel'
...MyAddon\Libs\StdUi\widgets\Basic.lua:40: in function `PanelWithTitle'
...MyAddon\Libs\StdUi\widgets\Window.lua:13: in function `Window'
MyAddon\core.lua:3: in main chunk

Locals:
(*temporary) = <unnamed> {
 isWidget = true
 GetChildrenWidgets = <function> defined @MyAddon\Libs\StdUi\StdUi.lua:49
 0 = <userdata>
}
(*temporary) = "Title"

and here is the example from the wiki for the Sortable Tables:

local StdUi = LibStub('StdUi');

local window = StdUi:Window(UIParent, 'Title', 500, 500);
window:SetPoint('CENTER');

local btn = StdUi:Button(window, 100, 24, 'Random Data');
StdUi:GlueTop(btn, window, 0, -40);

local function showTooltip(frame, show, spellId)
	if show then
		GameTooltip:SetOwner(frame);
		GameTooltip:SetPoint('RIGHT');
		GameTooltip:SetSpellByID(spellId)
	else
		GameTooltip:Hide();
	end

end


local data = {};
local cols = {

	{
		name         = 'Index',
		width        = 40,
		align        = 'LEFT',
		index        = 'i',
		format       = 'number',
	},

	{
		name         = 'Spell Id',
		width        = 60,
		align        = 'LEFT',
		index        = 'spellId',
		format       = 'number',
		color        = function(table, value)
			local x = value/200000;
			return {r=x, g=1-x, b=0, a=1};
		end
	},
	{
		name         = 'Text',
		width        = 180,
		align        = 'LEFT',
		index        = 'name',
		format       = 'string',
	},

	{
		name         = 'Icon',
		width        = 40,
		align        = 'LEFT',
		index        = 'icon',
		format       = 'icon',
		sortable     = false,
		events         = {
			OnEnter = function(table, cellFrame, rowFrame, rowData, columnData, rowIndex)
				local cellData = rowData[columnData.index];
				showTooltip(cellFrame, true, rowData.spellId);
				return false;
			end,
			OnLeave = function(rowFrame, cellFrame)
				showTooltip(cellFrame, false);
				return false;
			end
		},
	},
}


local st = StdUi:ScrollTable(window, cols, 14, 24);
st:EnableSelection(true);
StdUi:GlueTop(st, window, 0, -100);

local function getRandomSpell()
	local name = nil;
	local icon, castTime, minRange, maxRange, spellId;

	while name == nil do
		name, _, icon, castTime, minRange, maxRange, spellId =
		GetSpellInfo(math.random(100, 200000));
	end

	return {
		name = name,
		icon = icon,
		castTime = castTime,
		minRange = minRange,
		maxRange = maxRange,
		spellId = spellId;
	};
end

local function randomizeData()
	local lx = math.random(1000, 6000);
	data = {};

	for i=1, lx do
		local r = getRandomSpell()
		r.i = i;
		tinsert(data, r);
	end

	-- update scroll table data
	st:SetData(data);
end

btn:SetScript('OnClick', randomizeData);

I can't seem to pinpoint the issue.

Fauxscroll Dropdown

Hey,

first of all thanks for this nice addon/lib!
Keep up the good work!

I have created many tabs with the "Layout Builder" and added a scrollframe to every frame so i am not limited in the height for each tab.

It works like i wanted it but i got a "small" problem with dropdowns: https://imgur.com/a/GL9Hpbz

They do not overlay the scrollframe, they let the scrollframe gain in height when i open them.

Do u have any idea how i could fix that or an workaround?

Thanks for your help!

Allow valueStep to be set on Slider creation

Simple addition to allow the valueStep to be set on the slider.

Example:
StdUi:Slider(parent, width, height, value, vertical, min, max)
to
StdUi:Slider(parent, width, height, value, vertical, min, max, step)

Classic Compatible ?

Been trying to get this working and it doesnt appear to be useable in Classic WOW ?

Custom font family doesn't work?

Hey there,
I can't seem to get the font family to change when using a custom config per your example in the docs.

StdUi.config = {
	font        = {
		family    = "Fonts\\MORPHEUS.ttf",
		size      = 10,
		titleSize = 16,
		effect    = 'NONE',
		strata    = 'OVERLAY',
		color     = {
			normal   = { r = 1, g = 1, b = 1, a = 1 },
			disabled = { r = 0.55, g = 0.55, b = 0.55, a = 1 },
			header   = { r = 1, g = 0.9, b = 0, a = 1 },
		}
	},
...
}

Color seems to change just fine, however font family and size do not change when creating a checkbox (edit: or label). Am I doing something wrong here?

Dragonflight Bug: SetFont() in SimpleEditBoxMethods has Invalid Syntax

Line 19 of EditBox.lua
self:SetFont(self:GetFont(), newSize, self.stdUi.config.font.effect);
causes a lua error that the SetFont() call is invalid syntax.
Maybe 'NONE' is an invalid font effect or some of the other arguments are invalid or the syntax has changed?

Please fix this urgently so that all addons using the StdUi library will have the fix installed, to prevent breaking other addons using StdUi.
This can be tested in the Dragonflight Beta or PTR now.

PanelWithTitle

Hello, I am probabbly doing something wrong but I am trying to use the below code.

local LibStub = _G.LibStub

local StdUi = LibStub("StdUi")

local MainFrame = StdUi:Window(UIParent, 750, 500, 'Test Window')
MainFrame:SetPoint('CENTER')
MainFrame:Show()

local columnHeaders = {
    {
        name = 'Name',
        width = 50,
        align = 'LEFT',
        defaultsort = 'dsc',
        sortnext = 3,
        index = 'name',
        format = 'string',
    },
    {
        name = 'Level',
        width = 60,
        align = 'RIGHT',
        defaultsort = 'dsc',
        index = 'level',
        format = 'string',
    },
    {
        name = 'Average Item Level',
        width = 120,
        align = 'RIGHT',
        defaultsort = 'dsc',
        index = 'avgItemLevel',
        format = 'string',
    },
}

local PlayerHeading = StdUi:PanelWithTitle(MainFrame, 750, 250, "Player's Keys", 25, 16)
StdUi:GlueTop(PlayerHeading, MainFrame, 0, -100)

local st = StdUi:ScrollTable(PlayerHeading, columnHeaders)
StdUi:GlueTop(st, PlayerHeading, 0, -50)

local GuildcolumnHeaders = {
    {
        name = 'Name',
        width = 100,
        align = 'LEFT',
        defaultsort = 'dsc',
        sortnext = 3,
        index = 'name',
    },
    {
        name = 'Level',
        width = 80,
        align = 'RIGHT',
        defaultsort = 'dsc',
        index = 'Level',
    },
}

local GuildHeading = StdUi:PanelWithTitle(MainFrame, 750, 250, "Guild Member's Keys", 25, 16)
StdUi:GlueTop(GuildHeading, MainFrame, 0, -400)

local Guildst = StdUi:ScrollTable(GuildHeading, GuildcolumnHeaders)
StdUi:GlueTop(Guildst, GuildHeading, 0, -50)

st:SetData({})
Guildst:SetData({})

GuildHeading refuses to grow no matter what value I put in.
local GuildHeading = StdUi:PanelWithTitle(MainFrame, 750, 250, "Guild Member's Keys", 25, 16)
same as
local GuildHeading = StdUi:PanelWithTitle(MainFrame, 750, 2500, "Guild Member's Keys", 25, 16)
Or any number inbetween. The MainFrame however does grow.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.