Using LUA but having problems with making a button...
that does not use UIPanelButtonTemplate for a background. Would love to have a button that is just the text itself or an icon or "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_6:14:14|t" as an example.
I just like clean interfaces and believe that having just the raid icon itself against the background of the frame would be great. I could probably do it in XML but Phanx pointed out everything should be done in Lua, so I shifted my whole project to that Lei ShenCoordinator 2. The buttons that I currently have use the following code: Lua Code:
Thanks in advance! |
So just create the button without that template, and create icons and/or font strings as desired:
Code:
-- Create the button: Code:
-- Create the button: Code:
-- Do this: |
Here's my take on creating better code. I kept the idea of using a function to generate the buttons dynamically, yet improved on its operation. First of all, the buttons share the same OnEnter and OnLeave scripts to minimize on excessive memory usage. The function arguments changed to incorporate native support for displaying a texture instead of using a FontString to display them. You can still put text on the button if you choose to.
Lua Code:
Something Phanx didn't mention that should be covered. You should NEVER use a generic name such as "Button" for any UI object. This is the same rule that these names should not be used for any sort of global variable. Global collisions is one of the many reasons an addon can unexpectedly break. This is one reason why most addons use their name as part of any global object it creates. For example, I had your button named "LeiShenCoordinatorWorldMarkerButton1" to guarantee its uniqueness. |
Thank you both for your help and comments. Will tryout your suggestions.
|
Just to save you the potential headache, line 3 in SDPhantom's code should read:
Lua Code:
instead of Lua Code:
|
I did catch that, thanks!
|
Quote:
|
All times are GMT -6. The time now is 02:52 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI