10-08-23, 01:41 PM | #1 |
Use „MaximizeMinimizeButtonFrameTemplate“
Hi,
is there a way to use „MaximizeMinimizeButtonFrameTemplate“ for simply OnClick Show/Hide a Frame? |
|
10-08-23, 02:53 PM | #2 |
You can't mouse click a hidden frame (button) in order to show it and this type of frame should already have a close (click X to hide) button.
Or maybe you mean something else?
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. Last edited by Fizzlemizz : 10-08-23 at 03:16 PM. |
|
10-09-23, 12:59 AM | #3 |
I want to use it this way. But it doesnt work.
Lua Code:
The Button with the template „ MaximizeMinimizeButtonFrameTemplate“ does show up and is clickable. It does change the texture on click but doesnt do the script. I want it so badly because its the only template fitting the default close button in style. Last edited by Blandros : 10-09-23 at 01:05 AM. |
|
10-09-23, 05:16 AM | #4 |
I see you are using "Button" as it's type. But, based on Blizzards code it is a "Frame".
Lua Code:
Link to line in file : https://github.com/tomrus88/Blizzard...15C2-L1615C155
__________________
All Level 70 Characters: Demon Warlock Resto Druid Disc Priest Resto Shaman Survival Hunter Augment Evoker Frost Mage Vengence Demon Hunter Rogue ( was subtlety ) Brewmaster Monk (TR) Prot Paladin (TR) Blood Death Knight ( TR) As you can see I am missing a warrior And .. I don't have all the allied races covered. Time Runner time when it happens again |
|
10-09-23, 07:29 AM | #5 |
10-09-23, 07:53 AM | #6 |
It should be just the case of changing "Button" to "Frame". But I haven't seen this frame personally to see how it works and looks out of the box. Code wise it already handles Minimize and Maximize functionality for the parent frame it is on.
I'll see if I can rig up an addon to see what it is like to make sure this is the case. Okay, this is a really rough addon that shows how those buttons work with minimal coding. This is the one and only lua file for a very simple addon. The issue is that where the minmax button is linked to the frame, once you hide it you can never show it again. But, you can resize the frame to suit. Which is what I did here. However, you can't resize to smaller than the minmax button or it will disappear anyway. The X close button in my example works straight out of the box and closes the frame automatically, never to be open again until the game is restarted. I used a different trick with my portals addon by having a *header* frame that is always displayed and had it control whether the bigger portals frame *content* was displayed or not. Lua Code:
__________________
All Level 70 Characters: Demon Warlock Resto Druid Disc Priest Resto Shaman Survival Hunter Augment Evoker Frost Mage Vengence Demon Hunter Rogue ( was subtlety ) Brewmaster Monk (TR) Prot Paladin (TR) Blood Death Knight ( TR) As you can see I am missing a warrior And .. I don't have all the allied races covered. Time Runner time when it happens again Last edited by Xrystal : 10-09-23 at 08:26 AM. |
|
10-09-23, 10:11 AM | #7 | |
Code:
<Button name="$parentCloseButton" inherits="UIPanelCloseButton"> Lua Code:
It relies on the frame you want to hide being the direct parent of the button. It hides the frame but as before, once hidden you can't click the close button with the mouse to show the parent frame again. If you intend to leave the button on-screen (by parenting it to the "Keyboard" or some frame not parented to "Control") then you could replace it's OnClick script with the one you posted.
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. Last edited by Fizzlemizz : 10-09-23 at 11:16 AM. |
||
10-11-23, 02:43 AM | #8 |
Thank you @Fizzlemizz and @Xrystal
I am on the right track now. But i still got problems. The frame "controls" is the header of the frame "keyboard". But when i open "keyboard" the frame "controls" dont show up. I need to click "MaximizeMinimizeButtonFrameTemplate" once so it shows up minimized. How can i add "controls" as minimized when the frame "keyboard" loads/shows? On the other hand i cant get the buttons etc. in the control frame to work with the flag "if maximizeFlag then". Thank you for your replies and time! Lua Code:
|
|
10-11-23, 12:15 PM | #9 |
Given you haven 't added your startup code, I may be misunderstanding the question but I think this may be closer to what you're trying to do,
Lua Code:
As an aside, a frame with a name automatically has that name added to the global table as a reference to the frame so: Code:
_G["Keyboard"] = Keyboard Code:
KeyUIMainFrame:Show() Blizzard will use the simplest/common names for things (including frames and globals) so words like Keyboard or Controls are not recommended on their own.
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. Last edited by Fizzlemizz : 10-11-23 at 01:31 PM. |
|
10-11-23, 01:33 PM | #10 |
After a bit more reading of your code I redid mine above to action the MinMax and Close buttons.
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. |
|
10-11-23, 04:06 PM | #11 |
I appreciate your input! Thank you, @Fizzlemizz.
The only remaining issue I have is that, even when the "maximizeFlag" is set to true, "Controls.Slider," "Controls.ShiftCB," "Controls.CtrlCB," and "Controls.AltCB" don't appear. If I declare "local maximizeFlag = true" at the beginning of the code, they always become visible. Conversely, when I declare "local maximizeFlag = false," they remain hidden consistently. The print statement indicates that the value is changing. Lua Code:
|
|
10-11-23, 04:56 PM | #12 |
Because you have the
Lua Code:
Code:
function addon:CreateControls() That said, you only want to call the function once as frames (widgets in general including Textures and FontStrings) are not destroyed (deleted, removed...) until you exit the game (or logout or /reload) so once created you Show/Hide them as required. Possibly what you want to do is Lua Code:
It might all look something like: Lua Code:
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. Last edited by Fizzlemizz : 10-11-23 at 07:12 PM. |
|
10-20-23, 05:35 PM | #13 |
@Fizzlemizz thank you! It worked like a charm.
https://legacy.curseforge.com/wow/addons/keyui/files/4808314 (I hope linking this i allowed.) Shoutout once again to you. Thank you! |
|
10-21-23, 01:15 PM | #14 | |
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. |
||
WoWInterface » Developer Discussions » Lua/XML Help » Use „MaximizeMinimizeButtonFrameTemplate“ |
«
Previous Thread
|
Next Thread
»
|
Thread Tools | |
Display Modes | |
|
|