WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Lua dropdown onclick function (https://www.wowinterface.com/forums/showthread.php?t=46117)

Resike 03-26-13 07:26 AM

Lua dropdown onclick function
 
How can you make a function which passes an argument when you click on something in the dropdown menu?

Like:
info.func = PVPSound_OptionsSetAddonLanguageOne(text)

function PVPSound_OptionsSetAddonLanguageOne(something)
--
end

zork 03-26-13 07:36 AM

Lua Code:
  1. info.func = self.click --self is the dropdown menu

Under your dropdown creation you just define your click function.
Lua Code:
  1. --dropdownmenu
  2. local dropdownMenu = createBasicDropDownMenu()
  3. dropdownMenu.click = function(self)
  4.   PVPSound_OptionsSetAddonLanguageOne(self.value)
  5. end

I'm doing it this way for the oUF_Diablo config panel:
http://code.google.com/p/rothui/sour.../panel.lua#382

Resike 03-26-13 07:49 AM

I would like to pass custom values not the info.value.

I found this workaround:

Code:

info.func = function(self)
        PVPSound_OptionsSetSoundPackOne("lolimastring")
end

function PVPSound_OptionsSetSoundPackOne(ohrlly)
--
end


Dridzt 03-26-13 07:58 AM

Aren't there some .argX for passing other arguments to your .func?

Resike 03-26-13 08:24 AM

Quote:

Originally Posted by Dridzt (Post 275246)
Aren't there some .argX for passing other arguments to your .func?

Yep, but thats pretty limited too, and only allows 2 arguments.

Dridzt 03-26-13 08:27 AM

Do argX have a limitation on the type passed?
Passing a table might be an option of getting more arguments there.

PS. I'm not suggesting a 'best' approach just exploring possibilities.

Resike 03-26-13 08:29 AM

Quote:

Originally Posted by Dridzt (Post 275252)
Do argX have a limitation on the type passed?
Passing a table might be an option of getting more arguments there.

PS. I'm not suggesting a 'best' approach just exploring possibilities.

Yeah table could work, but it would be harder to code that.

Resike 03-26-13 08:55 AM

Okay, when i store russian localized strings in the info.text then this is what it looks like:

http://i.imgur.com/XfIrvFv.jpg

Is this because the inherits="GameFontNormal" cant handle these characters, and it will be fine on a russian client, or some kinda another bug? Or i did something wrong? I saved everything in utf8 and stuff.

Phanx 03-26-13 11:04 PM

Question marks mean that the font you are using doesn't support those characters. If you're loading Russian characters in the English client, and you're using the default Friz Quadrata font, you will get question marks. If you want to show Russian characters in a non-Russian game client, you need make sure the font you're using includes those characters.

Arial Narrow supports both Latin and Cyrillic characters.

The version of Friz Quadrata loaded in English clients only supports Latin characters, while the version loaded in Russian clients only supports Cyrillic.

The Friz Quadrata lookalikes used by Korean and Chinese clients support both, so if you like the look of Friz Quadrata, you might look into those:

Code:

2002.ttf      2002
2002B.ttf      2002 Bold
ARHei.ttf      AR CrystalzcuheiGBK Demibold
ARKai_C.ttf    AR ZhongkaiGBK Medium (Combat)
ARKai_T.ttf    AR ZhongkaiGBK Medium

(Remember, every client includes the font files for every locale, even if it doesn't load them.)

Resike 03-27-13 07:48 AM

Quote:

Originally Posted by Phanx (Post 275316)
Question marks mean that the font you are using doesn't support those characters. If you're loading Russian characters in the English client, and you're using the default Friz Quadrata font, you will get question marks. If you want to show Russian characters in a non-Russian game client, you need make sure the font you're using includes those characters.

Arial Narrow supports both Latin and Cyrillic characters.

The version of Friz Quadrata loaded in English clients only supports Latin characters, while the version loaded in Russian clients only supports Cyrillic.

The Friz Quadrata lookalikes used by Korean and Chinese clients support both, so if you like the look of Friz Quadrata, you might look into those:

Code:

2002.ttf      2002
2002B.ttf      2002 Bold
ARHei.ttf      AR CrystalzcuheiGBK Demibold
ARKai_C.ttf    AR ZhongkaiGBK Medium (Combat)
ARKai_T.ttf    AR ZhongkaiGBK Medium

(Remember, every client includes the font files for every locale, even if it doesn't load them.)

Okay, so just like i tought, since i use the inhertited text with xml, i need to create a custom template for the font i want to use which supports all characters? And why is it shows the enable button text and the dropdown label text correctly, but not the dropdown menus? Also any1 could show me a Custom xml font template?

Also if i like get the Friz Quadrata Cyrillic version is it gonna show Latin characters properly?

Resike 03-27-13 08:26 AM

The problem i see, the 2002 only supports Korean, and the ARHei only supports Chinesee characters.
I would like an all in one font.

TSquared 03-27-13 09:31 AM

If you are not "mixing" regions in one string (ie: Chinese & Russian) you can create a fall-back system similar to what WoW does with Chat. Look in FontStyleOverrides.xml for examples.

The key parts are:
"alternateTo" to point to the base font to override.
"alternateAlphabetID" which is the alphabet that triggers it (0=Korean, 1=Chinese, 3=Russian; aka: Hangeul,
Hanzi, Cyrillic)

Resike 03-27-13 09:46 AM

Quote:

Originally Posted by TSquared (Post 275343)
If you are not "mixing" regions in one string (ie: Chinese & Russian) you can create a fall-back system similar to what WoW does with Chat. Look in FontStyleOverrides.xml for examples.

The key parts are:
"alternateTo" to point to the base font to override.
"alternateAlphabetID" which is the alphabet that triggers it (0=Korean, 1=Chinese, 3=Russian; aka: Hangeul,
Hanzi, Cyrillic)

I see, but how do i trigger the change? Like when i select a different language from the dropdown menu?
Just simply change the alternateAlphabetID?
Alsi it's 0-1-2 and how do i change back to the normal latin font?

TSquared 03-27-13 10:56 AM

The system triggers it based the the Unicode value. You are just setting up a "configuration."
If it's Russian use this font, if it's Latin use the base font, etc.

Resike 03-27-13 11:51 AM

Okay i managed to change the font of the dropdown menus with the info.fontObject but, the selected dropdown's name still wrong, also the tooltips and some other inherited strings. Any tips to fix thoose?

http://tinypic.com/view.php?pic=25rmb04&s=6

Edit: Okay it took me like 5 hours, but i managed to fix every issues now.

Here is the original project btw:

https://github.com/Resike/PVPSound


All times are GMT -6. The time now is 12:09 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI