Design mode functions

TradeDesign provides the possibility to implement functions which are available in the design mode. Those rules are to be coded in the file identified by the setting of DesignMNU in the System section of tdpara.ini in the ini-partition.

In the standard this setting holds DesignMNU=DSGNFNCS.TXT.

Thus the file DSGNFNCS.TXT in the current ini-partition holds the text to be executed.

Working sample:

To load the content of a stored dump the below rule allows to assign the loading function to the key F1 in design mode

[F1]
         GetDirStream( $DirStm, GetPath( "dump" ), "*.lst", 0 )
         if ErrorCode > 0 then
           StreamClear( $DirStm )
         endif
         StreamClear( $SelStm )
         for $Idx = 1 to StreamCount( $DirStm )
           $Lin = StreamGetLine( $DirStm, $Idx )
           StreamLoad( $LstStm, GetPath( "dump" ) + $Lin )
           $Fnd = StreamSearch( $LstStm, "GetFrameName: " )
           if $Fnd > 0 then
             $FndLin = StreamGetLine( $LstStm, $Fnd )
             if Pos( ToUpper( $FndLin ), GetFramename + "." ) = 0 then
               $Fnd = 0
             endif
           endif
           if $Fnd > 0 then
             $Fnd = StreamSearch( $LstStm, "User Id:" )
             if $Fnd > 0 then
               $FndLin = StreamGetLine( $LstStm, $Fnd )
               $Usr = Trim( Mid( $FndLin, 9 ) )
             else
               $Usr = ""
             endif
             $Fnd = StreamSearch( $LstStm, "Date / Time:" )
             if $Fnd > 0 then
               $FndLin = StreamGetLine( $LstStm, $Fnd )
               $DatTim = Trim( Mid( $FndLin, 13 ) )
             else
               $DatTim = ""
             endif
             StreamInsert( $SelStm, 0, $Lin + TAB + $Usr + TAB + $DatTim )
           endif
         next
         $str = ""
         $str = $str + "0 1 \"File\" 140" + CR
         $str = $str + "1 2 \"User\" 60" + CR
         $str = $str + "2 3 \"Date / Time\" 150" + CR
         $str = $str + "P COLORED TRUE" + CR
         $str = $str + "P VERTLINES TRUE" + CR
         $str = $str + "P HORZLINES TRUE" + CR
         if IsEmpty( $SelStm ) then
           PromptOK( "$1", "No dump of current transaction found" )
         else
         # fill stream with all filenames + errormessages
           $LstSel = PromptStream( $SelStm, "Available dump's of the current transaction to be loaded", $str )
           if not IsEmpty( $LstSel ) then
             $LstFil = Mid( $LstSel, 1, Pos( $LstSel, TAB ) - 1 )
             # get selection which dump to load
             $DmpFil = GetPath( "dump" ) + Basename( $LstFil ) + ".dmp"
             # load DMP-file
             StreamLoad( $DmpStm, $DmpFil )
             LoadData( \, $DmpStm )
             $Msg = Formattext( "You have loaded all data stored in dumpfile\n$1\nand thus the control entries are now corrupt. Please analyse the data\nas necessary and then terminate the transaction from Designmode.\nPlease avoid any continuation of the transaction.", $DmpFil )
             PromptOK( "$1", $Msg )
           endif
         endif