Author Topic: Liquid UI: setcursor  (Read 6620 times)

rajesh.sabbineni

  • GuiXT Forum
  • Newbie
  • *
  • Posts: 26
    • View Profile
Liquid UI: setcursor
« on: August 18, 2016, 03:57:10 PM »
With setcursor command  you can set the cursor into a certain input field. Below example explains on how to setcursor on appropriate fields.

// Code Sample: User Interface
inputfield( [2,3], "Plant", [2,15],{ "name":"z_plant", "size":4, "required":true});
inputfield( [3,3], "Material", [3,15],{ "name":"z_material", "size":10, "required":true});
inputfield( [4,3], "Stor Loc.", [4,15],{ "name":"z_storloc", "size":4, "required":true});
pushbutton([6,10], "Set Cursor", {"process":setCursor});

if(!isBlank(cursorPosition)) {
   setcursor(cursorPosition);
   cursorPosition = '';
} else {
   setcursor('V[z_plant]');
}

// Function to check required entry and setcursor on appropriate field
function setCursor(){
    if(isBlank(z_plant)){
         message('E: Please enter Plant');
         enter('?');
         goto END;
      }
       if(isBlank(z_material)){
         message('E: Please enter Material');
         set('V[cursorPosition]','V[z_material]');
         enter('?');
         goto END;
      }
       if(isBlank(z_storloc)){
         message('E: Please enter storage location');
         set('V[cursorPosition]','V[z_storloc]');
         enter('?');
         goto END;
      }
      
      END:;
   
}

//Function to check if the field value is blank or not
function isBlank(jvar) {
    if (jvar== void 0 || jvar==null || jvar=="") {
       return true;
    } else {
       return false;
    }
}

see attachments..