Link to home
Create AccountLog in
Avatar of GrahamDLovell
GrahamDLovell

asked on

Firemonkey debugger problem for string value

I cannot see the result of a string assignment in the debugger:
procedure TfMMain.AudioPlay(WordStr: string);
var
  AudioFile: string;
begin
  AudioFile := fMMain.cdsWords.FieldByName('AudioName').AsString;
  if AudioFile = '' then
  begin
    MessageDlg('Audio not available for this word',TMsgDlgType.mtInformation,
      [TMsgDlgBtn.mbOK],0);
    exit;
  end;
end;

Open in new window

The debugger tells me the correct values for fMMain.cdsWords.FieldByName('AudioName').AsString;
but displays garbage value for the local value "AudioFile".

Is this a known problem / feature, or am I doing something wrong?

The debugger works OK if I attach the value directly to the form.
Avatar of Sinisa Vuk
Sinisa Vuk
Flag of Croatia image

which version of Delphi you use? Make sure than you disable optimization in Options.
Avatar of GrahamDLovell
GrahamDLovell

ASKER

XE6.

I disabled optimization in Compile options, and Built the project.

When running, instead of seeing garbage, I now get "Inaccessible value". This may not be due to turning off optimization, since I think I got that once before.
ASKER CERTIFIED SOLUTION
Avatar of Sinisa Vuk
Sinisa Vuk
Flag of Croatia image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Thanks for the expert advice on Firemonkey IDE.