Home AMX User Forum AMX General Discussion

text input using modero 8400

Hi,

I need to make something that looking very simple in theory.

I try to create a 'text input' where the user can change or enter some string.
then i have to use this new string in my program.

The problem is how to do that ?

i have try 'CUSTOM_EVENT' but this seems to work with 'general button' only and not with
'text input'.

Any Body have a solution for me ?

Comments

  • viningvining Posts: 4,368
    Pop Up a keyboard, enter the text and hit enter (done?). You can then trap that string in the string_event handler in a data_event for the TP being used. Just set up a data_event for port 1 of that TP.
  • sheeva700sheeva700 Posts: 5
    Hi VAV,

    Thank's for this informations
    Just a question, if the user have to enter only numerical value can i use on a numerical keypad (like in setup page for ip adresse etc..) in the same way ?

    Anyway, Thank's a lot.
  • viningvining Posts: 4,368
    Sure, you just need to trap the keypad's name in the TP's port 1 data_event instead of the keyboard's name.
  • sheeva700sheeva700 Posts: 5
    Great !

    Thank's VAV.
  • sheeva700sheeva700 Posts: 5
    Not so great.... :(

    Hi VAV,

    I think is maybe better if i explain the context.

    So,

    I write a new Module the module use port 3 for every button (like 10001:3:1)

    Main Source is controled by 10001:1:1
    Module is controled by 10001:3:1

    i this module i try to trap string comming from virtual keyboard popup previously pasted from system page template like indicated in TPdesign 4 documentation.
    Every button & input box of _keyboard popup is pointing to port 0 (setup port) *** First Problem

    i try to trap the string comming for _keyboard rawly like this :

    DATA_EVENT[10001:0:1]
    {
    STRING:
    {
    SELECT
    {
    ACTIVE (FIND_STRING(DATA.TEXT,'KEYB-',1)):
    {
    SEND_COMMAND xtTP,"'TEXT500-',DATA.TEXT" // DEBUG PURPOSE
    }
    }
    }
    }
    as you can see, i try to trap input text from port 0 because i can't change port to 3 like every other button in my module. but when i see in netlinx notification windows absolutly no string is comming.... :-(

    I have read & read again the manual (netlinx keyword & tpdesign) but i miss something.

    The main aim of the keyboard input is to able the user to make some search etc...

    i have try to trap string_event from the main program also without succes.

    Please help.

    Sorry for my poor english.

    Dominique.
  • viningvining Posts: 4,368
    After you paste the system template kp/kb into your your TPD4 workspace you can rename the page and then use that name to pop it up when you need. Then change the name on the text inut button/field to Port3KEYB-. Usually I use the devices name or something but in this example I'm referencing the device port it's associated with for clarity.

    The first data event and function go in your main code and the 2nd data_event goes into your module. In affect you create a relay.

    You could also change all the port numbers on the kp/kb and handle this in code you write to do so but that's considerably more work.
    DATA_EVENT   [dvTP_Array] //port 1 TP Array             
      
         {
         ONLINE:
    	  {
    	  ON [DATA.DEVICE,1] ;
    	  }
         OFFLINE:
    	  {
    	  OFF [DATA.DEVICE,1] ;
    	  }
         ONERROR:
    	  {
    	  //SEND_STRING 0 .......
    	  }
         STRING:
    	  {
    	  fnHandleTP_Strings(DATA.DEVICE,DATA.TEXT) ;  
         	  }
         }
         
         
    DEFINE_FUNCTION fnHandleTP_Strings(DEV iTP,CHAR iBuff[])
    
         {
         SELECT
    	  {
    	  ACTIVE(find_string(DATA.TEXT,'Port1KEYB-',1)):  
    	       {
    	       }
    	  ACTIVE(find_string(DATA.TEXT,'Port2KEYB-',1)):  
    	       {
    	       }
    	  ACTIVE(find_string(DATA.TEXT,'Port3KEYB-',1)):  
    	       {
    	       SEND_COMMAND vdvYourDevice,"iBuff" ;
    	       }
    	  }
    	  
         iBuff = '' ; 
    	  
         RETURN ;
         }
    
    
    DATA_EVENT [vdvYourDevice] //in your module
    
         {
         ONLINE:
    	  {
    	  }
         OFFLINE:
    	  {
    	  }
         ONERROR:
    	  {
    	  }
         COMMAND:
    	  {
    	  fnDebug("'RCVD DATA_EVENT COMMAND String: ',DATA.TEXT,', line-<',ITOA(__LINE__),'>'") ;
    	  SELECT
    	       {
    	       ACTIVE(find_string(DATA.TEXT,'Port3KEYB-',1)):  
    		    {
    		    STACK_VAR CHAR cTEMP[255] ;
    		    
    		    remove_string(DATA.TEXT,'Port3KEYB-',1)
    		    cTEMP = DATA.TEXT ;
    		    }
    	       ACTIVE(find_string(DATA.TEXT,"'SomeOtherCommand?'",1)):
    		    {
    		    
    		    }
    	       }
    	  }
         }
    
  • sheeva700sheeva700 Posts: 5
    YEEEEES !

    Thank you very much VAV.

    Everything is working fine !
Sign In or Register to comment.