Artistry
Posted: 03 Oct 2014, 19:28
Redacted
In principle it is like that, just that the progressBar needs some more parameters than just "grey".Jools wrote:I mean, if I could do things like:
Code: Select all
progressBar myprogressBar = new progressBar("grey");
Code: Select all
myprogressBar = Progressbar:New{
parent = window,
y = 8,
x = 10,
width = 280,
height = 20,
max = 100;
caption = "progress of something";
color = {0.5,0.5,0.5, 1}; --"grey"
value = 1,
}
Code: Select all
myprogressBar :SetValue(75)
Code: Select all
Spring.Echo = spEcho
Spring.CreateUnit = spCreateUnit
Spring.CreateFeature= spCreateFeature
...
But seems sometimes one justs wants to do something "small" and then it can be put directly into the definition and there is something like...OnMouseDown = {DoSomething()}
Code: Select all
bar_metal = Chili.Progressbar:New{
parent = window,
color = col_metal,
height = p(100/bars),
right = 26,
x = 110,
y = p(100/bars),
tooltip = "This shows your current metal reserves",
font = {color = {1,1,1,1}, outlineColor = {0,0,0,0.7}, },
OnMouseDown = {function() return (not widgetHandler:InTweakMode()) end}, -- this is needed for OnMouseUp to work
OnMouseUp = {function(self, x, y, mouse)
if widgetHandler:InTweakMode() then return end
local reserve = x / (self.width - self.padding[1] - self.padding[3])
updateReserveBars(true, mouse ~= 3, reserve)
end},
}
Something something GithubBut when the original widget gets some updates, now there is the problem how to merge in the changes, without losing your own customized stuff.
You seem to be very confused in what chili is. In particular, Chili (like every other GUI library, e.g.: gtk, win forms, QT, android GUI, etc.) is only meant to provide a way to create and manipulate basic GUI controls, such as: button, label, editbox, combobox, window, checkbox, scrollpanel, layoutpanel, etc.Jools wrote: To me this is the biggest shortcoming of chili, as the whole idea of delegating the GUI part to a third party to me would be to outsource the management of that part and instead concentrate on my core business.
But if I anyway have to write the widgets/gadgets from scratch instead of extending a class object, then what is the benefit to use chili in the first place?
I mean, if I could do things like:
Then I would see the benefits.Code: Select all
progressBar myprogressBar = new progressBar("grey");
Installing chili is not difficult, but there is no API: there's just a object hierarchy chart and three tutorials: http://springrts.com/wiki/Chili
The Chili Component Hiearchy would be a good outline from which to build an API.
Please don't pull an argh.Jools wrote:Redacted