How can you use a case statement depending on the badge caption ? Tried :
procedure TForm2.Button1Click(Sender: TObject);
begin
case AdvBadgeGlowButton1.Caption of
'Test' : showmessage('Test')
end;
'' : showmessage('Empty')
end;
but am getting :
[dcc32 Error] Unit2.pas(29): E2001 Ordinal type required [dcc32 Error]
Unit2.pas(30): E2010 Incompatible types: 'Integer' and 'string'
case
cannot be used for values that are not ordinal types (typically integer values), as the error message says. You'll need to use if..else
instead.
procedure TForm2.Button1Click(Sender: TObject);
begin
if AdvBadgeGlowButton1.Caption = 'Test' then
ShowMessage('Test')
else if AdvBadgeGlowButton1.Caption = '' then
ShowMessage('Empty')
else
ShowMessage('Got unknown caption ' + AdvBadgeGlowButton1.Caption);
end;