sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    🛣️ Road Profile Builder | Generate roads, curbs and pavements easily Download

    .execute_script interesting quirk

    Scheduled Pinned Locked Moved Developers' Forum
    7 Posts 4 Posters 286 Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K Offline
      kdasilva
      last edited by

      I thought this experience would be worth sharing in case anyone else gets stuck like i did~

      So i don't know if this qualifies as a "bug" per say...but it definitely made my morning long and frustrating.

      Has any one else noticed that if you create an action_callback through clicking on a <a href...> tag instead of a button, the .execute script command no longer works on the web_dialog parameter. Correct me if Im wrong but I spent all morning testing this problem with two cal_backs that were essentially identical. It took me several hours to realize that the only difference was one got created through a button, and the other through a hyperlink

      everything else I worked in the callback except for .execute_script for the record

      (I was just using hyper-links because the buttons were so ugly)

      It would be interesting to see if other methods of creating a call_back in a webdialog have this bug.

      cheers
      Korbin

      *Update I did a quick test on a callback created through clicking on an image I have in my app, and it worked fine...verrrrry interesting

      1 Reply Last reply Reply Quote 0
      • TIGT Online
        TIG Moderator
        last edited by

        I have several custom tools using href button with rounded ends etc instead of standard buttons - this way [you define the button class in your css style code] - the call_backs work fine - here's a snippet...

        <span class="syntaxdefault"><br /></span><span class="syntaxkeyword"><</span><span class="syntaxdefault">td align</span><span class="syntaxkeyword">=</span><span class="syntaxdefault">center style</span><span class="syntaxkeyword">=</span><span class="syntaxstring">"width;84px; padding;3px;"</span><span class="syntaxkeyword">><br /></span><span class="syntaxdefault">      </span><span class="syntaxkeyword"><</span><span class="syntaxdefault">a id</span><span class="syntaxkeyword">=</span><span class="syntaxstring">"cancel_dropdown"</span><span class="syntaxdefault"> <br />         class</span><span class="syntaxkeyword">=</span><span class="syntaxstring">"button"</span><span class="syntaxdefault"> href</span><span class="syntaxkeyword">=</span><span class="syntaxstring">"#"</span><span class="syntaxdefault"> <br />         onclick</span><span class="syntaxkeyword">=</span><span class="syntaxstring">"this.blur(); window.location='skp;cancel_dropdown@';"</span><span class="syntaxkeyword">><br /></span><span class="syntaxdefault">      </span><span class="syntaxkeyword"><</span><span class="syntaxdefault">span</span><span class="syntaxkeyword">></span><span class="syntaxdefault">Cancel</span><span class="syntaxkeyword"></</span><span class="syntaxdefault">span</span><span class="syntaxkeyword">><br /></span><span class="syntaxdefault">      </span><span class="syntaxkeyword"></</span><span class="syntaxdefault">a</span><span class="syntaxkeyword">><br /></</span><span class="syntaxdefault">td</span><span class="syntaxkeyword">></span><span class="syntaxdefault"> </span>
        

        TIG

        1 Reply Last reply Reply Quote 0
        • K Offline
          kdasilva
          last edited by

          @tig said:

          I have several custom tools using href button with rounded ends etc instead of standard buttons - this way [you define the button class in your css style code] - the call_backs work fine - here's a snippet...

          <span class="syntaxdefault"><br /></span><span class="syntaxkeyword"><</span><span class="syntaxdefault">td align</span><span class="syntaxkeyword">=</span><span class="syntaxdefault">center style</span><span class="syntaxkeyword">=</span><span class="syntaxstring">"width;84px; padding;3px;"</span><span class="syntaxkeyword">><br /></span><span class="syntaxdefault">      </span><span class="syntaxkeyword"><</span><span class="syntaxdefault">a id</span><span class="syntaxkeyword">=</span><span class="syntaxstring">"cancel_dropdown"</span><span class="syntaxdefault"> <br />         class</span><span class="syntaxkeyword">=</span><span class="syntaxstring">"button"</span><span class="syntaxdefault"> href</span><span class="syntaxkeyword">=</span><span class="syntaxstring">"#"</span><span class="syntaxdefault"> <br />         onclick</span><span class="syntaxkeyword">=</span><span class="syntaxstring">"this.blur(); window.location='skp;cancel_dropdown@';"</span><span class="syntaxkeyword">><br /></span><span class="syntaxdefault">      </span><span class="syntaxkeyword"><</span><span class="syntaxdefault">span</span><span class="syntaxkeyword">></span><span class="syntaxdefault">Cancel</span><span class="syntaxkeyword"></</span><span class="syntaxdefault">span</span><span class="syntaxkeyword">><br /></span><span class="syntaxdefault">      </span><span class="syntaxkeyword"></</span><span class="syntaxdefault">a</span><span class="syntaxkeyword">><br /></</span><span class="syntaxdefault">td</span><span class="syntaxkeyword">></span><span class="syntaxdefault"> </span>
          

          even the .execute_script command? everything else works for me too except for that....although looking at your code it may be because i used:

          <a href="javascript:AddChangeDiagnosis()" ><b>[Add/Change]</b></a>

          to call the function, whereas both my buttons and the image i click use the "onclick" attribute

          ** confirmed....that was the problem, sooo take home lesson...always use "onclick" !

          1 Reply Last reply Reply Quote 0
          • Dan RathbunD Offline
            Dan Rathbun
            last edited by

            @kdasilva said:

            (I was just using hyper-links because the buttons were so ugly)

            Put this meta-tag in the <HEAD> section of the webdialog html:

            <span class="syntaxdefault"></span><span class="syntaxkeyword"><!--</span><span class="syntaxdefault"> This tells the HTML frame to use MS Common Controls ver 6</span><span class="syntaxkeyword">+</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">--><br /><!--</span><span class="syntaxdefault">  </span><span class="syntaxkeyword">(</span><span class="syntaxdefault">also known as XP style themed controls</span><span class="syntaxkeyword">.)</span><span class="syntaxdefault">   </span><span class="syntaxkeyword">--><br /><</span><span class="syntaxdefault">META HTTP</span><span class="syntaxkeyword">-</span><span class="syntaxdefault">EQUIV</span><span class="syntaxkeyword">=</span><span class="syntaxstring">"MSThemeCompatible"</span><span class="syntaxdefault"> CONTENT</span><span class="syntaxkeyword">=</span><span class="syntaxstring">"Yes"</span><span class="syntaxkeyword">></span><span class="syntaxdefault"> </span>
            

            I'm not here much anymore.

            1 Reply Last reply Reply Quote 0
            • thomthomT Offline
              thomthom
              last edited by

              I've not seen such quirk you mention. I suspect it might be some other JS error perhaps...?

              Thomas Thomassen — SketchUp Monkey & Coding addict
              List of my plugins and link to the CookieWare fund

              1 Reply Last reply Reply Quote 0
              • Dan RathbunD Offline
                Dan Rathbun
                last edited by

                I think there is a whole topic on this concerning "Javascript:void(0);" vs "Javascript:return;" one of which needs to be in the HREF tag, the Ruby callback needs to be in the onClick call.

                I'm not here much anymore.

                1 Reply Last reply Reply Quote 0
                • thomthomT Offline
                  thomthom
                  last edited by

                  @dan rathbun said:

                  I think there is a whole topic on this concerning "Javascript:void(0);" vs "Javascript:return;" one of which needs to be in the HREF tag, the Ruby callback needs to be in the onClick call.

                  To avoid triggering an A HREF link, and instead execute some other JS code, you return false to the onclick event.

                  Thomas Thomassen — SketchUp Monkey & Coding addict
                  List of my plugins and link to the CookieWare fund

                  1 Reply Last reply Reply Quote 0
                  • 1 / 1
                  • First post
                    Last post
                  Buy SketchPlus
                  Buy SUbD
                  Buy WrapR
                  Buy eBook
                  Buy Modelur
                  Buy Vertex Tools
                  Buy SketchCuisine
                  Buy FormFonts

                  Advertisement