Hey all,
I was wondering if anybody had a way to toggle the visibility of certain portions of a Chili interface? I have several sub-menus that need to be accessed during the course of gameplay and was looking at Chili as a means to implement this. The issue is of course that many of the menus should only be visible at certain times.
Currently the only way I see of doing this is to set all Chili elements to null, then redefine the whole interface. I was looking for a cleaner way of handling this, hopefully a simple 'visible' field that I can toggle.
Does anything like this exist already?
Chili - Toggle window visiblity?
Moderator: Moderators
Re: Chili - Toggle window visiblity?
Code: Select all
local function HideShowResearch()
if WG.uiElementRegistry["research"] == true then
researchItemsClosed = false
end
if researchItemsClosed == true then
img_researcharrow.file = "bitmaps/ui/arrow_right.png";
img_researcharrow:Invalidate();
if WG.myFaction == "zeon" then
(Chili.Screen0):AddChild(researchBarZeon)
else
(Chili.Screen0):AddChild(researchBarFed)
end
newItems = false
NewItemGlow()
researchItemsClosed = false
else
img_researcharrow.file = "bitmaps/ui/arrow_left.png";
img_researcharrow:Invalidate();
(Chili.Screen0):RemoveChild(researchBarZeon);
(Chili.Screen0):RemoveChild(researchBarFed);
researchItemsClosed = true
end
end
look at add and remove child calls.
Re: Chili - Toggle window visiblity?
Code: Select all
window0:Hide()
window1:Show()
Note, these changes were never commited to ZK.
Last edited by jK on 20 Mar 2012, 17:24, edited 1 time in total.
Re: Chili - Toggle window visiblity?
That was extremely fast, and extremely useful.
I clearly need to rethink how I'm using Chili a little, as I've been basing my work mostly of the tutorial and not the Chili code itself. Your use of AddChild/RemoveChild has answered a lot of questions/issues I was having.
Thanks for your time.
I expect I'll be releasing a beta to the community in the near future.
I clearly need to rethink how I'm using Chili a little, as I've been basing my work mostly of the tutorial and not the Chili code itself. Your use of AddChild/RemoveChild has answered a lot of questions/issues I was having.
Thanks for your time.
I expect I'll be releasing a beta to the community in the near future.
Re: Chili - Toggle window visiblity?
Use JK's method if you can manage getting the newer version of Chili. JK is the Developer of Chili, as such his advice is more sound than mine.
Re: Chili - Toggle window visiblity?
Good Advice.
The Show(), Hide() method is working much cleaner as I jump back and forth between menus. Any chance there's a way to initialize a window as hidden, or should I simply create the object and then call Hide() immediately?
The Show(), Hide() method is working much cleaner as I jump back and forth between menus. Any chance there's a way to initialize a window as hidden, or should I simply create the object and then call Hide() immediately?
Re: Chili - Toggle window visiblity?
Create then hide