Hola, es mi primera aplicacion para android, se trata de un generador de claves pero me da error (adjunto capturas) por otra parte el código es este:
Función generar clave
Código Delphi
[-]function RandomPassword(PLen: Integer): string;
var
str: string;
begin
Randomize;
case form1.cmbTipo.index of
0: begin
str := num;
end;
1: begin
str := letras;
end;
2: begin
str := num+letras;
end;
3: begin
str := sim;
end;
end;
Result := '';
repeat
Result := Result + str[Random(Length(str)) + 1];
until (Length(Result) = PLen)
end;
Código del botón encargado de lanzar la función
Código Delphi
[-]procedure TForm1.GenClick(Sender: TObject);
begin
valor:= 1; memo.Text:= '';
begin
if opc1.IsChecked = true then
begin
memo.Lines.Add(RandomPassword(strToInt(opc1.Text)));
end;
if opc2.IsChecked = true then
begin
memo.Lines.Add(RandomPassword(strToInt(opc2.text)));
end;
if opc3.IsChecked = true then
begin
memo.Lines.Add(RandomPassword(strToInt(opc3.text)));
end;
if opc4.IsChecked = true then
begin
memo.Lines.Add(RandomPassword(strToInt(cmbTipo.Items.Text)));
end;
end;
gen.Enabled:= false;
end;
Y esta la captura del error:
Si pulso sobre "Break", me marca esta línea que está dentro de la función:
Y esta la captura del movil:
Lo que si he observado es que si cambio el tipo de la variable "valor" de byte a integer, delphi no muestra ningún mensaje de error aunque si el movil, no sé si servirá de algo este dato. ¿Alguien puede sugerirme algo?
Gracias y un saludo.