Post Reply 
Help asked: systemRPL ^IFMain question
02-04-2016, 01:58 AM
Post: #4
RE: Help asked: systemRPL ^IFMain question
(02-03-2016 09:23 AM)brrm Wrote:  I am looking forward to any info on how to solve this.

Thanks for posting your code snippet, it helped to better understand what you are attempting to do.

It appears to me that you may be running into trouble by making the call to ^IfEnterKeyPress in an effort to simulate the ENTER key while an EditLine is active. I believe that procedure was designed more for other situations where you might want to do some of your own processing as a result of responding to a message, then simulating the effect of the user pressing the enter key. There's a subtle difference in context here.

The following may work better for you:

Immediately after the TakeOver in your menu routine, test for the presence of an active EditLine and take care of storing the current value if there is one. Then proceed with your calculations as needed. Here's a sample of what that might look like (with absolutely no error checking!):

Code:
TakeOver
EditLExists? IT ::
   EDITLINE$ DOSTR>                    ( Get the current edit string and parse it )
   FLASHPTR IfSetCurrentFieldValue     ( Set the value obtained as the current field value )
   InitEd&Modes                        ( Clear the current EditLine )
;

( ... further processing as needed for menu command ... )

This assumes, of course, that I've understood what you're trying to accomplish. I may have misunderstood your intent.

If it helps to see a more complete example, here's the generated source code from an InputForm built using Debug4x. This is about as simple an example as I could think of to show how the code might work. In this case, the "SUM" menu command simply adds the three values in fields 1-3 and places the total into field 4. I'm hoping this works the way you want:

Code:
( Inform Box File )  ( Inline Text )   ( Do not modify this line )
* Inform Box  Simple Inform Test  Source Code  
* Generated on 8:50:28 PM 2/3/2016 by HP InformBox Generator  
* Inform Box Designer is DavidM  
 
INCLUDE Header.h                    ( Include Standard RPL defs )
INCLUDE Informbox.h                 ( Include Definitions )
 
( Field and Label Definitions ) 
  DEFINE Field1              BINT0   
  DEFINE Field2              BINT1   
  DEFINE Field3              BINT2   
  DEFINE Field4              BINT3   
  DEFINE Label1              BINT0   
  DEFINE Label2              BINT1   
  DEFINE Label3              BINT2   
  DEFINE Label4              BINT3   
 
( Local Definitions ) 
 
NULLNAME _Simple_Inform_Test_ 
:: 
( Internal Graphical Datas ) 
  ASSEMBLEM 
  STRING { 
    $(5)#1202                       % Uncompressed string size 
    $(3)#0                          % Y offset
    $(2)#0                          % Current Field
    $(2)#4                          % Number of labels
    $(2)#4                          % Number of fields
    $(5)#269                        % Offset to fields definition

  % Start of label definitions      
    $11402D01E1002601E10F0F0F                     % Label Label1 definition
    $114026100E1002601E10F0F0F                    % Label Label2 definition
    $11402F100E1002601E10F0F0F                    % Label Label3 definition
    $11402E200E1002601E10F0F0F                    % Label Label4 definition

  % Start of field definitions    
    $1CA02B01143C2801820F0F0F0F0F0F0F0F0F09       % Field Field1 definition
    $1CA024100143C2801820F0F0F0F0F0F0F0F0F09      % Field Field2 definition
    $1CA02D100143C2801820F0F0F0F0F0F0F0F0F09      % Field Field3 definition
    $1CA02C200143C2801820F0F0F0F0F0F0F0F0F09      % Field Field4 definition
  }                                 
  !RPL FLASHPTR IsUncompressDataString ( Uncompress the string )
   
  ( Labels graphic, string on the stack ) 
  DUP BINT0  FALSE "Field 1:"             FLASHPTR IfSetGrob3 
  DUP BINT1  FALSE "Field 2:"             FLASHPTR IfSetGrob3 
  DUP BINT2  FALSE "Field 3:"             FLASHPTR IfSetGrob3 
  DUP BINT3  FALSE "Sum:"                 FLASHPTR IfSetGrob3 
   
  ( Help strings, string on the stack ) 
  BINT0  "first field"                    FLASHPTR IfSetHelpString 
  BINT1  "second field"                   FLASHPTR IfSetHelpString 
  BINT2  "third field"                    FLASHPTR IfSetHelpString 
  BINT3  "output field"                   FLASHPTR IfSetHelpString 
   
  " Simple Inform Test " FLASHPTR IfSetTitle ( Title String )
   
  ( Inform Box Message Handler )    
  ' ::                              ( Inform Box Message Handler )
      BINT12 OVER#=case :: ( Configures menu softkeys )
          DROP
          { { "SUM" ::
              TakeOver
              EditLExists? IT ::
                  EDITLINE$ DOSTR>
                  FLASHPTR IfSetCurrentFieldValue
                  InitEd&Modes
              ;
              Field1 FLASHPTR IfGetFieldValue
              Field2 FLASHPTR IfGetFieldValue
              Field3 FLASHPTR IfGetFieldValue
              %+ %+
              Field4 FLASHPTR IfSetFieldValue
              ; }
            { "CANCL" ::
                TakeOver
              TRUE ' LAM 'Quit STO
              ; }
            { "OK" ::
                TakeOver
                FLASHPTR IfEnterKeyPress
                ; } }
          TRUE
      ;
      DROPFALSE
  ;
   
( Field Definitions )             
  ( Field1 definition )             
  'DROPFALSE                        ( Field Message Handler )
  IfFieldTypeText                   ( Field Type )
  { IfObReal  }                     ( Allowed Types )
  BINT2                             ( Decomp object )
  MINUSONE                          ( No choose list )
  MINUSONE                          ( No choose decomp )
  %0                                ( Reset Value )
  %0                                ( Initial Value )
                                  
  ( Field2 definition )             
  'DROPFALSE                        ( Field Message Handler )
  IfFieldTypeText                   ( Field Type )
  { IfObReal  }                     ( Allowed Types )
  BINT2                             ( Decomp object )
  MINUSONE                          ( No choose list )
  MINUSONE                          ( No choose decomp )
  %0                                ( Reset Value )
  %0                                ( Initial Value )
                                  
  ( Field3 definition )             
  'DROPFALSE                        ( Field Message Handler )
  IfFieldTypeText                   ( Field Type )
  { IfObReal  }                     ( Allowed Types )
  BINT2                             ( Decomp object )
  MINUSONE                          ( No choose list )
  MINUSONE                          ( No choose decomp )
  %0                                ( Reset Value )
  %0                                ( Initial Value )
                                  
  ( Field4 definition )             
  'DROPFALSE                        ( Field Message Handler )
  IfFieldTypeText                   ( Field Type )
  { IfObReal  }                     ( Allowed Types )
  BINT2                             ( Decomp object )
  MINUSONE                          ( No choose list )
  MINUSONE                          ( No choose decomp )
  %0                                ( Reset Value )
  %0                                ( Initial Value )
                                  
( Group the Field Definitions in a List ) 
  ASSEMBLEM $(5)BINT32              % #8*No fields 
  !RPL {}N                          
   
  FLASHPTR IfMain2                  
   
;                                   ( end of form procedure )
 
(                                 
% Count for the Message Table  
DCCP 0 _Simple_Inform_Test_MesBase 

 
( Messages automatically copied by Inform Generator ) 
( Messages added to the Library's Message Table ) 
 
( Internal Datas: Do not touch! 
l00000000020C001C000100000014002000530069006D0070006C006500200049006E0066006F007​2006D002000540065007
S300740020
021100270020003A003A000D000A000900420049004E0054003100320020004F0056004500520023​003D0063006100730065
S0020003A003A0020002800200043006F006E00660069006700750072006500730020006D0065006​E007500200073006F0066
S0074006B00650079007300200029000D000A0009000900440052004F0050000D000A00090009007​B0020007B002000220053
S0055004D00220020003A003A000D000A00090009000900540061006B0065004F007600650072000​D000A0009000900090045
S006400690074004C004500780069007300740073003F0020004900540020003A003A000D000A000​900090009000900450044
S00490054004C0049004E0045002400200044004F005300540052003E000D000A000900090009000​90046004C004100530048
S00500054005200200049006600530065007400430075007200720065006E0074004600690065006​C006400560061006C0075
S0065000D000A00090009000900090049006E00690074004500640026004D006F006400650073000​D000A000900090009003B
S000D000A000900090009004600690065006C0064003100200046004C00410053004800500054005​200200049006600470065
S0074004600690065006C006400560061006C00750065000D000A000900090009004600690065006​C0064003200200046004C
S004100530048005000540052002000490066004700650074004600690065006C006400560061006​C00750065000D000A0009
S00090009004600690065006C0064003300200046004C00410053004800500054005200200049006​600470065007400460069
S0065006C006400560061006C00750065000D000A0009000900090025002B00200025002B000D000​A00090009000900460069
S0065006C0064003400200046004C004100530048005000540052002000490066005300650074004​600690065006C00640056
S0061006C00750065000D000A000900090009003B0020007D000D000A0009000900200020007B002​0002200430041004E0043
S004C00220020003A003A000D000A0009000900200020000900540061006B0065004F00760065007​2000D000A000900090009
S0054005200550045002000270020004C0041004D002000270051007500690074002000530054004​F000D000A000900090009
S003B0020007D000D000A0009000900200020007B00200022004F004B00220020003A003A000D000​A00090009002000200009
S00540061006B0065004F007600650072000D000A000900090020002000090046004C00410053004​800500054005200200049
S00660045006E007400650072004B0065007900500072006500730073000D000A000900090020002​00009003B0020007D0020
S007D000D000A000900090054005200550045000D000A0009003B000D000A000900440052004F005​000460041004C00530045
S000D000A003B000D000A
0002000D000A
0002000D000A
f002C010400A0002000010006004600690065006C006400310006004600690065006C00640031000​00000000100300005004
S20049004E005400320000000300540057004F000200250030000200250030000B00660069007200​730074002000660069006
S5006C0064
f0050010400A0002000010006004600690065006C006400320006004600690065006C00640032000​00000000100300005004
S20049004E005400320000000300540057004F000200250030000200250030000C00730065006300​6F006E006400200066006
S90065006C0064
f0074010400A0002000010006004600690065006C006400330006004600690065006C00640033000​00000000100300005004
S20049004E005400320000000300540057004F000200250030000200250030000B00740068006900​720064002000660069006
S5006C0064
f00B0010400A0002000010006004600690065006C006400340006004600690065006C00640034000​00000000100300005004
S20049004E0054003200000008004D0049004E00550053004F004E00450002002500300002002500​30000C006F00750074007
S0007500740020006600690065006C0064
l003400780078001800010006004C006100620065006C00310008004600690065006C00640020003​1003A
l005800780078001800010006004C006100620065006C00320008004600690065006C00640020003​2003A
l007C00780078001800010006004C006100620065006C00330008004600690065006C00640020003​3003A
l00B800780078001800010006004C006100620065006C0034000400530075006D003A
0002000D000A
0002000D000A
000600440061007600690064004D
0014005F00530069006D0070006C0065005F0049006E0066006F0072006D005F0054006500730074​005F
00040046004600460046
)

Hope this helps!
- David
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Help asked: systemRPL ^IFMain question - DavidM - 02-04-2016 01:58 AM



User(s) browsing this thread: 1 Guest(s)