Keyboard catch event

grilligrilli Member Posts: 33
Hello my friends;

I have a problem, I want to catch events from keyboard. It means, I have a form with a textbox and a subform, when the user type a word in this textbox I want to apply a filter to the subform. My problem is that the validate trigger of the textbox is only executed when I press Intro, and I want to filter every time the user introduce a char in the textbox.
Can anybody help me?
Thank you. ](*,) ](*,)
Bye.

Comments

  • kapamaroukapamarou Member Posts: 1,152
    Tried the OnInputChange() trigger?
  • grilligrilli Member Posts: 33
    I´ve tried this but it doesn´t work. The problem is that I want to filter with the value of the textbox and in this event the textbox doesn´t have value.

    Thank you.
  • varodavaroda Member Posts: 7
    Interested pot, I have the same problem, I´m trying to do the same funcionality of Navison Find button (Ctrl. F).
  • grilligrilli Member Posts: 33
    If this action is that I'm trying to replicate but in a textbox and that also goes for typing

    Can someone help? It is very important
  • jannestigjannestig Member Posts: 1,000
    Doesn't NAV 2009 SP1 have the FAYT Find as you type functionality ?

    You can look there perhaps for examples, though it might only be RTC relevant
  • varodavaroda Member Posts: 7
    If I undertand you, this funcionality only works in the RTC. I need it in classic client.
  • grilligrilli Member Posts: 33
    The version on which I am trying to replicate a 2009 SP1 but the classic client and a textbox on a form.
  • kinekine Member Posts: 12,562
    1) These types of "hacks" are too costly for effect which they have for customer (he could use standard functionality for the same result)
    2) Question is - what you want to solve by this? Is data entering too slow for customer? Is it just wrong training?

    There is no standard way for this in NAV. And there is a reason for that. Even the "find as you type" could kill your server... why to add another way how to kill the performance?
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • kapamaroukapamarou Member Posts: 1,152
    Before continuing with this I need to ask:

    If your user enters a 10-char text then you will apply a filter 10 times, after each keystroke?

    This could cause problems with your system performance.
  • grilligrilli Member Posts: 33
    Yes that's what I need. For every keystroke I need to change the filter in terms of what made so far. I know it's going slow but I need a way to do it anyway.

    Thanks,
  • kapamaroukapamarou Member Posts: 1,152
    I have never done something similar before. In fact I always encourage my customers to uncheck the "Find as you type" option to gain performance.

    But if you really need this you van do the following as a start.

    Create a Text variable for your filter.
    Create a second Text variable of length 1.
    Assign the second text variable to a text box and set the Auto enter property to true. In that text box, every time you press a character the onafterinput trigger will be executed. Then play around with the available properties and code in order to add the entered value to your normal text variable.

    This could be a start point to get you where you want...
  • grilligrilli Member Posts: 33
    We already had tried but has a problem and I in this field with characters entering and AutoEnter voi voi ai composing the other varibles and filtering but now also needs to control when given a Enter to send a message to launch an action. Does anyone know how I can improve this or otherwise?

    Thanks,
  • grilligrilli Member Posts: 33
    Someone knows how to solve the problem of slow down the process even if I do not care.

    Please help me
  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    Sometimes you have to accept that not everything can be done in NAV.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • grilligrilli Member Posts: 33
    Everything you can imagine is possible in NAV.
    I will not sleep until I get it and when this moment becomes you will remember me.

    New suggestions please
  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    grilli wrote:
    Everything you can imagine is possible in NAV.
    In your dreams
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • DenSterDenSter Member Posts: 8,304
    If you don't mind I won't hold my breath :mrgreen:

    You're wrong by the way, there's plenty of things that are not possible in NAV.
  • grilligrilli Member Posts: 33
    Linnet! "In what world do you live? In Navision everything can be developed. And believe me but I'm going to show and I'll find solution to the problem above. if you dare try to put the solution before me.
  • kinekine Member Posts: 12,562
    grilli wrote:
    Linnet! "In what world do you live? In Navision everything can be developed. And believe me but I'm going to show and I'll find solution to the problem above. if you dare try to put the solution before me.
    Yes, everything is possible, but only with unlimited budget... :mrgreen: and this is the main problem... 8)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • grilligrilli Member Posts: 33
    I can route a little so my budget is not an unlimited too? You know some pause to continue because I have any idea but just not be 100% correct. :D:D

    Thanks
  • DenSterDenSter Member Posts: 8,304
    grilli wrote:
    In Navision everything can be developed
    No. It really cannot.
  • PoluxManPoluxMan Member Posts: 3
    Hello,
    I think the "OnInputChange() trigger" solution works but you need to use CurrForm.SAVERECORD in first to get value of your Textbox.
    Regards

    Edit : just tried, works but with 1 problem : you need to catch and works on the value in textbox because with Saverecord, each time use type on keeboard the previous carracter is replaced by the new one :P
    But seems easy to manage that.

    Edit 2 : In fact, not easy at all to manage... dont waste your time with my solution, it doesnt work :cry:
  • SeniorDevSeniorDev Member Posts: 2
    Hi,

    may you can try this.
    (...inspired by the tool "pocket calculator")

    The "#"-key will clear the filter.
    OBJECT Form 50010 Instant Filter Input
    {
      OBJECT-PROPERTIES
      {
        Date=10.11.09;
        Time=18:17:08;
        Modified=Yes;
        Version List=;
      }
      PROPERTIES
      {
        Width=9790;
        Height=6820;
        InsertAllowed=No;
        DeleteAllowed=No;
        ModifyAllowed=No;
        TableBoxID=1000000000;
        SourceTable=Table18;
      }
      CONTROLS
      {
        { 1000000000;TableBox;220 ;1100 ;9350 ;5500 ;HorzGlue=Both;
                                                     VertGlue=Both;
                                                     Focusable=No }
        { 1000000001;TextBox;0    ;0    ;1693 ;0    ;ParentControl=1000000000;
                                                     InColumn=Yes;
                                                     SourceExpr="No." }
        { 1000000002;Label  ;0    ;0    ;0    ;0    ;ParentControl=1000000001;
                                                     InColumnHeading=Yes }
        { 1000000003;TextBox;0    ;0    ;4400 ;0    ;HorzGlue=Both;
                                                     ParentControl=1000000000;
                                                     InColumn=Yes;
                                                     SourceExpr=Name }
        { 1000000004;Label  ;0    ;0    ;0    ;0    ;ParentControl=1000000003;
                                                     InColumnHeading=Yes }
        { 1000000008;TextBox;1540 ;330  ;880  ;550  ;Visible=Yes;
                                                     ForeColor=12632256;
                                                     MaxLength=1;
                                                     AutoEnter=Yes;
                                                     NextControl=21;
                                                     SourceExpr=KeyStroke;
                                                     OnBeforeInput=BEGIN
                                                                     IF KeyStroke = '#' THEN BEGIN
                                                                       CLEAR(FilterString);
                                                                       CLEAR(KeyStroke);
                                                                     END;
    
                                                                     CurrForm.Trigger.ACTIVATE;
    
                                                                     FilterString += FORMAT(KeyStroke);
                                                                     CLEAR(KeyStroke);
    
                                                                     SETFILTER(Name,'%1','@'+FilterString+'*');
                                                                     CurrForm.UPDATE;
                                                                   END;
                                                                    }
        { 1000000009;CommandButton;220;330;1210;550 ;Name=Trigger;
                                                     Focusable=No }
        { 1000000010;TextBox;2640 ;330  ;6490 ;550  ;Focusable=No;
                                                     SourceExpr=FilterString }
      }
      CODE
      {
        VAR
          FilterString@1000000000 : Text[1024];
          KeyStroke@1000000002 : Char;
    
        BEGIN
        END.
      }
    }
    

    best regards
    sd
  • grilligrilli Member Posts: 33
    This solution you posed, and I tried but has a major drawback. It also allows you to capture the ENTER key and delete, before which I want to blow up a certain process.

    Thanks,
  • SeniorDevSeniorDev Member Posts: 2
    It is possible to catch "Shift + Enter" and "Shift + Delete", but not the other special keys. Strange.

    btw, does anybody here maybe know what the keys "left", "right" and "middle" are for? (mouse?)
    OBJECT Form 50010 Instant Filter Input
    {
      OBJECT-PROPERTIES
      {
        Date=11.11.09;
        Time=14:15:22;
        Modified=Yes;
        Version List=;
      }
      PROPERTIES
      {
        Width=9900;
        Height=7700;
        InsertAllowed=No;
        DeleteAllowed=No;
        ModifyAllowed=No;
        SourceTable=Table27;
      }
      CONTROLS
      {
        { 1000000008;TextBox;1540 ;330  ;880  ;550  ;Visible=Yes;
                                                     ForeColor=12632256;
                                                     MaxLength=1;
                                                     AutoEnter=Yes;
                                                     NextControl=21;
                                                     SourceExpr=KeyStroke;
                                                     OnBeforeInput=VAR
                                                                     HlpInt@1000000001 : Integer;
                                                                   BEGIN
                                                                     HlpInt := KeyStroke;
                                                                     IF HlpInt = 0 THEN BEGIN
                                                                       CurrForm.SpecialKeys.ACTIVATE;
                                                                       EXIT;
                                                                     END;
    
                                                                     IF KeyStroke = '#' THEN BEGIN
                                                                       CLEAR(FilterString);
                                                                       CLEAR(KeyStroke);
                                                                     END;
    
                                                                     CurrForm.Trigger.ACTIVATE;
    
                                                                     FilterString += FORMAT(KeyStroke);
                                                                     CLEAR(KeyStroke);
    
                                                                     SETFILTER(Description,'%1','@'+FilterString+'*');
                                                                     CurrForm.UPDATE;
                                                                   END;
                                                                    }
        { 1000000009;CommandButton;220;330;1210;550 ;Name=Trigger;
                                                     Focusable=No }
        { 1000000010;TextBox;2640 ;330  ;6490 ;550  ;Focusable=No;
                                                     SourceExpr=FilterString }
        { 1000000005;TableBox;220 ;1100 ;9350 ;5610 ;HorzGlue=Both;
                                                     VertGlue=Both;
                                                     Focusable=No }
        { 1000000007;TextBox;0    ;3850 ;1700 ;440  ;ParentControl=1000000005;
                                                     InColumn=Yes;
                                                     SourceExpr="No." }
        { 1000000011;Label  ;0    ;0    ;0    ;0    ;ParentControl=1000000007;
                                                     InColumnHeading=Yes }
        { 1000000012;TextBox;1700 ;3850 ;4400 ;440  ;ParentControl=1000000005;
                                                     InColumn=Yes;
                                                     SourceExpr=Description }
        { 1000000013;Label  ;0    ;0    ;0    ;0    ;ParentControl=1000000012;
                                                     InColumnHeading=Yes }
        { 1000000000;MenuButton;220;6930;3300 ;550  ;Name=SpecialKeys;
                                                     VertGlue=Bottom;
                                                     Focusable=No;
                                                     Menu=MENUITEMS
                                                     {
                                                       { ID=1000000001;
                                                         ShortCutKey=Return;
                                                         CaptionML=DEU=Enter;
                                                         OnPush=BEGIN
                                                                  MESSAGE('enter');
                                                                  CurrForm.Trigger.ACTIVATE;
                                                                END;
                                                                 }
                                                       { ID=1000000022;
                                                         ShortCutKey=Shift+Return;
                                                         CaptionML=DEU=Shift Enter;
                                                         OnPush=BEGIN
                                                                  MESSAGE('shift enter');
                                                                  CurrForm.Trigger.ACTIVATE;
                                                                END;
                                                                 }
                                                       { ID=1000000002;
                                                         ShortCutKey=F5;
                                                         CaptionML=DEU=f5;
                                                         OnPush=BEGIN
                                                                  MESSAGE('f5');
                                                                  CurrForm.Trigger.ACTIVATE;
                                                                END;
                                                                 }
                                                       { ID=1000000015;
                                                         ShortCutKey=F7;
                                                         CaptionML=DEU=f7;
                                                         OnPush=BEGIN
                                                                  MESSAGE('f7');
                                                                  CurrForm.Trigger.ACTIVATE;
                                                                END;
                                                                 }
                                                       { ID=1000000003;
                                                         ShortCutKey=Tab;
                                                         CaptionML=DEU=tab;
                                                         OnPush=BEGIN
                                                                  MESSAGE('tab');
                                                                  CurrForm.Trigger.ACTIVATE;
                                                                END;
                                                                 }
                                                       { ID=1000000004;
                                                         ShortCutKey=Home;
                                                         CaptionML=DEU=Home;
                                                         OnPush=BEGIN
                                                                  MESSAGE('Home');
                                                                  CurrForm.Trigger.ACTIVATE;
                                                                END;
                                                                 }
                                                       { ID=1000000006;
                                                         ShortCutKey=Insert;
                                                         CaptionML=DEU=Insert;
                                                         OnPush=BEGIN
                                                                  MESSAGE('insert');
                                                                  CurrForm.Trigger.ACTIVATE;
                                                                END;
                                                                 }
                                                       { ID=1000000023;
                                                         ShortCutKey=Shift+Return;
                                                         CaptionML=DEU=Shift Insert;
                                                         OnPush=BEGIN
                                                                  MESSAGE('shift + insert');
                                                                  CurrForm.Trigger.ACTIVATE;
                                                                END;
                                                                 }
                                                       { ID=1000000014;
                                                         ShortCutKey=End;
                                                         CaptionML=DEU=End;
                                                         OnPush=BEGIN
                                                                  MESSAGE('end');
                                                                  CurrForm.Trigger.ACTIVATE;
                                                                END;
                                                                 }
                                                       { ID=1000000016;
                                                         ShortCutKey=Delete;
                                                         CaptionML=DEU=Delete;
                                                         OnPush=BEGIN
                                                                  MESSAGE('Delete');
                                                                  CurrForm.Trigger.ACTIVATE;
                                                                END;
                                                                 }
                                                       { ID=1000000024;
                                                         ShortCutKey=Shift+Delete;
                                                         CaptionML=DEU=Shift Delete;
                                                         OnPush=BEGIN
                                                                  MESSAGE('Shift Delete');
                                                                  CurrForm.Trigger.ACTIVATE;
                                                                END;
                                                                 }
                                                       { ID=1000000017;
                                                         ShortCutKey=BackSpace;
                                                         CaptionML=DEU=Back;
                                                         OnPush=BEGIN
                                                                  MESSAGE('back');
                                                                  CurrForm.Trigger.ACTIVATE;
                                                                END;
                                                                 }
                                                       { ID=1000000018;
                                                         ShortCutKey=Esc;
                                                         CaptionML=DEU=ESC;
                                                         OnPush=BEGIN
                                                                  MESSAGE('esc');
                                                                  CurrForm.Trigger.ACTIVATE;
                                                                END;
                                                                 }
                                                       { ID=1000000019;
                                                         ShortCutKey=Left;
                                                         CaptionML=DEU=left;
                                                         OnPush=BEGIN
                                                                  MESSAGE('l');
                                                                  CurrForm.Trigger.ACTIVATE;
                                                                END;
                                                                 }
                                                       { ID=1000000020;
                                                         ShortCutKey=Center;
                                                         CaptionML=DEU=middle;
                                                         OnPush=BEGIN
                                                                  MESSAGE('m');
                                                                  CurrForm.Trigger.ACTIVATE;
                                                                END;
                                                                 }
                                                       { ID=1000000021;
                                                         ShortCutKey=Right;
                                                         CaptionML=DEU=right;
                                                         OnPush=BEGIN
                                                                  MESSAGE('r');
                                                                  CurrForm.Trigger.ACTIVATE;
                                                                END;
                                                                 }
                                                     }
                                                      }
      }
      CODE
      {
        VAR
          FilterString@1000000000 : Text[1024];
          KeyStroke@1000000002 : Char;
    
        BEGIN
        END.
      }
    }
    
    
  • grilligrilli Member Posts: 33
    The previous object gives an error because of an import function that returns value. Anyway, I need to detect the above keys without pressing another simultaneously.

    Thank you,
  • ErwinErwin Member Posts: 14
    There is a Hotkey Extender available (http://www.mibuso.com/dlinfo.asp?FileID=1120). With this automation you can catch all keyboard events (almost) immediately. This depends on the TimerInterval property of your form.

    I hope it helps. It solved my problem. I had the problem that code had to executed when the Left- or Right-arrow key were pressed.
  • grilligrilli Member Posts: 33
    The automation also I catch the enter raisins I do? Is there another way to use it without a timer? Anyone know of any automation that help it capture keys? Because I have seen other sounds more effective.

    Thank you,
  • devu_13devu_13 Member Posts: 101
    Hi experts

    I am also Trying to this but at last no fillter works as on RTC client.I think for this functionality our classic client should be support by .Net plateform then we go further on it. If I worng please tell me and welcome your suggestion regarding this issue.
    Devendra Kr. Sharma
    IBIZ Consulting Services,India
Sign In or Register to comment.