lib/shoes/swt/common/visibility.rb in shoes-swt-4.0.0.pre12 vs lib/shoes/swt/common/visibility.rb in shoes-swt-4.0.0.rc1
- old
+ new
@@ -1,12 +1,17 @@
# frozen_string_literal: true
+
class Shoes
module Swt
module Common
module Visibility
def update_visibility
- if @real && @real.respond_to?(:set_visible)
- @real.set_visible(@dsl.visible?)
+ if defined?(@real) && @real.respond_to?(:set_visible)
+ # hidden_from_view? handles all visiblity conditions, including
+ # being outside a slot. SWT as backend doesn't get that for free
+ # because we can't use Composites as they lack transparency...
+ visible = !@dsl.hidden_from_view?
+ @real.set_visible(visible)
end
end
end
end
end