Announcement

Collapse
No announcement yet.

Keyboard Deleting and Clearing Issue when a String is on the same form

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

  • Keyboard Deleting and Clearing Issue when a String is on the same form

    So a little overview:
    I have a keyboard (custom keypad actually) that prints out the values when pressed.
    I have a case statement for 'delete' and 'clear' keys that also works.
    I have a whole bunch of different parameters to set from different forms, so for example, 1 of 10 buttons is pressed on form10 that activatesform18 where the keyboard is, via a magicevent.
    My issue, is when I call the magicevent I also change the state of a string on the keyboard page form 18, based upon which button is pressed so the user knows which variable they are entering.
    When I have this string on form18 with the custom keypad, the delete and clear buttons no longer work. They still move the txt_MoveCursor, but it doesnt replace the character with a blank ' '.
    Any ideas?

    /*--------------Keyboard Event Handler -------------*/
    func rMagicKbClrEvent0(var reportID, var objType, var objHash, var value)
    txt_FGcolour(CYAN) ;
    txt_FontID(11) ;
    txt_Width(2) ;
    txt_Height(2) ;
    txt_Xgap(2) ;
    //max_characters := 10 ;

    switch(value)

    case(8) : // 'DEL' button - deletes last character
    if(chars)
    respchp-- ;
    chars-- ;
    txt_MoveCursor(2, lft_offset+chars) ;
    putch(' ') ;
    txt_MoveCursor(2, lft_offset+chars) ;
    endif
    break;

    case(16) : // 'CLR' button - deletes all characters entered so far
    while(chars)
    respchp-- ;
    chars-- ;
    txt_MoveCursor(2, lft_offset+chars) ;
    putch(' ') ;
    txt_MoveCursor(2, lft_offset+chars) ;
    wend
    break;

    case(27) : // 'ESC' button - exits this page to last page

    if ( (S1_Tran_Quantityf || S1_Tran_Spanf || S2_Tran_Quantityf || S2_Tran_Spanf || S3_Tran_Quantityf || S3_Tran_Spanf || Dual_OA_Tran_Spanf) == 1 )
    S1_Tran_Quantityf := 0 ;
    S1_Tran_Spanf := 0 ;
    S2_Tran_Quantityf := 0 ;
    S2_Tran_Spanf := 0 ;
    S3_Tran_Quantityf := 0 ;
    S3_Tran_Spanf := 0 ;
    Dual_OA_Tran_Spanf := 0 ;
    ActivateForm(12) ;
    endif

    if ( (Probe_Coefficientf || Root_Factorf || Temp_Low_Limit_ACFMf || Temp_High_Limit_SCFMf || Op_Range_Low_Limitf) == 1)
    Probe_Coefficientf := 0 ;
    Root_Factorf := 0 ;
    Temp_Low_Limit_ACFMf := 0 ;
    Temp_High_Limit_SCFMf := 0 ;
    Op_Range_Low_Limitf := 0 ;
    ActivateForm(16) ;
    endif

    break ;

    // case(42) :

    //break ;

    default : // Any keypad entry other than special characters
    if (chars < maxresp)
    str_PutByte(respchp++, value) ;
    txt_MoveCursor(2, lft_offset+chars) ;
    chars++ ;
    putch(value) ;
    endif
    break;

    endswitch

    endfunc


    /*----------------------------------- Magic Event 1 ---------------------------------*/

    func MagicEvent1(var newval)

    //---------------------- System Configuration Page ------------------------//
    if (CurrentForm == 12) // If on Form 12 - System Configuration Page

    switch (ImageTouched)

    case (iUserbutton27) : // System 1 Transducer Quantity
    S1_Tran_Quantityf := 1 ;
    PrintStrings(0, 0, 0) ;
    ActivateForm(18) ;
    ImageTouched := -1 ;
    oldn := -1 ;
    break;

    case (iUserbutton28) : // System 1 Transducer Span
    S1_Tran_Spanf := 1 ;
    PrintStrings(0, 1, 0) ;
    ActivateForm(18) ;
    ImageTouched := -1 ;
    oldn := -1 ;
    break;

    case (iUserbutton29) : // System 2 Transducer Quantity
    S2_Tran_Quantityf := 1 ;
    PrintStrings(0, 2, 0) ;
    ActivateForm(18) ;
    ImageTouched := -1 ;
    oldn := -1 ;
    break;

    case (iUserbutton30) : // System 2 Transducer Span
    S2_Tran_Spanf := 1 ;
    PrintStrings(0, 3, 0) ;
    ActivateForm(18) ;
    ImageTouched := -1 ;
    oldn := -1 ;
    break;

    case (iUserbutton31) : // System 3 Transducer Quantity
    S3_Tran_Quantityf := 1 ;
    PrintStrings(0, 4, 0) ;
    ActivateForm(18) ;
    ImageTouched := -1 ;
    oldn := -1 ;
    break;

    case (iUserbutton32) : // System 3 Transducer Span
    S3_Tran_Spanf := 1 ;
    PrintStrings(0, 5, 0) ;
    ActivateForm(18) ;
    ImageTouched := -1 ;
    oldn := -1 ;
    break;

    case (iUserbutton33) : // Dual OA Selected
    Dual_OA++ ;
    if(Dual_OA >= 2)
    Dual_OA := 0;
    endif
    WriteObject(tUserButton, 33, Dual_OA);
    ImageTouched := -1 ;
    oldn := -1 ;
    break;

    case (iUserbutton34) : // 2nd OA Transducer Span
    Dual_OA_Tran_Spanf := 1 ;
    PrintStrings(0, 6, 0) ;
    ActivateForm(18) ;
    ImageTouched := -1 ;
    oldn := -1 ;
    break;

    endswitch

    endif

    //------------------------- Factory Settings Page ---------------------------//
    if (CurrentForm == 16)

    switch(ImageTouched)

    /* case (iUserbutton71) : ***REMOVED***
    Temp_Comp_Enable++ ;
    if (Temp_Comp_Enable >= 4)
    Temp_Comp_Enable := 0 ;
    endif
    WriteObject(tUserButton71, Temp_Comp_Enable, 0) ;
    ImageTouched := -1 ;
    oldn := -1 ;
    break ; */

    case (iUserbutton72) :
    Auto_Zero_Enable++ ;
    if (Auto_Zero_Enable >= 2)
    Auto_Zero_Enable := 0 ;
    endif
    WriteObject(tUserButton, 72, Auto_Zero_Enable) ;
    ImageTouched := -1 ;
    oldn := -1 ;
    break;

    case(iUserbutton73) :
    Probe_Coefficientf := 1 ;
    PrintStrings(0, 7, 0) ;
    ActivateForm(18) ;
    ImageTouched := -1 ;
    oldn := -1 ;
    break ;

    case(iUserbutton74) :
    Root_Factorf := 1 ;
    PrintStrings(0, 8, 0) ;
    ActivateForm(18) ;
    ImageTouched := -1 ;
    oldn := -1 ;
    break ;

    case(iUserbutton75) :
    Temp_Low_Limit_ACFMf := 1 ;
    PrintStrings(0, 9, 0) ;
    ActivateForm(18) ;
    ImageTouched := -1 ;
    oldn := -1 ;
    break ;

    case(iUserbutton76) :
    Temp_High_Limit_SCFMf := 1 ;
    PrintStrings(0, 10, 0) ;
    ActivateForm(18) ;
    ImageTouched := -1 ;
    oldn := -1 ;
    break ;

    case(iUserbutton77) :
    Op_Range_Low_Limitf := 1 ;
    PrintStrings(0, 11, 0) ;
    ActivateForm(18) ;
    ImageTouched := -1 ;
    oldn := -1 ;
    break ;


    case (iUserbutton78):
    FactoryConfigured++;
    if (FactoryConfigured >= 2)
    FactoryConfigured := 0 ;
    endif
    WriteObject(tUserButton, 78, FactoryConfigured) ;
    ImageTouched := -1 ;
    oldn := -1 ;
    break ;

    endswitch

    endif

    endfunc

    Additionally, I've tried changing the string state from a post activate form magic code instead of from the magicevent, but that didnt work either.

  • #2
    Hi,

    Can you try to set the OPACITY to 1, and see if it resolved the issue?

    Code:
    func rMagicKbClrEvent0(var reportID, var objType, var objHash, var value)
    txt_FGcolour(CYAN) ;
    txt_FontID(11) ;
    txt_Width(2) ;
    txt_Height(2) ;
    txt_Xgap(2) ;
    txt_Opacity(1);
    Best Regards,
    Kevin

    Comment


    • #3
      *Heavy sigh*
      Yes, that worked perfectly. Many thanks.

      Regards,
      Justin

      Comment


      • John Kevin
        John Kevin commented
        Editing a comment
        Hi Justin,

        I am glad that it resolved your issue

        Best Regards,
        Kevin
    Working...
    X