Lazarus
Programming => General => Topic started by: Dan3468298 on August 04, 2020, 03:27:57 pm
Title:
Error: Operator is not overloaded?
Post by:
Dan3468298
on
August 04, 2020, 03:27:57 pm
Specific is error is
Code: Pascal
[Select]
[+]
[-]
unit1
.
pas
(
158
,
24
)
Error
:
Operator is
not
overloaded
:
"
Set
Of
Char"
or
"Char"
Why can't I do an 'or' conditional?
Code: Pascal
[Select]
[+]
[-]
procedure
TForm1
.
txtHeightKeyPress
(
Sender
:
TObject
;
var
Key
:
char
)
;
begin
if
Key
in
[
'0'
..
'9'
]
or
Key
=
''
then
//allow user input
else
Key
:
=
#0
;
end
;
Title:
Re: Error: Operator is not overloaded?
Post by:
JdeHaan
on
August 04, 2020, 03:31:50 pm
You have to use parenthesis in this case:
if (Key in ['0'..'9']) or (Key = '') then
Title:
Re: Error: Operator is not overloaded?
Post by:
Dan3468298
on
August 04, 2020, 04:10:27 pm
I had tried that too but it must have been an early morning brain fart typo. Thanks for the wake up!
TinyPortal
© 2005-2018