Canvas: make setVisible chainable
Change Element.setVisible to return self, so it can be chain called like most other setters. Note this also requires some C++ changes in FlightGear.
This commit is contained in:
parent
074e2511de
commit
df43cb2554
2 changed files with 4 additions and 4 deletions
|
@ -55,6 +55,7 @@ var Element = {
|
|||
# @param visible Whether the element should be visible
|
||||
setVisible: func(visible = 1) {
|
||||
me.setBool("visible", visible);
|
||||
return me;
|
||||
},
|
||||
|
||||
getVisible: func {
|
||||
|
|
|
@ -47,12 +47,11 @@ var WidgetsFactoryDialog = {
|
|||
m.tab_2.addItem(m.button);
|
||||
m.image = gui.widgets.Label.new(m.tabsContent, style, {})
|
||||
.setImage("Textures/Splash1.png")
|
||||
.setVisible(0)
|
||||
.setFixedSize(128, 128);
|
||||
|
||||
m.tab_2.addItem(m.image);
|
||||
# XXX: setVisible(0) must be called AFTER adding the widget to the layout
|
||||
# doing that before layout.addItem causes FG to crash with a SIGSEGV
|
||||
# see https://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/CABg8F9Rb87Fy%252B2ppXjJouYcZH9xyiQxts-jkdrPq0GK_Ymq-6w%2540mail.gmail.com/
|
||||
m.image.setVisible(0);
|
||||
|
||||
m.checkable_button = gui.widgets.Button.new(m.tabsContent, style, {})
|
||||
.setCheckable(1)
|
||||
.setChecked(0)
|
||||
|
|
Loading…
Add table
Reference in a new issue