Announcement

Collapse
No announcement yet.

Menu label macro

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Menu label macro

    Hi,

    Is there any way to set menu labels to global variable?
    sc_menu_item gets menu item but i need menu label.

    Thanks

  • #2
    sc_script_name might somewhat accomplish your goals (from the help):

    This macro is available to the MENU applications to access the application name that was selected in the menu. It allows the user to make dacisions before executing the application if a pre-process is required to that application.


    Ex. 1: To clean global variables.
    if ({sc_script_name} == "apl1")
    {
    sc_reset_global([global1], [global2]);
    }


    Macro Scope

    onExecute
    Last edited by hoihoi661; 03-17-2015, 07:44 AM. Reason: Fancyness

    Comment


    • #3
      Originally posted by hoihoi661 View Post
      sc_script_name might somewhat accomplish your goals (from the help):

      This macro is available to the MENU applications to access the application name that was selected in the menu. It allows the user to make dacisions before executing the application if a pre-process is required to that application.


      Ex. 1: To clean global variables.
      if ({sc_script_name} == "apl1")
      {
      sc_reset_global([global1], [global2]);
      }


      Macro Scope

      onExecute
      This macro gets app_name. I use this also but i need different one.
      Thanks for your answer

      Comment


      • #4
        Still looking for solution

        Comment


        • #5
          For now it's safe to assume there isn't an easy solution till NetMake implements a macro for this.

          Comment


          • #6
            You can with JS. Not the best solution, but a solution is.
            /Giuseppe

            Professional Scriptcase Services
            Some Customers opinions

            Comment


            • #7
              Originally posted by Giu View Post
              You can with JS. Not the best solution, but a solution is.
              Can you give me an example code for this?

              Many thanks..

              Comment


              • #8
                1.- Open Tools->Libraries
                2.- Create a new library under Public (to use on whatever project you want) called, LibJSAux
                3.- Paste this and Save
                PHP Code:
                <?php
                    
                /*
                    * Load some useful functions to use on SC
                    * Author: Giuseppe @KomencoIT
                    * Date: 18/03/2015
                    */
                    
                function loadLibJSAux(){
                        echo 
                "<script type=\"text/javascript\">";
                    
                        
                loadFunctions();
                    
                        echo 
                "</script>" ;
                    }

                    function 
                loadFunctions(){
                        echo 
                loadChangeLabel();
                    }

                    function 
                loadChangeLabel(){
                        echo 
                "function changeLabel(domName, text){
                            $(domName).text(text);
                            }"
                ;
                    }
                ?>
                4.- Go to the form you want to use this lib.
                5.- Enable the lib under Programming->Libraries
                6.- Call loader onScriptInit event:
                PHP Code:
                loadLibJSAux(); 
                7.- When you want to change a label call:
                PHP Code:
                sc_ajax_javascript'changeLabel', array(SELECTORTEXT)); 
                Where SELECTOR is the DOM of your label, and TEXT the text you want to put.

                Example.
                Captura.PNG

                Should be:
                PHP Code:
                sc_ajax_javascript'changeLabel', array("a#sc_b_upd_t""Update if planets are aligned")); 
                8.- Enjoy!!
                /Giuseppe

                Professional Scriptcase Services
                Some Customers opinions

                Comment

                Working...
                X