在Delphi的编译状态中,右击代码窗口,选Debug→ Evaluate/Modify ,出现Evaluate/Modify 窗口。该窗口有什么作用?怎样使用?它的Expression、 Result 、NewValue在编译时候有甚用?我英文差,看不懂帮助,请知道者说明一下!

解决方案 »

  1.   

    // delphi 的帮助,应该不用翻译吧,good luck
    Use the Evaluate or Modify dialog box to evaluate or change the value of an existing expression or property. You can evaluate any valid language expression, except those that contain:Local or static variables that are not accessible from the current execution point.
    Function calls.To open the Evaluate/Modify dialog box, do one of the following:Choose Run|Evaluate/Modify.
    Choose Debug|Evaluate/Modify from the Code editor context menu.The debugger enables you to change the values of variables and items in data structures during the course of a debugging session. You can test different error hypotheses and see how a section of code behaves under different circumstances by modifying the value of data items during a debugging session.When you modify the value of a data item through the debugger, the modification is effective for that specific program run only. Changes you make through the Evaluate/Modify dialog box do not affect your source code or the compiled program. To make your change permanent, you must modify your source code in the Code editor, then recompile your program.Modifying values (especially pointer values and array indexes), can have undesirable effects because you can overwrite other variables and data structures. Use caution whenever you modify program values from the debugger.Keep these points in mind when you modify program data values:You can change individual variables or elements of arrays and data structures, but you cannot change the contents of an entire array or data structure.
    The expression in the New Value box must evaluate to a result that is assignment-compatible with the variable you want to assign it to. A good rule of thumb is that if the assignment would cause a compile-time or run-time error, it is not a legal modification value.
    You cannot directly modify untyped arguments passed into a function, but you can typecast them and then assign new values.Formatting valuesWhen you evaluate an expression, the current value of the expression is displayed in the Result field of the dialog box. If you need to, you can format the result by adding a comma and one or more format following specifiers to the end of the expression entered in the Expression edit box. See Evaluate/modify format specifiers for more information.Dialog box optionsExpressionLets you specify the variable, field, array, or object to evaluate or modify. Enter the variable, field, array, or object to evaluate or modify.By default, the word at the cursor position in the Code editor is placed in the Expression edit box. You can accept this expression, enter another one, or choose an expression from the history list of previously evaluated expressions.Evaluate tool buttonEvaluates the expression in the Expression edit box and displays its value in the Result edit box.Modify tool buttonChanges the value of the expression in the Expression edit box using the value in the New Value edit box.Watch tool buttonCreates a watch for the expression you have selected.Inspect tool buttonOpens a new Debug Inspector on the data element you have selected. This is useful for seeing the details of data structures, classes, and arrays.Help buttonDisplays Help on the dialog box.ResultDisplays the value of the item specified in the Expression text box after you choose Evaluate or Modify.New valueAssigns a new value to the item specified in the Expression edit box. Enter a new value for the item if you want to change its value.
      

  2.   

    在可以执行到的代码里面下一个断点,然后打开Evaluate/modify(ctrl+f7)表示式输入form1.caption
    它的result显示form1
    你在new value输入一个名字,如"猪“
    那么它的值就已经改变了