With .. Do : Syntax Error: Colon ":" expected

Issue #147 resolved
0r0 created an issue

Project: DWSWebServer there is an error with the With ... syntax

the example below does not use With and works.

var _col :TColumn = JQGrid.AddColumn;
    _col.Title:= 'Column 1';
    _col.Name:= 'Col1';
    _col.IsSortable:= true;

this example uses the With method and is giving the error:

With JQGrid.AddColumn Do
  begin
    Title:= 'Column 2';
    Name:= 'Col2';
    IsSortable:= false;
  end;

Error:

Syntax Error: Colon ":" expected [line: 174, column: 14, file: main.pas]

Tanks Cristiano

Comments (4)

  1. Eric Grange repo owner

    "with" blocks in DWScript do not allow implicit scoping, you have to use an explicit alias, f.i.

    with col := JQGrid.AddColumn do begin
        col.Title := 'Column 2';
        col.Name := 'Col2';
        col.IsSortable := False;
    end;
    

    or "with col : TColumn = JQGrid.AddColumn do begin"

  2. Log in to comment