Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.visible? not initialised and" window not visible" error (two "friend" bugs?) #104

Open
abakobo opened this issue Aug 5, 2015 · 0 comments

Comments

@abakobo
Copy link

abakobo commented Aug 5, 2015

bug n°1: .visible? returns nil until it's modified once with .visible=

bug n°2: .value= or .visible=(and may be others) will return an error when the UI.messagebox line is not present in the code (tried with sleep 1 second and a for loop - won't work). I found this bug just while writing this example. In larger codes I never had that. My version of Sketchup is 2013 so maybe it's that?

module SKUI_for_my_plugin 
    extension_path = File.dirname( __FILE__ )
    skui_path = File.join( extension_path, 'my_plugin/SKUI' )
    load File.join( skui_path, 'embed_skui.rb' )
    ::SKUI.embed_in( self )
    # SKUI module is now available under SKUI_for_my_plugin::SKUI
end

@options = {
    :title           => 'my_plugin .visible? init bug and early assignement bug',
    :preferences_key => 'my_plugin',
    :width           => 800,
    :height          => 630,
    :resizable       => false
}
@my_plugin_window = SKUI_for_my_plugin::SKUI::Window.new( @options )

@my_plugin_input = SKUI_for_my_plugin::SKUI::Textbox.new( 'hip' )
#txt_input.name = :txt_name
@my_plugin_input.position( 117, 14 )
@my_plugin_input.width = 45
@my_plugin_window.add_control( @my_plugin_input )

@my_plugin_window.show



@resultboxok = UI.messagebox "clickk"  # remove this line to get bug n°2
#sleep 1   #because I tought bug°2 was due to some vars not already created in the interpreter process... but will fail (I tried a for loop too)


puts @my_plugin_input.visible?   #  ----> bug n°1:  returns nil <------

@my_plugin_input.value='hop'  # -----> bug n°2: generates an error (when UI.messagebox is not present) but will change the textbox value! then crashes<-----
@my_plugin_input.visible=true
puts @my_plugin_input.visible?   #now it returns a bool.. (bug n°1)

bug n°2:
Console returns:
load "e/el/bug2.rb"
nil
Error: SKUI::Bridge::CommunicationError: C:/Program Files (x86)/SketchUp/SketchUp 2013/Plugins/e/el/my_plugin/SKUI/bridge.rb:66:in call': Window not visible. C:/Program Files (x86)/SketchUp/SketchUp 2013/Plugins/e/el/my_plugin/SKUI/bridge.rb:66 C:/Program Files (x86)/SketchUp/SketchUp 2013/Plugins/e/el/my_plugin/SKUI/base.rb:130:inupdate_properties'
C:/Program Files (x86)/SketchUp/SketchUp 2013/Plugins/e/el/my_plugin/SKUI/properties.rb:81:in value=' C:/Program Files (x86)/SketchUp/SketchUp 2013/Plugins/e/el/bug2.rb:34 (eval):76:inload'
(eval):76

@abakobo abakobo changed the title .visible? not initialised and window not visible error (two "friend" bugs?) .visible? not initialised and" window not visible" error (two "friend" bugs?) Aug 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant