2010. december 8., szerda

Using code completion for assignments


Problem/Question/Abstract:

Using code completion for assignments

Answer:

Code Completion is not only good for macros, it can prompt you with a listbox of possible arguments for an assignment statement. To see Code Completion in action, have this piece of code in your OnCreate event handler:

var
  temp1: string;
  temp2: integer;
  temp3: string;
begin
  Form1.Caption :=

After typing the ":=", press [Ctrl][space]. In a moment, you'll see a list of several the variables, methods, and objects that are in scope, and potentially valid assignments.

Since the left side of the assignment (Caption) is a string, you will see temp1 and temp3, but not temp2.

Some of the choices will have an ellipsis (...) after them, indicating an object or record that contains compatible methods or fields for the assignment.

Nincsenek megjegyzések:

Megjegyzés küldése