Recent

Author Topic: OleVariant - problem with the name operator  (Read 685 times)

romerws

  • Newbie
  • Posts: 2
OleVariant - problem with the name operator
« on: May 13, 2019, 03:27:00 pm »
Lazarus 1.4.2
FPC 2.6.4

A piece of code:

Code: Pascal  [Select]
  1. procedure ole_test;
  2. var oleObject: OleVariant;
  3.  
  4. begin
  5.   ...
  6.   oleObject.Operator := 'WS';  // Fatal: Syntax error, "identifier" expected but "OPERATOR" found
  7.   ...
  8. end;  
  9.  
What to do?
Thanks

howardpc

  • Hero Member
  • *****
  • Posts: 3144
Re: OleVariant - problem with the name operator
« Reply #1 on: May 13, 2019, 08:28:30 pm »
You could try
Code: Pascal  [Select]
  1. oleObject.&Operator := 'WS';
I don't have Windows, so I have not tried this myself.

ASBzone

  • Sr. Member
  • ****
  • Posts: 250
  • Automation leads to relaxation...
    • BrainWaveCC Utilities
Re: OleVariant - problem with the name operator
« Reply #2 on: May 13, 2019, 08:38:21 pm »
You could try
Code: Pascal  [Select]
  1. oleObject.&Operator := 'WS';
I don't have Windows, so I have not tried this myself.

I tried this suggestion and it compiles without issues (in both delphi and objfpc modes)

The original compiles without issues if {$mode delphi} is enabled.
-ASB: https://www.BrainWaveCC.com

Lazarus v2.0.5 r62023 / FPC v3.2.0-beta-r43192 (via FpcUpDeluxe) -- Windows 64-bit install w/32-bit cross-compile
Primary System: Windows 10 Pro x64, Version 1903 (Build 18362.356)
Other Systems: Windows 10 Pro x64, Version 1809 or greater

romerws

  • Newbie
  • Posts: 2
Re: OleVariant - problem with the name operator
« Reply #3 on: May 14, 2019, 08:14:07 am »
It helped :-) Thank you very much.