KFD scripting : ONTOUCHUP not working?

  • Hello all,


    In the KFD file I have one inlineform that must react to the ONTOUCHUP and ONOPEN event.


    Now I've made a script:


    DEFSCRIPT GetPosAct
    ShowVar (FULLPATH[] “$POS_ACT.X”, PARAM rX)
    ShowVar (FULLPATH[] “$POS_ACT.Y”, PARAM rY)
    ShowVar (FULLPATH[] “$POS_ACT.Z”, PARAM rZ)
    ShowVar (FULLPATH[] “$POS_ACT.A”, PARAM rA)
    ShowVar (FULLPATH[] “$POS_ACT.B”, PARAM rB)
    ShowVar (FULLPATH[] “$POS_ACT.C”, PARAM rC)
    Message “HELLO?”
    ENDSCRIPT


    And each time I press the TOUCHUP button on the KRC it appears on the screen the message HELLO, but no changes are made.


    When I create the inlineform it works properly and BOTH of the events use the same script.


    Any idea of why it is not working if I use the ONTOUCHUP event?


    Thank you in advance!

  • Schritt für Schritt zum Roboterprofi!
  • Hello,


    this works fine for my application:


    Maybe try "Do AcceptInlineForm"


    HTH


    Tobi

  • First of all thank you for answering...


    The only difference that I can see here is: SETVAR(Fullpath[] " %parVar [%parIndVar1 ].X", Value[] " %parAktPos ")


    And I don't understand it properly:


    How do you have declared the variable parVar, parIndVar and parActpos?


    Thank you in advance...

  • Here you go!


    Code
    DECL PARAM parAktPos = {VALUE {FREE: DEFAULT[] ""}}
    DECL PARAM parVar = {SHORTNAME[] "Var:" , SHORTCUT[] "Var" ,VALUE {NAME: DEFAULT[] "POS_Variable" }}
    DECL PARAM parIndVar1 = {SHORTNAME[] "Index 1:" , SHORTCUT[] "Ind1" ,VALUE {NAME: DEFAULT[] "INDEX_Variable1" }}


    parIndVar1 is for arrays of "POS" only! For example POS posArray[10]


    HTH

  • :D


    THANK YOU VERY MUCH!!!! the problem I was having here was the type of the variable I was using...


    I was using a set of 6 variables to hold the E6POS fields... I had to use the FREE variable type to make it work...


    Well, now it works as I expected, I can't see the contents of the inlineform unless I go there and modify it, but it will work wonders for me.


    Well. Now it works perfect. Again, thank you!


    I've used only:


    DEFSCRIPT OnTouchUp
    SHOWVAR(FULLPATH[] "$POS_ACT", PARAM parAktPos)
    DO ACCEPTINLINEFORM
    ENDSCRIPT



    Thank you!

  • Hello again...


    Using this approach is giving me a new problem:


    Now the TouchUp works perfect and this is great, but after that, I need to place inside the fold of the inlineform a new content: something like:
    PosAct.X = %parAktPos.X
    PosAct.Y = %parAktPos.Y
    ...
    PosAct.T = %parAktPos.T
    LIN PosAct


    Doing that what I'm searching is to have an overwritten PosAct variable each time the fold is read.


    The problem that I've found here is that I can't use this syntax: %parAktPos.X
    in the fold...


    I've also tried to use something like: PosAct = %parAktPos also without luck...


    The way the fold is declared inside the KFD is:


    decl fold d_PosS1[9]
    d_PosS1[1]="PosAct.X = %parAktPos.X"
    d_PosS1[2]="PosAct.Y = %parAktPos.Y"
    d_PosS1[3]="PosAct.Z = %parAktPos.Z"
    d_PosS1[4]="PosAct.A = %parAktPos.A"
    d_PosS1[5]="PosAct.B = %parAktPos.B"
    d_PosS1[6]="PosAct.C = %parAktPos.C"
    d_PosS1[7]="PosAct.S = %parAktPos.S"
    d_PosS1[8]="PosAct.T = %parAktPos.T"
    d_PosS1[9] = "LIN PosAct"



    Any idea on why it is failing? and regarding your approach... why you were using the array of POS variables?


    Thank you again...

  • In order to clarify my question:


    What I need is to put the $POS_ACT inside a variable.
    But I need to do it inside the fold.


    The objective here is to have only one variable that would receive the E6POS and that that variable would become overwritten each time the fold was read.


    So something like:


    PosAct = %parAktPos


    would be the desired thing... but inside the fold the PosAct variable should be overwritten by the contents of the parameter parAktPos.


    Thank you again...

  • Hello Joan,


    Code
    decl fold d_PosS1[9]
    d_PosS1[1]="PosAct.X = %parAktPos.X"
    d_PosS1[2]="PosAct.Y = %parAktPos.Y"
    d_PosS1[3]="PosAct.Z = %parAktPos.Z"
    d_PosS1[4]="PosAct.A = %parAktPos.A"
    d_PosS1[5]="PosAct.B = %parAktPos.B"
    d_PosS1[6]="PosAct.C = %parAktPos.C"
    d_PosS1[7]="PosAct.S = %parAktPos.S"
    d_PosS1[8]="PosAct.T = %parAktPos.T"
    d_PosS1[9] = "LIN PosAct"


    is your Fold really like this? Be aware that you have to have a space after your parameter!
    Like this

    Code
    decl fold d_PosS1[9]
    d_PosS1[1]="PosAct.X = %parAktPos.X "
    d_PosS1[2]="PosAct.Y = %parAktPos.Y "
    d_PosS1[3]="PosAct.Z = %parAktPos.Z "
    d_PosS1[4]="PosAct.A = %parAktPos.A "
    d_PosS1[5]="PosAct.B = %parAktPos.B "
    d_PosS1[6]="PosAct.C = %parAktPos.C "
    d_PosS1[7]="PosAct.S = %parAktPos.S "
    d_PosS1[8]="PosAct.T = %parAktPos.T "
    d_PosS1[9] = "LIN PosAct"


    HTH

Erstelle ein Benutzerkonto oder melde dich an um zu kommentieren

Du musst ein Benutzerkonto haben um einen Kommentar hinterlassen zu können

Benutzerkonto erstellen
Neues Benutzerkonto für unsere Community erstellen. Geht einfach!
Neues Benutzerkonto erstellen
Anmelden
Du hast bereits ein Benutzerkonto? Melde dich hier an.
Jetzt anmelden