unit uMenuChr;

      {=================================================================}
      {                                                                 }
      {  SW pro terminaly SofCon                                        }
      {                                                                 }
      {  Rozsireni tAMenu pro znakovy terminal                          }
      {                                                                 }
      {  (C) 1996, SofCon s.r.o., Stresovicka 49, Praha 6               }
      {            Vypracoval: R.Bukovsky                               }
      {=================================================================}

{$ifdef USE_SETS_INC} { Pokud chces tak nastav v Compiler Options/Conditional defines }
   {$I Sets.inc}
{$endif}


interface
uses
  uString,
  uTermChr,
  uATerm,
  uAMenu,
  NumToStr,
  Kernel;

const
  cVerNo = $0252; { BCD format }
  cVer   = '02.52,07.09.2004';

type
  pMenuChr     = ^tMenuChr;
  pMMenuChr    = ^tMMenuChr;
  tMMenuChr    = procedure(P: pMenuChr);
  tMenuEditStr = String[100];
  tMenuChr     = object(tAMenu)
    MenuEditStr     : tMenuEditStr;{ editovany String }
    WaitTick        : Word;        { interval cekani }
    KeyDir          : Boolean;     { pri True se v InitParam volaji SetKeyDir }
    PlaceString     : ^String;
    PlaceStringSize : Byte;
    InsertMode      : Boolean;
    SetUpKeyChar    : Char;        { znak pro vstup do SetUpTerminal }
    constructor Init(Menu: pMenu; EndIndex: Word;
                     var DisplayString, HelpString: String;
                     Terminal: pTermChr; ParTerm: tParamStr;
                     WaitMenu: Word);
                {AMetod je ukazatel na pole pointeru na procedury
                typu tMetod, EndInex je index posledni
                procedury v poli A^, pDisplayStr je ukazatel
                na String pro zobrazeni na vDisplay, pHelpStr
                je ukazatel na String pro zobrazeni helpu.
                SizeStack je velikost stacku pro menu.
                pTerm je ukazatel na objekt fiktivniho
                terminalu  (napriklad Term).
                ParTerm je String s inicializacnimi parametry
                pro display v UTERM.}
    destructor  Done;                 virtual;
                {zrusi objekt Term}
    procedure   InitParam;            virtual;
                {Ve skokove tabulce nastavuje implicitni
                 procedury pro probehnuti RUN a implicitni
                 nastaveni modifikacnich promennych objektu}
    procedure   mUserFirst;           virtual;
                {Metoda je zarazena do bloku volani hned
                 za inicializacni user proceduru a prova-
                 di spolecnou akci pro vsechny menu.}
    procedure   mDisplayMenu;
                {Metoda pro vypis dat na display}
    procedure   mNextMenu;
                {Metoda pro modifikaci ridici promenne podle
                 prijateho ActCharu}
    function    InVerifyChar: Boolean;    {navraci True je-li ActChar v VerifyChar}
    function    NotInVerifyChar: Boolean; {navraci True neni-li ActChar v VerifyChar}
    procedure   DisableKeyDir;
                {Navrati nastaveni klaves 2 8 ze sipek na
                 cislice}
    procedure   EnableKeyDir;
                {Nastavi klavesy 2 8 na sipky}
    procedure   edStr;
                {editace Stringu MenuEditStr}
    procedure   DisplayStr;
                {zobrazi String MenuEditStr ve stejnem okne a
                za stejnych podminek jako edStr, ale
                needituje ho. Testuje klavesnici a prijima ActChary
                do promenne ActChar. Kdyz nic neprijme tak tam da
                #0. Reaguje na Help.}
    procedure   ToFirstChar(var Stri:String);
                {Doplni String o sekvenci
                 (zClrScr+ Stri +zPgUp+zHome+N*zRi),
                 ktera odsune kursor na pocatek textu Stringu,
                 mimo mezery}
    procedure   PrepareEditStr(var Stri:String; SkipBlank: Boolean);
                { Priprava retezce pred editaci, doplni jej mezerami
                  na sirku okna, pokud SkipBlank=False pak editace
                  zacina v leveho hornim rohu okna, pokud je True pak
                  editace zacina na prvnim neprazdnem znaku
                  (pro cisla zarovnana doprava) }
    procedure   SetEditBinCursor(Position:byte); {nastavi EditBinCursor}
    procedure   ToEndChar(var Stri:String);
                {Doplni String o sekvenci
                 (zClrScr+ Stri +zRi),
                 ktera odsune kursor na konec textu Stringu}
    procedure   SetDestString(var S: String; Len: Byte);
                { Nastavi ukazatel na string }
    procedure   ClearDestString;
    procedure   SetInsertMode;
                { Nastavi mod vkladani pro editaci }
    procedure   SetOverMode;
                { Nastavi mod prepisovani pro editaci }
    procedure   PlaceXYString     (X,Y: Byte; S: tMenuEditStr);
                { Vlozi string do editacniho stringu }
    procedure   PlaceXYByte       (X,Y: Byte; B: Byte; Len: Byte);
    procedure   PlaceXYWord       (X,Y: Byte; W: Word; Len: Byte);
    procedure   PlaceXYInteger    (X,Y: Byte; I: Integer; Len: Byte);
    procedure   PlaceXYLongint    (X,Y: Byte; L: Longint; Len: Byte);
    procedure   PlaceXYReal       (X,Y: Byte; R: Real; Len: Byte; Flt: Byte);
    procedure   PlaceXYRealExp    (X,Y: Byte; R: Real; Len: Byte);

    procedure   PlaceXYByteHex    (X,Y: Byte; B: Byte);
    procedure   PlaceXYWordHex    (X,Y: Byte; W: Word);
    procedure   PlaceXYLongintHex (X,Y: Byte; L: Longint);

    procedure   PlaceXYByteBin    (X,Y: Byte; B: Byte);
    procedure   PlaceXYWordBin    (X,Y: Byte; W: Word);
    procedure   PlaceXYLongIntBin (X,Y: Byte; L: LongInt);
    procedure   PlaceXYSetBin     (X,Y: Byte; S: Longint; Len: Byte);

    procedure   PlacePosString    (P: Byte; S: tMenuEditStr);
                { Vlozi string do editacniho stringu }
    procedure   PlacePosByte      (P: Byte; B: Byte; Len: Byte);
    procedure   PlacePosWord      (P: Byte; W: Word; Len: Byte);
    procedure   PlacePosInteger   (P: Byte; I: Integer; Len: Byte);
    procedure   PlacePosLongint   (P: Byte; L: Longint; Len: Byte);
    procedure   PlacePosReal      (P: Byte; R: Real; Len: Byte; Flt: Byte);
    procedure   PlacePosRealExp   (P: Byte; R: Real; Len: Byte);

    procedure   PlacePosByteHex   (P: Byte; B: Byte);
    procedure   PlacePosWordHex   (P: Byte; W: Word);
    procedure   PlacePosLongintHex(P: Byte; L: Longint);

    procedure   PlacePosByteBin   (P: Byte; B: Byte);
    procedure   PlacePosWordBin   (P: Byte; W: Word);
    procedure   PlacePosLongIntBin(P: Byte; L: LongInt);
    procedure   PlacePosSetBin    (P: Byte; S: Longint; Len: Byte);

    {----- metody pro nastaveni rezimu }
    procedure EditMenu;
    procedure EditString     (var S : String);
    procedure EditLetters    (var S : String);
    procedure EditByte       (var B : Byte;    LoLim, HiLim : Byte;    Width : Byte);
    procedure EditInteger    (var I : Integer; LoLim, HiLim : Integer; Width : Byte);
    procedure EditWord       (var W : Word;    LoLim, HiLim : Word;    Width : Byte);
    procedure EditLongInt    (var L : LongInt; LoLim, HiLim : LongInt; Width : Byte);
    procedure EditReal       (var R : Real;    LoLim, HiLim : Real;    Width : Byte; Float : Byte);
    procedure EditRealExp    (var R : Real;    LoLim, HiLim : Real;    Width : Byte);

    procedure EditByteHex    (var B: Byte);    {editace byte hex}
    procedure EditWordHex    (var W: Word);    {editace word hex}
    procedure EditLongintHex (var L: LongInt); {editace Longint hex}

    procedure EditReturn;
    procedure EditPassWord   (var PW : String);
    procedure EditWait       (WaitT: LongInt);
    procedure EditWaitPress  (WaitT: LongInt);

    procedure EditByteBin    (var B: Byte);    {editace byte hex}
    procedure EditWordBin    (var W: Word);    {editace word hex}
    procedure EditSetBin     (var S: LongInt; Len : Byte); {editace Longint hex}
  end;

                       {Je-li EditEnter=True EDITACNI PROCEDURY dynamicky
                       zobrazuji typ jako v editacnim okne a az po stlaceni
                       VerifyChar zacnou editovat. Editace se potvrzuje
                       opet stlacenim VerifyChar. Pokud se obrdzi pri
                       cekani, nebo pri edaci TerminateChar neni v VerifyChar,
                       tak se cinnost konci}


(******************************************************************************)
procedure edString       (P: pAMenu); {editace Stringu}
procedure edMenu         (P: pAMenu); {prosty prijem ukoncovacich ActCharu}
                                      {test na stisk klavesy, ActChar=klavesa
                                       jinak ActChar=#0, umi Help}
procedure edByteHex      (P: pAMenu); {editace byte hex}
procedure edWordHex      (P: pAMenu); {editace word hex}
procedure edLongintHex   (P: pAMenu); {editace Longint hex}
procedure edByteBin      (P: pAMenu); {editace Byte bin}
procedure edWordBin      (P: pAMenu); {editace word bin}
procedure edSetBin       (P: pAMenu); {editace mnoziny bin}
procedure edWait         (P: pAMenu); {proste cekani delky EditWait [ms]}
procedure edWaitPress    (P: pAMenu); {cekani delky EditWait [ms], behem
                                       cekani se testuje klavesnice a pri
                                       stisku se skoci podle prijateho ActCharu}
procedure edPassWord     (P: pAMenu); {editace hesla}
procedure edReturn       (P: pAMenu); {provede rovnou return}
procedure edCislo        (P: pAMenu); {dekadicka editace cisla. Podle EditNum
                                       se ridi zda jde o byte, word, integer,
                                       longint nebo real. Ostatni podminky vypisu
                                       zustavaji}
procedure edByteDec      (P: pAMenu); {editace cisla Byte dekadicky}
procedure edWordDec      (P: pAMenu); {editace cisla Word dekadicky}
procedure edInteger      (P: pAMenu); {editace cisla Integer reaguje na EditMultipl}
procedure edLongint      (P: pAMenu); {editace cisla Longint reaguje na EditMultipl}
procedure edReal         (P: pAMenu); {editace cisla Real    reaguje na EditMultipl}


procedure InitRunMenu(
  Menu: pMenuChr;
  MName: IdentType; MStack: Word; MSPrio: Integer; MDPrio:Byte;
  TName: IdentType; TStack: Word; TSPrio: Integer; TDPrio:Byte;
  MWaitTick, TWaitTick: Word;
  PUser1,PUser2 : tMMenu;
  var FlEnd: Boolean);
                  {Vytvori a spusti proces pro probihani skrz
                  jednotlive polozky menu}

{#######################################################################################}
implementation

uses
  Timer;

const
  mi : real = 0.434294481903251827651128918;  {log(e)}

{$F+}
procedure TermTick(
  var Term: tTermChr;
  TName: IdentType; TStack: Word; TSPrio: Integer; TDPrio:Byte;
  TWaitTick: Word;
  var FlEnd: Boolean); far;
{$F-}
                  {Vytvori a spusti proces pro probihani skrz
                  jednotlive polozky menu}
begin
   Start(TName,TStack,TSPrio,TDPrio); Exit;
   repeat
       Term.Tick;
       Wait(TWaitTick);
   until FlEnd;
end;

{-------------------------------------}
{$F+}
procedure InitRunMenu(
  Menu: pMenuChr;
  MName: IdentType; MStack: Word; MSPrio: Integer; MDPrio:Byte;
  TName: IdentType; TStack: Word; TSPrio: Integer; TDPrio:Byte;
  MWaitTick, TWaitTick: Word;
  PUser1,PUser2 : tMMenu;
  var FlEnd: Boolean);
                  {Vytvori a spusti proces pro probihani skrz
                  jednotlive polozky menu}
{$F-}
begin
   PUser1(Menu);
   Start(MName,MStack,MSPrio,MDPrio); Exit;
   TermTick(Menu^.Term^,TName,TStack,TSPrio,TDPrio,TWaitTick,FlEnd);
   repeat
       Menu^.Run;
       PUser2(Menu);
       Wait(MWaitTick);
   until FlEnd;
   Abort(TName);
   Menu^.Done;
end;


{-------------------------------------}
constructor tMenuChr.Init(Menu: pMenu; EndIndex: Word;
                           var DisplayString, HelpString: String;
                           Terminal: pTermChr; ParTerm: tParamStr;
                           WaitMenu: Word);
                           {A je ukazatel na pole pointeru na procedury
                           typu tMetod, EndInex je index posledni
                           procedury v poli A^, pDisplayStr je ukazatel
                           na String pro zobrazeni na vDisplay, pHelpStr
                           je ukazatel na String pro zobrazeni helpu.
                           SizeStack je velikost stacku pro menu.
                           pTerm je ukazatel na objekt fiktivniho
                           terminalu  (napriklad Term).
                           ParTerm je String s inicializacnimi parametry
                           pro display v UTERM.}
begin
{$ifdef Ver60}
  tAMenu.Init(Menu,EndIndex,DisplayString,HelpString);
{$else}
  inherited Init(Menu,EndIndex,DisplayString,HelpString);
{$endif}
  PlaceString     :=nil;
  PlaceStringSize :=0;
  InsertMode      :=false;
  Term            :=Terminal;
  WaitTick        :=WaitMenu;
  SetUpKeyChar    :=zShiftEnter;
  {===========}
  InitParam;
  {===========}
  with Term^ do
  begin
    SetTDispParam(ParTerm);
    GetWindow(PrimEditWBeginX,PrimEditWBeginY,PrimEditWWidth,PrimEditWHeight);
    HideDispCursor;
    ClrScr;
    EditEnd:=TerminateChar;
  end;
  KeyDir:=False;
end;

{-------------------------------------}
destructor tMenuChr.Done; {zrusi objekt Term}
begin
{$ifdef Ver60}
  if Term<>nil then
{$endif}
{$ifdef Ver70}
  if Assigned(Term) then
{$endif}
    Dispose(Term,Done);
{$ifdef Ver60}
  tAMenu.Done;
{$else}
  inherited Done;
{$endif}
end;

{-------------------------------------}
procedure  tMenuChr.InitParam;
                                {Ve skokove tabulce nastavuje implicitni
                                 procedury pro probehnuti RUN a implicitni
                                 nastaveni modifikacnich promennych objektu}
var p : pointer;

begin
 {$ifdef Ver60}
  tAMenu.InitParam;
 {$else}
  inherited InitParam;
 {$endif}
  p:=@tMenuChr.mUserFirst;
  UserFirst:=tMMenu(p);
  p:=@tMenuChr.mDisplayMenu;
  DisplayMenu:=tMMenu(p);
  UserSecond:=edMenu;
  p:=@tMenuChr.mNextMenu;
  NextMenu:=tMMenu(p);
  TerminateChar:=[zUp,zDn,zCr,zEsc];
  VerifyChar:=[zCr];
  if KeyDir then EnableKeyDir;
end;

{-------------------------------------}
procedure  tMenuChr.mDisplayMenu;
begin
  with Term^ do
  begin
    if flTickExecute then
    begin
      flTickExecute:=false;
      Suspend_DispRefresh;
      if ClrScreen then
        ClrScr
      else
        GotoXY(1,1);
      WriteS(MenuDispStr^);
      Release_DispRefresh;
    end;
  end;
end;

procedure tMenuChr.edStr;
var
   WX,WY,WWith,WHigh : Byte;
begin
  with Term^ do
  begin
    EditEnd:=TerminateChar-['8','2'];
    if flUpDn then EditEnd:= EditEnd-[zUp,zDn,zLe,zRi]; {!Po}
    GetWindowE(WX,WY,WWith,WHigh);
    SetWindowE(EditWBeginX,EditWBeginY,EditWWidth,EditWHeight);
    ShowDispCursor;
   {$V-}
    ReadLnH(MenuEditStr,MenuHelpStr^);
   {$V+}
    repeat
      ActChar:=ReadLnResult;
      if ActChar=#0 then
        Wait(WaitTick);
    until ActChar<>#0;
    HideDispCursor;
    SetWindowE(WX,WY,WWith,WHigh);
  end;
end;

function  tMenuChr.InVerifyChar: Boolean;
begin
  InVerifyChar:=ActChar in VerifyChar;
end;

function  tMenuChr.NotInVerifyChar: Boolean;
begin
  NotInVerifyChar:=not(ActChar in VerifyChar);
end;

procedure tMenuChr.DisplayStr;
var
   WX,WY,WWith,WHigh : Byte;      {puvodni rozmery aktivniho okna}
   myFlDTick         : Boolean;
begin
  with Term^ do
  begin
    if flTickExecute then
    begin
      flTickExecute:=false;
      Suspend_DispRefresh;

      GetWindow(WX,WY,WWith,WHigh);
      SetWindow(EditWBeginX,EditWBeginY,EditWWidth,EditWHeight);
      MenuEditStr:=zClrScr+MenuEditStr+zPgUp+zHome;
      WriteS(MenuEditStr);
      SetWindow(WX,WY,WWith,WHigh);

      Release_DispRefresh;
    end;

    if not(KeyPressed)
    then
      begin
        ActChar:=#0;
        Wait(WaitTick)
      end
    else
      begin
        ActChar:=ReadKey;
        if ActChar=zF1 then
        begin
          Help(MenuHelpStr^);
          while HelpReady<>S_HelpReady do
            Wait(WaitTick);
        end;
      end;
  end;
end;

{-------------------------------------}

procedure edMenu(P: pAMenu);     {prosty prijem ukoncovacich ActCharu}
                                    {test na stisk klavesy, ActChar=klavesa
                                    jinak ActChar=#0, umi Help}
begin
  with pMenuChr(p)^,Term^ do
  begin
     if ((MenuInt <> []) and MenuIntEnable) then
       Exit;
     if not(KeyPressed) then
       ActChar:=#0
     else
     begin
       ActChar:=Readkey;
       if TransUpCase then
         ActChar:=UpCase(ActChar);
       if ActChar=zF1 then
       begin
         Help(MenuHelpStr^);
         while HelpReady<>S_HelpReady do Wait(WaitTick);
         ActChar:=#0;
       end
     end;
  end;
end;

{-------------------------------------}
procedure edString(P: pAMenu);   {editace Stringu}
label l1;
{-----}
begin
  with pMenuChr(p)^,Term^ do
  begin
    if ((MenuInt<>[])and MenuIntEnable) then
      Exit;

    if EditEnter then
    begin
      flTickExecute:=True;

      LockKernel;
      MenuEditStr:=String(EditVal^);
      UnLockKernel;
      DisplayStr;

      if InVerifyChar then
        goto l1;
    end
    else
    begin
  l1:
      repeat
        LockKernel;
        MenuEditStr:=String(EditVal^);
        UnLockKernel;
       {$V-}
        PrepareEditStr(MenuEditStr, False);
       {$V+}
        edStr;
      until NotInVerifyChar or
            (Length(MenuEditStr)<=EditHiLimit);
      if InVerifyChar then
      begin
        LockKernel;
        String(EditVal^):=MenuEditStr;
        UnLockKernel;
        EditOk:=True;
      end;
    end;
  end;
end;

{-------------------------------------}
procedure edWordHex(P: pAMenu);   {editace word hex}
label l1;
var
  NumWord : Word;
  Code    : Integer;
  B       : Byte;
begin
  with pMenuChr(p)^,Term^ do
  begin
    if ((MenuInt<>[])and MenuIntEnable) then
      Exit;

    if EditEnter then
    begin
      flTickExecute:=True;

      MenuEditStr:=WordStrHex(word(EditVal^));
      DisplayStr;

      if ActChar in VerifyChar then
        goto l1;
    end
    else
    begin
  l1:
      repeat
        MenuEditStr:=WordStrHex(word(EditVal^));
       {$V-}
        PrepareEditStr(MenuEditStr, True);
       {$V+}
        edType:=edHexNum; {!Po-Feb,2001}
        edStr;
        if InVerifyChar then
        begin
          repeat
             B:=Pos(' ',MenuEditStr);
             if B<>0 then Delete(MenuEditStr,B,1);
          until B=0;
          MenuEditStr:='$'+MenuEditStr;
      {$R-}
      {$ifndef Ver60} {$Q-} {$endif}
          Val(MenuEditStr,NumWord,Code);
      {$R+}
      {$ifndef Ver60} {$Q+} {$endif}
        end;
      until NotInVerifyChar or
            (Code=0);
      if InVerifyChar then
      begin
        Word(EditVal^):=NumWord;
        EditOk:=True;
      end;
    end;
  end;
end;

{-------------------------------------}
procedure edLongintHex(P: pAMenu);{editace Longint hex}
label l1;
var
  NumLongint: LongInt;
  Code      : Integer;
  B         : Byte;
begin
  with pMenuChr(p)^,Term^ do
  begin
    if ((MenuInt<>[])and MenuIntEnable) then
      Exit;

    if EditEnter then
    begin
      flTickExecute:=True;

      MenuEditStr:=LongintStrHex(LongInt(EditVal^));
      DisplayStr;

      if ActChar in VerifyChar then
        goto l1;
    end
    else
    begin
  l1:
    repeat
      MenuEditStr:=LongintStrHex(LongInt(EditVal^));
     {$V-}
      PrepareEditStr(MenuEditStr, True);
     {$V+}
      edType:=edHexNum; {!Po-Feb,2001}
      edStr;
      if InVerifyChar then
      begin
        repeat
          B:=Pos(' ',MenuEditStr);
          if B<>0 then Delete(MenuEditStr,B,1);
        until B=0;
        MenuEditStr:='$'+MenuEditStr;
   {$R-}
   {$ifndef Ver60} {$Q-} {$endif}
        Val(MenuEditStr,NumLongint,Code);
   {$R+}
   {$ifndef Ver60} {$Q+} {$endif}
      end;
      until NotInVerifyChar or
            (Code=0);
      if InVerifyChar then
      begin
        LockKernel;
        Longint(EditVal^):=NumLongint;
        UnLockKernel;
        EditOk:=True;
      end;
    end;
  end;
end;


{-------------------------------------}
procedure edByteHex(P: pAMenu);   {editace byte hex}
label l1;
var
  NumByte : Byte;
  Code    : Integer;
  B       : Byte;
begin
  with pMenuChr(p)^,Term^ do
  begin
    if ((MenuInt<>[])and MenuIntEnable) then
      Exit;

    if EditEnter then
    begin
      flTickExecute:=True;

      MenuEditStr:=LongintStrHex(LongInt(EditVal^));
      DisplayStr;

      if ActChar in VerifyChar then
        goto l1;
    end
    else
    begin
  l1:
      repeat
        MenuEditStr:=ByteStrHex(Byte(EditVal^));
       {$V-}
        PrepareEditStr(MenuEditStr, True);
       {$V+}
        edType:=edHexNum; {!Po-Feb,2001}
        edStr;
        if InVerifyChar then
        begin
          repeat
             B:=Pos(' ',MenuEditStr);
             if B<>0 then Delete(MenuEditStr,B,1);
          until B=0;
          MenuEditStr:='$'+MenuEditStr;
      {$R-}
      {$ifndef Ver60} {$Q-} {$endif}
          Val(MenuEditStr,NumByte,Code);
      {$R+}
      {$ifndef Ver60} {$Q+} {$endif}
        end;
      until NotInVerifyChar or
            (Code=0);
      if InVerifyChar then
      begin
        Byte(EditVal^):=NumByte;
        EditOk:=True;
      end;
    end;
  end;
end;

{-------------------------------------}
procedure edWordBin(P: pAMenu);   {editace word bin}
label l1;
var
  NumWord : Word;
  Code    : Boolean;
  i       : Byte;
  OldFlIns: Boolean;
begin
  with pMenuChr(p)^,Term^ do
  begin
    if ((MenuInt<>[])and MenuIntEnable) then
      Exit;

    if EditEnter then
    begin
      flTickExecute:=True;

      MenuEditStr:=WordStrBin(Word(EditVal^));{!Po}
      if flTerm06 then
        begin
             Delete(MenuEditStr,5,1);
             Delete(MenuEditStr,9,1);
             Delete(MenuEditStr,13,1);
        end; {/Po}
      DisplayStr;

      if ActChar in VerifyChar then
        goto l1;
    end
    else
    begin
  l1:
      repeat
        MenuEditStr:=WordStrBin(word(EditVal^));
        {!Po-Feb,2001}
  {Provadi zkraceni editovaneho stringu na 16 znaku (sirka displeje TERM06)}
        if flTerm06 then
           begin
                Delete(MenuEditStr,5,1);
                Delete(MenuEditStr,9,1); {!We 7.9.2004 toto zde chybelo}
                Delete(MenuEditStr,13,1);
           end;
        {/Po}
       {$V-}
        PrepareEditStr(MenuEditStr, True);
       {$V+}
        if EditBinCursor>1 then
        begin
          for i:=2 to EditBinCursor
          do MenuEditStr:=MenuEditStr+zRi;
        end;
        with Term^ do
        begin
          OldFlIns:=FlIns;
          FlIns:=false;
        end;
        edType:=edBinNum; {!Po-Feb,2001}
        edStr;
        Term^.FlIns:=OldFlIns;
        if InVerifyChar then
        begin
          Code:=True;
          for i:=1 to Length(MenuEditStr) do
            Code:=Code and ((MenuEditStr[i]=' ')or(MenuEditStr[i]='1')or(MenuEditStr[i]='0'));
          if Code then
            NumWord:=BinStrWord(MenuEditStr);
        end;
      until NotInVerifyChar or
            Code;
      if InVerifyChar then
      begin
        word(EditVal^):=NumWord;
        EditOk:=True;
      end;
    end;
  end;
end;

{-------------------------------------}
procedure edByteBin(P: pAMenu);   {editace Byte bin}
label l1;
var
  NumByte : Byte;
  Code    : Boolean;
  i       : Byte;
  OldFlIns: Boolean;
begin
  with pMenuChr(p)^,Term^ do
  begin
    if ((MenuInt<>[])and MenuIntEnable) then
      Exit;

    if EditEnter then
    begin
      flTickExecute:=True;

      MenuEditStr:=ByteStrBin(LongInt(EditVal^));
      DisplayStr;

      if ActChar in VerifyChar then
        goto l1;
    end
    else
    begin
  l1:
      repeat
        MenuEditStr:=ByteStrBin(Byte(EditVal^));
       {$V-}
        PrepareEditStr(MenuEditStr, True);
       {$V+}
        if EditBinCursor>1 then
        begin
          for i:=2 to EditBinCursor
          do MenuEditStr:=MenuEditStr+zRi;
        end;
        with Term^ do
        begin
          OldFlIns:=FlIns;
          FlIns:=false;
        end;
        edType:=edBinNum; {!Po-Feb,2001}
        edStr;
        Term^.FlIns:=OldFlIns;
        if InVerifyChar then
        begin
          Code:=True;
          for i:=1 to Length(MenuEditStr) do
            Code:=Code and ((MenuEditStr[i]=' ')or(MenuEditStr[i]='1')or(MenuEditStr[i]='0'));
          if Code then
          NumByte:=BinStrByte(MenuEditStr);
        end;
      until NotInVerifyChar or
            Code;
      if InVerifyChar then
      begin
        Byte(EditVal^):=NumByte;
        EditOk:=True;
      end;
    end;
  end;
end;

{-------------------------------------}
procedure edSetBin(P: pAMenu);    {editace mnoziny bin}
label l1;
var
  NumWord : Word;
  NumWord1: Word;
  Code    : Boolean;
  i,b     : Byte;
  OldFlIns: Boolean;
{---------}
  procedure PomocSetB;
  begin
    with pMenuChr(p)^,Term^ do
    begin
      if EditNumElementsSet>16 then
      MenuEditStr:=WordStrBin(word(EditVal^));
      if EditNumElementsSet>12
      then
        begin
          repeat
           i:=Pos(' ',MenuEditStr);
           if i<>0 then
             Delete(MenuEditStr,i,1);
          until i=0;
          b:=0;
        end
      else if EditNumElementsSet>8
           then b:=1
           else if EditNumElementsSet>4
                then b:=2
                else b:=3;
      Delete(MenuEditStr,1,16+b-EditNumElementsSet);
    end;
  end;
{---------}
begin
  with pMenuChr(p)^,Term^ do
  begin
    if ((MenuInt<>[])and MenuIntEnable) then
      Exit;

    if EditEnter then
    begin
      flTickExecute:=True;

      MenuEditStr:=WordStrBin(LongInt(EditVal^));
      DisplayStr;

      if ActChar in VerifyChar then
        goto l1;
    end
    else
    begin
  l1:
      repeat
        PomocSetB;
       {$V-}
        PrepareEditStr(MenuEditStr, True);
       {$V+}
        if EditBinCursor>1 then
        begin
          for i:=2 to EditBinCursor
          do MenuEditStr:=MenuEditStr+zRi;
        end;
        with Term^ do
        begin
          OldFlIns:=FlIns;
          FlIns:=false;
        end;
        edType:=edBinNum; {!Po-Feb,2001}
        edStr;
        Term^.FlIns:=OldFlIns;
        if InVerifyChar then
        begin
          Code:=True;
          for i:=1 to Length(MenuEditStr) do
            Code:=Code and ((MenuEditStr[i]=' ')or(MenuEditStr[i]='1')or(MenuEditStr[i]='0'));
          if Code then
          begin
            NumWord:=BinStrWord(MenuEditStr);
            NumWord1:=NumWord;
            for i:=1 to EditNumElementsSet do
              NumWord1:=NumWord1 shr 1;
          end;
        end;
      until NotInVerifyChar or
            (Code and (NumWord1=0));
      if InVerifyChar then
      begin
        if EditNumElementsSet>8 then
          Word(EditVal^):=NumWord
        else
          Byte(EditVal^):= LO(NumWord);
        EditOk:=True;
      end;
    end;
  end;
end;

{-------------------------------------}
procedure edWait(P: pAMenu);      {proste cekani delky EditWait [ms]}
var
  Timer : tTimer;
begin
  with pMenuChr(p)^,Timer do
  begin
    ActChar:=zDn;
    SaveTime;
    while not TstTime(EditWaitTime) do
      Wait(WaitTick);
  end;
end;

{-------------------------------------}
procedure edWaitPress(P: pAMenu);  {cekani delky EditWait [ms], behem
                                       cekani se testuje klavesnice a pri
                                       stisku se skoci podle prijateho ActCharu}
var
  Timer : tTimer;
begin
  with pMenuChr(p)^,Timer,Term^ do
  begin
    ActChar:=zDn;
    SaveTime;
    while not TstTime(EditWaitTime) do
    begin
      if ((MenuInt<>[])and MenuIntEnable) then
        Exit;
      if not(KeyPressed) then
        Wait(WaitTick)
      else
      begin
        ActChar:=Readkey;
        if ActChar=ZF1 then
        begin
          Help(MenuHelpStr^);
          while HelpReady<>S_HelpReady do Wait(WaitTick);
          ActChar:=#0;
        end
        else
          exit;
      end;
    end;
  end;
end;

{-------------------------------------}
procedure edReturn(P: pAMenu);   {provede ihned return}
begin
  pMenuChr(P)^.ActChar:=zEsc;
end;

{-------------------------------------}
procedure edPassWord(P: pAMenu); {editace hesla}
label l1;
var
  i  : Byte;
begin
  with pMenuChr(p)^,Term^ do
  begin
    if ((MenuInt<>[])and MenuIntEnable) then
      Exit;

    if EditEnter then
    begin
      flTickExecute:=True;

      LockKernel;
      MenuEditStr:=String(EditVal^);
      UnLockKernel;
      DisplayStr;

      if ActChar in VerifyChar then
        goto l1;
    end
    else
    begin
  l1:
      GotoXY(EditWBeginX,EditWBeginY);
      MenuEditStr:='';
      WriteS('_');

      Disp^.UpdateDisplay;

      repeat
        while not KeyPressed do Wait(WaitTick);
        ActChar:=ReadKey;
{       if ((ActChar in [#$1f..#$7f])and(Length(MenuEditStr)<EditWWidth)){!Po-Feb,2001}
        if (not flUpDn and (ActChar in [#$1f..#$7f])and(Length(MenuEditStr)<EditWWidth)){!Po-Feb,2001}
          or (flUpDn and (ActChar in [zLe,zRi,zUp,zDn])) {!Po-Feb,2001}
           then
        begin
          if (Length(MenuEditStr)+1)<EditWWidth then
            WriteS(zLe+'*_')
          else
            WriteS(zLe+'*');
          MenuEditStr:=MenuEditStr+ActChar;

          Disp^.UpdateDisplay;

        end;
        if ActChar=zF1 then
        begin
          Help(MenuHelpStr^);

          Disp^.UpdateDisplay;

          while HelpReady<>S_HelpReady do
            Wait(WaitTick);

          Disp^.UpdateDisplay;
        end;
{     until ActChar in (TerminateChar-['8','2']);{!Po-Feb,2001}
      until (ActChar in (TerminateChar-['8','2',zUp,zDn])) or
            (not flUpDn and (ActChar in (TerminateChar-['8','2']))); {!Po-Feb,2001}

      if InVerifyChar then
      begin
        for i:=1 to Length(MenuEditStr) do MenuEditStr[i]:=UpCase(MenuEditStr[i]);
        LockKernel;
        String(EditVal^):=MenuEditStr;
        UnLockKernel;
      end;
    end;
  end;
end;

{-------------------------------------}
procedure edCislo(P: pAMenu); {dekadicka editace cisla. Podle EditNum
                               se ridi zda jde o byte, word, integer,
                               longint nebo real. Ostatni podminky vypisu
                               zustavaji}
label l1;
var
  CisloReal : Real;
  Code    : Integer;

  procedure PomocCislo;
  begin
    with pMenuChr(p)^,Term^ do
    begin
      case EditNum of
         nByte   :begin
                    LockKernel;
                    CisloReal:=byte(EditVal^)* EditMultipl;
                    UnLockKernel;
                  end;
         nWord   :begin
                    LockKernel;
                    CisloReal:=word(EditVal^)* EditMultipl;
                    UnLockKernel;
                  end;
         nInteger:begin
                    LockKernel;
                    CisloReal:=integer(EditVal^)* EditMultipl;
                    UnLockKernel;
                  end;
         nLongInt:begin
                    LockKernel;
                    CisloReal:=longint(EditVal^)* EditMultipl;
                    UnLockKernel;
                  end;
         nReal   :begin
                    LockKernel;
                    CisloReal:=real(EditVal^)* EditMultipl;
                    UnLockKernel;
                  end;
      end;
      if (EditReject0 and (CisloReal=0))
      then MenuEditStr:=''
      else
        begin
          case EditNum of
             nReal : begin
                       if EditSemiLogReal then
                         MenuEditStr:=RealStrExp(CisloReal,EditValWidth)
                       else
                         MenuEditStr:=RealStrDec(CisloReal,EditValWidth,EditValDecimals)
                     end;
            else    Str(CisloReal:EditValWidth:0,MenuEditStr);
          end;
        end;
    end;
  end;
{---------}
begin
  with pMenuChr(p)^,Term^ do
  begin
    if ((MenuInt<>[])and MenuIntEnable) then
      Exit;

    if EditEnter then
    begin
      flTickExecute:=True;

      PomocCislo;
      DisplayStr;

      if ActChar in VerifyChar then
        goto l1;
    end
    else
    begin
  l1:
      repeat
        PomocCislo;
       {$V-}
        PrepareEditStr(MenuEditStr, True);
       {$V+}
        case EditNum of  {!Po-Feb,2001}
         nByte,nWord : edType:=edUnsDec;
         nInteger,nLongInt : edType := edDecNum;
         else
             edType:=edRealNum;
        end;
        {/Po}
        edStr;
        if InVerifyChar then
        begin
    {$R-}
    {$ifndef Ver60} {$Q-} {$endif}
          Val(MenuEditStr,CisloReal,Code);
    {$R+}
    {$ifndef Ver60} {$Q+} {$endif}
        end;
      until NotInVerifyChar or
            ((Code=0)and(CisloReal>=EditLowLimit)and(CisloReal<=EditHiLimit));
      if InVerifyChar then
      begin
        if EditMultipl<>0 then
          CisloReal:=CisloReal/EditMultipl;
        case EditNum of
           nByte   :begin
                      if ((CisloReal>$ff)or(CisloReal<0)or
                          (Frac(CisloReal)<>0)) then
                        goto l1;
                      LockKernel;
                      byte(EditVal^):=lo(Trunc(CisloReal));
                      UnLockKernel;
                    end;
           nWord   :begin
                      if ((CisloReal>$ffff)or(CisloReal<0)or
                          (Frac(CisloReal)<>0)) then
                        goto l1;
                      LockKernel;
                      word(EditVal^):=Trunc(CisloReal);
                      UnLockKernel;
                    end;
           nInteger:begin
                      if ((CisloReal>MaxInt)or(CisloReal<-MaxInt)
                          or(Frac(CisloReal)<>0)) then
                        goto l1;
                      LockKernel;
                      integer(EditVal^):=Trunc(CisloReal);
                      UnLockKernel;
                    end;
           nLongInt:begin
                      if ((CisloReal>MaxLongInt)or(CisloReal<-MaxLongInt)) then
                        goto l1;
                      LockKernel;
                      longInt(EditVal^):=trunc(CisloReal);
                      UnLockKernel;
                    end;
           nReal   :begin
                      LockKernel;
                      real(EditVal^):=CisloReal;
                      UnLockKernel;
                    end;
        end;
        EditOk:=True;
      end;
    end;
  end;
end;

{-------------------------------------}
procedure edByteDec(P: pAMenu);  {editace cisla Byte dekadicky}
begin
  P^.EditNum:=nByte;
  EdCislo(P);
end;

{-------------------------------------}
procedure edWordDec(P: pAMenu);  {editace cisla Word dekadicky}
begin
  P^.EditNum:=nWord;
  EdCislo(P);
end;

{-------------------------------------}
procedure edInteger(P: pAMenu);   {editace cisla Integer}
begin
  P^.EditNum:=nInteger;
  EdCislo(P);
end;

{-------------------------------------}
procedure edLongint(P: pAMenu);   {editace cisla Longint}
begin
  P^.EditNum:=nLongInt;
  EdCislo(P);
end;

{-------------------------------------}
procedure edReal(P: pAMenu);      {editace cisla real}
begin
  P^.EditNum:=nReal;
  EdCislo(P);
end;

{-------------------------------------}
procedure  tMenuChr.mNextMenu;
                                {Metoda pro modifikaci ridici promenne podle
                                 prijateho ActCharu}
begin
{  if not (flUpDn and flEdit) then
   begin}
    {$ifdef Ver60}
      tAMenu.mNextMenu;
    {$else}
      inherited mNextMenu;
    {$endif}
      if ActMenu<>PreMenu then
        Term^.flTickExecute:=True;
      if ActChar=SetUpKeyChar then Term^.SetUpTerminal;
{   end;}
end;

{-------------------------------------}
procedure tMenuChr.mUserFirst;
begin
  Term^.EditEnd:=TerminateChar;
end;

{-------------------------------------}
procedure tMenuChr.PrepareEditStr(var Stri:String; SkipBlank: Boolean);
           { Priprava retezce pred editaci, doplni jej mezerami
             na sirku okna, pokud SkipBlank=False pak editace
             zacina v leveho hornim rohu okna, pokud je True pak
             editace zacina na prvnim neprazdnem znaku
             (pro cisla zarovnana doprava) }
var
   i   : Byte;
begin
  while Length(Stri) < EditWWidth do Stri := Stri + ' ';
  Stri:=zClrScr+Stri+zPgUp+zHome;
  if SkipBlank then
  begin
    i := 2;
    while Stri[i] = ' ' do
    begin
      Stri := Stri + zRi;
      Inc(i);
    end;
  end;
end;

{-------------------------------------}
procedure tMenuChr.SetEditBinCursor(Position:byte); {nastavi EditBinCursor}
begin
  EditBinCursor:=Position;
end;

{-------------------------------------}
procedure tMenuChr.ToFirstChar(var Stri:String);
           {Doplni String o sekvenci (zClrScr+ Stri +zPgUp+zHome+N*zRi),
           ktera odsune kursor na pocatek textu Stringu, mimo mezery.
           Funguje to i pres vice radku.}
var
   i   : Byte;
begin
  Stri:=zClrScr+Stri+zPgUp+zHome;
  i:=2;
  while Stri[i]=' ' do
  begin
    Stri:=Stri+zRi;
    Inc(i);
  end;
end;

{-------------------------------------}
procedure tMenuChr.ToEndChar(var Stri:String);
           {Doplni String o sekvenci (zClrScr+ Stri +zRi),
           ktera odsune kursor na konec textu Stringu}
begin
  Stri:=zClrScr+Stri+zRi;
end;

{-------------------------------------}
procedure   tMenuChr.DisableKeyDir;
            {Navrati nastaveni klaves 2 8 ze sipek na
             cislice}
begin
  TerminateChar:=TerminateChar-['8','2'];
  TransTab['8']:=iUp;
  TransTab['2']:=iDn;
end;

{-------------------------------------}
procedure   tMenuChr.EnableKeyDir;
            {Nastavi klavesy 2 8 na sipky}
begin
  TerminateChar:=TerminateChar+['8','2'];
  TransTab['8']:=iUp;
  TransTab['2']:=iDn;
end;
{-------------------------------------}
procedure   tMenuChr.SetDestString(var S: String; Len: Byte);
            { Nastavi editaci stringu S s delkou Len }
begin
  PlaceString       := @S;
  PlaceStringSize := Len;
  InsertMode            := false;
end;

procedure  tMenuChr.ClearDestString;
           { Zrusi nastaveni stringu }
begin
  PlaceString       := nil;
  PlaceStringSize := 0;
end;

procedure   tMenuChr.SetInsertMode;
            { Nastavi vkladani znaku }
begin
  InsertMode           := true;
end;

procedure   tMenuChr.SetOverMode;
            { Nastavi prepisovani znaku }
begin
  InsertMode           := false;
end;

procedure   tMenuChr.PlaceXYString(X,Y: Byte; S: tMenuEditStr);
            { Vlozi do (prepise) editacniho stringu dalsi retezec }
var
  P     : Byte;
  Dummy : Byte;
begin
  if PlaceString = nil then Exit;
  Term^.GetWindow(Dummy, Dummy, P, Dummy);
  P := X + ((Y-1) * P);
  If InsertMode then
  begin
    If (Length(PlaceString^) + Length(S)) > PlaceStringSize then
    begin
      PlaceString^:=Copy(PlaceString^,1,PlaceStringSize-Length(S));
      Insert(S, PlaceString^, P);
    end
    else
      Insert(S, PlaceString^, P);
  end
  else
  begin
    PlaceString^ := ConCat(Copy(PlaceString^,1, P - 1),
                           S,
                           Copy(PlaceString^, P + Length(S), Length(PlaceString^)-P-Length(S)+1{!Ce}{Length(MenuEditStr)}));
  end
end;

procedure   tMenuChr.PlaceXYByte(X,Y: Byte; B: Byte; Len: Byte);
begin
  PlaceXYString(X, Y, ByteStrDec(B, Len));
end;

procedure   tMenuChr.PlaceXYWord(X,Y: Byte; W: Word; Len: Byte);
begin
  PlaceXYString(X, Y, WordStrDec(W, Len));
end;

procedure   tMenuChr.PlaceXYInteger(X,Y: Byte; I: Integer; Len: Byte);
begin
  PlaceXYString(X, Y, IntegerStrDec(I, Len));
end;

procedure   tMenuChr.PlaceXYLongint(X,Y: Byte; L: Longint; Len: Byte);
begin
  PlaceXYString(X, Y, LongIntStrDec(L, Len));
end;

procedure   tMenuChr.PlaceXYReal(X,Y: Byte; R: Real; Len: Byte; Flt: Byte);
begin
  PlaceXYString(X, Y, RealStrDec(R, Len, Flt));
end;

procedure   tMenuChr.PlaceXYRealExp(X,Y: Byte; R: Real; Len: Byte);
begin
  PlaceXYString(X, Y, RealStrExp(R, Len));
end;

procedure   tMenuChr.PlaceXYByteHex(X,Y: Byte; B: Byte);
begin
  PlaceXYString(X, Y, ByteStrHex(B));
end;

procedure   tMenuChr.PlaceXYWordHex(X,Y: Byte; W: Word);
begin
  PlaceXYString(X, Y, WordStrHex(W));
end;

procedure   tMenuChr.PlaceXYLongIntHex(X,Y: Byte; L: Longint);
begin
  PlaceXYString(X, Y, LongIntStrHex(L));
end;

procedure   tMenuChr.PlaceXYByteBin(X,Y: Byte; B: Byte);
begin
  PlaceXYString(X, Y, ByteStrBin(B));
end;

procedure   tMenuChr.PlaceXYWordBin(X,Y: Byte; W: Word);
begin
  PlaceXYString(X, Y, WordStrBin(W));
end;

procedure   tMenuChr.PlaceXYLongIntBin(X,Y: Byte; L: LongInt);
begin
  PlaceXYString(X, Y, LongIntStrBin(L));
end;

procedure   tMenuChr.PlaceXYSetBin(X,Y: Byte; S: Longint; Len: Byte);
begin
  PlaceXYString(X, Y, SetStrBin(S, Len));
end;

procedure   tMenuChr.PlacePosString(P: Byte; S: tMenuEditStr);
            { Vlozi do (prepise) editacniho stringu dalsi retezec }
begin
  if PlaceString = nil then Exit;
  If InsertMode then
  begin
    If (Length(PlaceString^) + Length(S)) > PlaceStringSize then
    begin
      PlaceString^:=Copy(PlaceString^,1,PlaceStringSize-Length(S));
      Insert(S, PlaceString^, P);
    end
    else
      Insert(S, PlaceString^, P);
  end
  else
  begin
    PlaceString^ := ConCat(Copy(PlaceString^,1, P - 1),
                           S,
                           Copy(PlaceString^, P + Length(S), Length(PlaceString^)-P-Length(S)+1{!Ce}{Length(MenuEditStr)}));
  end
end;

procedure   tMenuChr.PlacePosByte(P: Byte; B: Byte; Len: Byte);
begin
  PlacePosString(P, ByteStrDec(B, Len));
end;

procedure   tMenuChr.PlacePosWord(P: Byte; W: Word; Len: Byte);
begin
  PlacePosString(P, WordStrDec(W, Len));
end;

procedure   tMenuChr.PlacePosInteger(P: Byte; I: Integer; Len: Byte);
begin
  PlacePosString(P, IntegerStrDec(I, Len));
end;

procedure   tMenuChr.PlacePosLongint(P: Byte; L: Longint; Len: Byte);
begin
  PlacePosString(P, LongIntStrDec(L, Len));
end;

procedure   tMenuChr.PlacePosReal(P: Byte; R: Real; Len: Byte; Flt: Byte);
begin
  PlacePosString(P, RealStrDec(R, Len, Flt));
end;

procedure   tMenuChr.PlacePosRealExp(P: Byte; R: Real; Len: Byte);
begin
  PlacePosString(P, RealStrExp(R, Len));
end;

procedure   tMenuChr.PlacePosByteHex(P: Byte; B: Byte);
begin
  PlacePosString(P, ByteStrHex(B));
end;

procedure   tMenuChr.PlacePosWordHex(P: Byte; W: Word);
begin
  PlacePosString(P, WordStrHex(W));
end;

procedure   tMenuChr.PlacePosLongIntHex(P: Byte; L: Longint);
begin
  PlacePosString(P, LongIntStrHex(L));
end;

procedure   tMenuChr.PlacePosByteBin(P: Byte; B: Byte);
begin
  PlacePosString(P, ByteStrBin(B));
end;

procedure   tMenuChr.PlacePosWordBin(P: Byte; W: Word);
begin
  PlacePosString(P, WordStrBin(W));
end;

procedure   tMenuChr.PlacePosLongIntBin(P: Byte; L: LongInt);
begin
  PlacePosString(P, LongIntStrBin(L));
end;

procedure   tMenuChr.PlacePosSetBin(P: Byte; S: Longint; Len: Byte);
begin
  PlacePosString(P, SetStrBin(S, Len));
end;

procedure   tMenuChr.EditMenu;
begin
  SetUserSecond(@edMenu);
end;

procedure   tMenuChr.EditString(var S: String);
begin
  Term^.edType:=edStrings; {!Po-Feb,2001}
  SetUserSecond(@edString);
  EditVal      := @S;
end;

procedure   tMenuChr.EditLetters(var S: String);
begin
  Term^.edType:=edLetters; {!Po-Feb,2001}
  SetUserSecond(@edString);
  EditVal      := @S;
end;

procedure   tMenuChr.EditByte(var B: Byte; LoLim, HiLim: Byte; Width: Byte);
begin
  SetUserSecond(@edCislo);
  EditNum      := nByte;
  EditVal      := @B;
  EditLowLimit := LoLim;
  EditHiLimit  := HiLim;
  EditValWidth := Width;
end;

procedure   tMenuChr.EditInteger(var I: Integer; LoLim, HiLim: Integer; Width: Byte);
begin
  SetUserSecond(@edCislo);
  EditNum      := nInteger;
  EditVal      := @I;
  EditLowLimit := LoLim;
  EditHiLimit  := HiLim;
  EditValWidth := Width;
end;

procedure   tMenuChr.EditWord(var W: Word; LoLim, HiLim: Word; Width: Byte);
begin
  SetUserSecond(@edCislo);
  EditNum      := nWord;
  EditVal      := @W;
  EditLowLimit := LoLim;
  EditHiLimit  := HiLim;
  EditValWidth := Width;
end;

procedure   tMenuChr.EditLongInt(var L: LongInt; LoLim, HiLim: LongInt; Width: Byte);
begin
  SetUserSecond(@edCislo);
  EditNum      := nLongInt;
  EditVal      := @L;
  EditLowLimit := LoLim;
  EditHiLimit  := HiLim;
  EditValWidth := Width;
end;

procedure   tMenuChr.EditReal(var R: Real; LoLim, HiLim : Real; Width, Float : Byte);
begin
  SetUserSecond(@edCislo);
  EditNum         := nReal;
  EditVal         := @R;
  EditLowLimit    := LoLim;
  EditHiLimit     := HiLim;
  EditValWidth    := Width;
  EditValDecimals := Float;
  EditSemiLogReal := False;
end;

procedure   tMenuChr.EditRealExp(var R: Real; LoLim, HiLim : Real; Width: Byte);
begin
  SetUserSecond(@edCislo);
  EditNum         := nReal;
  EditVal         := @R;
  EditLowLimit    := LoLim;
  EditHiLimit     := HiLim;
  EditValWidth    := Width;
  EditSemiLogReal := True;
end;

procedure   tMenuChr.EditReturn;
begin
  SetUserSecond(@edReturn);
end;

procedure   tMenuChr.EditPassWord(var PW: String);
begin
  SetUserSecond(@edPassWord);
  EditVal := @PW;
end;

procedure   tMenuChr.EditWait(WaitT : LongInt);
begin
  SetUserSecond(@edWait);
  EditWaitTime:=WaitT;
end;

procedure  tMenuChr.EditWaitPress(WaitT : LongInt);
begin
  SetUserSecond(@edWaitPress);
  EditWaitTime:=WaitT;
end;

procedure   tMenuChr.EditByteHex(var B : byte);
begin
  SetUserSecond(@edByteHex);
  EditVal:=@B;
end;

procedure   tMenuChr.EditWordHex(var W : word);
begin
  SetUserSecond(@edWordHex);
  EditVal:=@W;
end;

procedure   tMenuChr.EditLongIntHex(var L : LongInt);
begin
  SetUserSecond(@edLongIntHex);
  EditVal:=@L;
end;

procedure   tMenuChr.EditByteBin(var B : byte);
begin
  SetUserSecond(@edByteBin);
  EditVal:=@B;
end;

procedure   tMenuChr.EditWordBin(var W : word);
begin
  SetUserSecond(@edWordBin);
  EditVal:=@W;
end;

procedure   tMenuChr.EditSetBin(var S : LongInt; Len : Byte);
begin
  SetUserSecond(@edSetBin);
  EditVal:=@S;
  EditNumElementsSet:=Len;
end;


end.
