Thread Tools Display Modes
02-25-24, 01:40 AM   #41
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
Then you're using different code. Line 78 in the code I posted (and you re-posted) is either and end or a blank line so, nothing to do with self:SetText()

I can't diagnose what I can't see.

My best guess is you didn't use the updateData() function from my code in whatever your using.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 02-25-24 at 01:42 AM.
  Reply With Quote
02-25-24, 01:55 AM   #42
Hubb777
A Flamescale Wyrmkin
 
Hubb777's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2024
Posts: 113
Originally Posted by Fizzlemizz View Post
Then you're using different code. Line 78 in the code I posted (and you re-posted) is either and end or a blank line so, nothing to do with self:SetText()

I can't diagnose what I can't see.

My best guess is you didn't use the updateData() function from my code in whatever your using.
Yes, indeed, I made changes to another file. It's my mistake, sorry. And a couple more questions (I understand that I just bombarded you with questions) these will be the last.

1. If I want to make a similar addon, as I understand it, I will need to change (the code below) to which one?
Lua Code:
  1. local f = CreateFrame("Frame", "SimpleScrollFrameTableDemo", UIParent, "BasicFrameTemplateWithInset")

2. how do I add a table title (in different languages)
  Reply With Quote
02-25-24, 02:12 AM   #43
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
Both

Lua Code:
  1. local f = CreateFrame("Frame", "Addon_1_Name_Frame", UIParent, "BasicFrameTemplateWithInset")

Lua Code:
  1. local f = CreateFrame("Frame", "Addon_2_Name_Frame", UIParent, "BasicFrameTemplateWithInset")

Probably not a lot of point changing the addon title language unless you are going to post it in language specific sites under different names. If you are just hosting it on WowInterace/Curse/Wago people will find it using the single addon name which would be the same in any language so may as well be the title.

To add a title, after:
Lua Code:
  1. local f = CreateFrame("Frame", "SimpleScrollFrameTableDemo", UIParent, "BasicFrameTemplateWithInset")

add:
Lua Code:
  1. f.Title = f:CreateFontstring(nil, "ARTWORK", "GameFontNormal")
  2. f.Title:SetPoint("TOP", 0, -4)
  3. f.Title:SetText("Your Addon Name")
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
02-25-24, 02:17 AM   #44
Hubb777
A Flamescale Wyrmkin
 
Hubb777's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2024
Posts: 113
Originally Posted by Fizzlemizz View Post
Both

Lua Code:
  1. local f = CreateFrame("Frame", "Addon_1_Name_Frame", UIParent, "BasicFrameTemplateWithInset")

Lua Code:
  1. local f = CreateFrame("Frame", "Addon_2_Name_Frame", UIParent, "BasicFrameTemplateWithInset")

Probably not a lot of point changing the addon title language unless you are going to post it in language specific sites under different names. If you are just hosting it on WowInterace/Curse/Wago people will find it using the single addon name which would be the same in any language so may as well be the title.

To add a title, after:
Lua Code:
  1. local f = CreateFrame("Frame", "SimpleScrollFrameTableDemo", UIParent, "BasicFrameTemplateWithInset")

add:
Lua Code:
  1. f.Title = f:CreateFontstring(nil, "ARTWORK", "GameFontNormal")
  2. f.Title:SetPoint("TOP", 0, -4)
  3. f.Title:SetText("Your Addon Name")
It looks like the problem with different languages has played a cruel joke again. Not the addon name, but my table name. For example, I will name the table “Possible rewards” or “List of pets”, I would like this inscription to also have a translation.
  Reply With Quote
02-25-24, 02:41 AM   #45
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
Originally Posted by Hubb777 View Post
It looks like the problem with different languages has played a cruel joke again. Not the addon name, but my table name. For example, I will name the table “Possible rewards” or “List of pets”, I would like this inscription to also have a translation.
Create a table for your texts (1 sub-table for each with text you want on screen that contains the localised version of the title/whatever. eg.

Lua Code:
  1. addon.Texts = {
  2.     Rewards = {
  3.         enUS = "Possible Rewards",
  4.         deDE = "German for Possible Rewards",
  5.     },
  6.     Pets = {
  7.         enUS = "List of pets",
  8.         deDE = "German List of pets",
  9.     },
  10. }

You can then create FontStrings and set their texts using (set Rewards text):
Lua Code:
  1. xxx:SetText(addon.Texts.Rewards[GetLocal()] or addon.Texts.Rewards.enUS) -- enUS being the default is the GetLocale() entry doesn't exist.

xxx being the variable used when creating the FontString.

You might want to see the wiki on localisation if it gets more complicated.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 02-25-24 at 02:50 AM.
  Reply With Quote
02-25-24, 02:59 AM   #46
Hubb777
A Flamescale Wyrmkin
 
Hubb777's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2024
Posts: 113
Should I create a new lua file tablename.lua? With
Lua Code:
  1. addon.Texts = {
  2.     Rewards = {
  3.         enUS = "Possible Rewards",
  4.         deDE = "German for Possible Rewards",
  5.     },
  6.     Pets = {
  7.         enUS = "List of pets",
  8.         deDE = "German List of pets",
  9.     },
  10. }

And add this file to table.lua
Lua Code:
  1. Pets:SetText(addon.Texts.Rewards[GetLocal()] or addon.Texts.Rewards.enUS) -- enUS being the default is the GetLocale() entry doesn't exist.
  Reply With Quote
02-25-24, 08:32 AM   #47
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
addon.Texts can go in the same file as addon.db as that seems to be where you're putting "data". Assuming that this file is listed in the .TOC file above the other (table.lua) file so it loads first.

Lua Code:
  1. Pets:SetText(addon.Texts.Rewards[GetLocal()] or addon.Texts.Rewards.enUS) -- enUS being the default is the GetLocale() entry doesn't exist.

Goes after you've:
Lua Code:
  1. local Pets = someframe:CreateFontString(nil, somedrawlayer, somefont)

You can't fontstring:SetText(...) on a FontString that doesn't exist.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 02-25-24 at 11:32 AM.
  Reply With Quote
02-25-24, 10:55 PM   #48
Hubb777
A Flamescale Wyrmkin
 
Hubb777's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2024
Posts: 113
Originally Posted by Fizzlemizz View Post
addon.Texts can go in the same file as addon.db as that seems to be where you're putting "data". Assuming that this file is listed in the .TOC file above the other (table.lua) file so it loads first.

Lua Code:
  1. Pets:SetText(addon.Texts.Rewards[GetLocal()] or addon.Texts.Rewards.enUS) -- enUS being the default is the GetLocale() entry doesn't exist.

Goes after you've:
Lua Code:
  1. local Pets = someframe:CreateFontString(nil, somedrawlayer, somefont)

You can't fontstring:SetText(...) on a FontString that doesn't exist.
This is the code I got
Lua Code:
  1. local Pets = someframe:CreateFontString(nil, somedrawlayer, somefont)
  2. Pets:SetText(addon.Texts.Rewards[GetLocal()] or addon.Texts.Rewards.enUS)
  3. addon.Texts = {
  4.     Rewards = {
  5.         enUS = "Possible Rewards",
  6.         deDE = "German for Possible Rewards",
  7.     },
  8.     Pets = {
  9.         enUS = "List of pets",
  10.         deDE = "German List of pets",
  11.     },
  12. }
Wherever I insert it, either the button disappears or it cannot be pressed. And if everything is pressed, there is no result.
  Reply With Quote
02-26-24, 08:59 AM   #49
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
Because you refuse to read and consider what has been written. In the last post, not even considered what was asked.

Most parts of an addon are created, positioned, formatted etc. in relation to something else depending on what you want your addon to do and how you want it to look and work. Not being a mind reader (and I can't read you screen), I'm not about to decide that for you, all I can do is offer suggestions on how you might do things. It's up to you work that information (if you think it might be useful) into your addon.

With that in mind, not every code block is literal, someframe, somedrawlayer, somefont are for you to replace with whatever works for you and your addon.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 02-26-24 at 01:10 PM.
  Reply With Quote
02-26-24, 10:28 PM   #50
Hubb777
A Flamescale Wyrmkin
 
Hubb777's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2024
Posts: 113
Originally Posted by Fizzlemizz View Post
Because you refuse to read and consider what has been written. In the last post, not even considered what was asked.

Most parts of an addon are created, positioned, formatted etc. in relation to something else depending on what you want your addon to do and how you want it to look and work. Not being a mind reader (and I can't read you screen), I'm not about to decide that for you, all I can do is offer suggestions on how you might do things. It's up to you work that information (if you think it might be useful) into your addon.

With that in mind, not every code block is literal, someframe, somedrawlayer, somefont are for you to replace with whatever works for you and your addon.
Hello. Sorry for the misunderstanding. It’s just that English is not my native language (I’m writing from the Czech Republic). For some of the text I have to use Google Translate (which makes it even more difficult to understand).

I'll try to figure out the issue again.
As I understand it, I can place this part of the code in the code file db.lua
Lua Code:
  1. addon.Texts = {
  2.     Rewards = {
  3.         enUS = "Possible Rewards",
  4.         deDE = "German for Possible Rewards",
  5.     },
  6.     Pets = {
  7.         enUS = "List of pets",
  8.         deDE = "German List of pets",
  9.     },
  10. }
And this part in code table.lua
Lua Code:
  1. local Pets = someframe:CreateFontString(nil, somedrawlayer, somefont)
  2. Pets:SetText(addon.Texts.Rewards[GetLocal()] or addon.Texts.Rewards.enUS)
  Reply With Quote
02-27-24, 09:33 AM   #51
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
Correct,

Lua Code:
  1. local Pets = someframe:CreateFontString(nil, somedrawlayer, somefont)

Replace someframe with the frame you want to be the parent of the new FontString
The parent will effect the Fonstrings scale and when it's, shown/hidden etc.

Replace somedrawlayer and somefont with the relevent information depending on where in the layer stack you want the string displayed and the font/size you want the text to be displayed in. See the docs for CreateFontString and see this page for some of the in-game fonts configurations ie. GameFontNormal, GameFontHighlight etc. etc. etc.

You can't use someframe (whichever that frame is) to create the FontString until after the frame itself has been created (The order that code is placed (runs) matters).
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 02-27-24 at 10:07 AM.
  Reply With Quote
03-02-24, 11:56 PM   #52
Hubb777
A Flamescale Wyrmkin
 
Hubb777's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2024
Posts: 113
Originally Posted by Fizzlemizz View Post
Correct,

Lua Code:
  1. local Pets = someframe:CreateFontString(nil, somedrawlayer, somefont)

Replace someframe with the frame you want to be the parent of the new FontString
The parent will effect the Fonstrings scale and when it's, shown/hidden etc.

Replace somedrawlayer and somefont with the relevent information depending on where in the layer stack you want the string displayed and the font/size you want the text to be displayed in. See the docs for CreateFontString and see this page for some of the in-game fonts configurations ie. GameFontNormal, GameFontHighlight etc. etc. etc.

You can't use someframe (whichever that frame is) to create the FontString until after the frame itself has been created (The order that code is placed (runs) matters).
Hello. After several days I still couldn't figure it out (I'm stupid). I made the addon without these changes, it turned out pretty good.
https://www.wowinterface.com/downloa...o.php?id=26699
  Reply With Quote
03-03-24, 11:13 AM   #53
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
Congratulations

The more you play with it, the more you'll learn. Have Fun!
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Save location via SavedVariables


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