#1 2009-08-13 16:58

krtek
Senior Member
From: Łódź (Poland)
Registered: 2008-02-21
Posts: 262

WideInputQuery function fails while InputQuery does not

I've noticed that there is a problem with WideInputQuery function.
In the code beneath I get an error message: 'type mismatch'.
Replacing WideInputQuery with InputQuery solves the problem.

var
  Value: String;
begin
  Value := 'Meaningless filename.txt';
  if WideInputQuery('Incorrect filename',
    'I am not able to produce any meaningful filename!'+
    ' Would you mind giving it manually?', Value) then  FileName := Value;
end.

Regular Expressions are not as hard to understand as you may think. Check ReNamer's manual or nice Regular Expressions tutorial for more info and start to use full power of applications that use them (like ReNamer, Mp3Tag and so on).

Offline

#2 2009-08-13 19:11

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,379

Re: WideInputQuery function fails while InputQuery does not

function WideInputQuery(const ACaption, APrompt: WideString; var Value: WideString): Boolean;
function InputQuery(const ACaption, APrompt: String; var Value: String): Boolean; 

You might have missed that WideInputQuery expects all parameters to be of WideString type, while InputQuery expects normal String types.

In your code you simply have to declare your Value as WideString to make it usable in the WideInputQuery function. Variable parameters must always be of the exact type, no type casting there.

Offline

#3 2009-08-13 20:51

krtek
Senior Member
From: Łódź (Poland)
Registered: 2008-02-21
Posts: 262

Re: WideInputQuery function fails while InputQuery does not

Sorry to trouble you Denis.
Missed pretty obvious.


Regular Expressions are not as hard to understand as you may think. Check ReNamer's manual or nice Regular Expressions tutorial for more info and start to use full power of applications that use them (like ReNamer, Mp3Tag and so on).

Offline

Board footer

Powered by FluxBB