Luli
18-11-2004, 23:09:13
hola, tengo problemas para ejecutar un programa, cuando lo quiero correr me sale este mensaje de error:
project proyecto1.exe raised exception class EInvalid Operation with message 'cannot focus a disabled or invisible window'. Process stopped.
El codigo del programa es este:
unit programita1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
ListBox1: TListBox;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
//procedure Button2Click(Sender: TObject);
//procedure Button3Click(Sender: TObject);
//procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
type
TApunt=^TNodo;
TNodo=record
Info: String;
Liga: TApunt;
end;
var
Form1: TForm1;
Inicio,Fin: TApunt;
implementation
{$R *.dfm}
//AGREGAR ELEMENTO
procedure Agregar(Elem: String);
Var Aux: TApunt;
begin
Inicio:=Nil;
New(Aux);
Aux^.Liga:=Nil;
Aux^.Info:=Elem;
if Inicio=Nil then Inicio:=Aux
else Fin^.Liga:=Aux;
Fin:=Aux;
end;
//ORDENAR ELEMENTO
//procedure Ordenar; {Ordenación por el método de Selección}
{Var Mov,Posicion,Menor: TApunt;
Aux: String;
begin
Mov:=Inicio;
if Inicio<>Fin then {Esto garantiza que hay mas de un elemento}
{repeat
Posicion:=Mov;
Menor:=Mov;
repeat
if Posicion^.Info<Menor^.Info then Menor:=Posicion;
Posicion:=Posicion^.Liga;
until Posicion=Nil;
if Menor<>Mov then {Si es necesario el intercambio}
{begin
Aux:=Menor^.Info;
Menor^.Info:=Mov^.Info;
Mov^.Info:=Aux;
end;
Mov:=Mov^.Liga;
until Mov=Fin;
end; }
//DESTRUIR ELEMENTO
{procedure Destruir;
begin
While Inicio<>Nil do
begin
Fin:=Inicio^.Liga;
dispose(Inicio);
Inicio:=Fin;
end;
end;}
procedure TForm1.Button1Click(Sender: TObject);
begin
if Edit1.Text<>' ' then {Garantiza que hay algo escrito}
begin
Agregar(Edit1.Text);
ListBox1.Items.Add(Edit1.Text);
Edit1.Clear;
//Edit1.SetFocus;
end;
end;
{procedure TForm1.Button2Click(Sender: TObject);
Var Aux: TApunt;
begin
Ordenar;
ListBox1.Clear;
Aux:=Inicio;
while Aux<>Nil do
begin
ListBox1.Items.Add(Aux^.Info);
Aux:=Aux^.Liga;
end;
end; }
{procedure TForm1.Button3Click(Sender: TObject);
begin
Close;
end; }
procedure TForm1.FormCreate(Sender: TObject);
begin
ListBox1.Clear;
Edit1.Clear;
Edit1.SetFocus;
end;
{procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Destruir;
end; }
end.
No sé cual es el problema, me gustaria que me ayudaran
Muchas gracias
project proyecto1.exe raised exception class EInvalid Operation with message 'cannot focus a disabled or invisible window'. Process stopped.
El codigo del programa es este:
unit programita1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
ListBox1: TListBox;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
//procedure Button2Click(Sender: TObject);
//procedure Button3Click(Sender: TObject);
//procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
type
TApunt=^TNodo;
TNodo=record
Info: String;
Liga: TApunt;
end;
var
Form1: TForm1;
Inicio,Fin: TApunt;
implementation
{$R *.dfm}
//AGREGAR ELEMENTO
procedure Agregar(Elem: String);
Var Aux: TApunt;
begin
Inicio:=Nil;
New(Aux);
Aux^.Liga:=Nil;
Aux^.Info:=Elem;
if Inicio=Nil then Inicio:=Aux
else Fin^.Liga:=Aux;
Fin:=Aux;
end;
//ORDENAR ELEMENTO
//procedure Ordenar; {Ordenación por el método de Selección}
{Var Mov,Posicion,Menor: TApunt;
Aux: String;
begin
Mov:=Inicio;
if Inicio<>Fin then {Esto garantiza que hay mas de un elemento}
{repeat
Posicion:=Mov;
Menor:=Mov;
repeat
if Posicion^.Info<Menor^.Info then Menor:=Posicion;
Posicion:=Posicion^.Liga;
until Posicion=Nil;
if Menor<>Mov then {Si es necesario el intercambio}
{begin
Aux:=Menor^.Info;
Menor^.Info:=Mov^.Info;
Mov^.Info:=Aux;
end;
Mov:=Mov^.Liga;
until Mov=Fin;
end; }
//DESTRUIR ELEMENTO
{procedure Destruir;
begin
While Inicio<>Nil do
begin
Fin:=Inicio^.Liga;
dispose(Inicio);
Inicio:=Fin;
end;
end;}
procedure TForm1.Button1Click(Sender: TObject);
begin
if Edit1.Text<>' ' then {Garantiza que hay algo escrito}
begin
Agregar(Edit1.Text);
ListBox1.Items.Add(Edit1.Text);
Edit1.Clear;
//Edit1.SetFocus;
end;
end;
{procedure TForm1.Button2Click(Sender: TObject);
Var Aux: TApunt;
begin
Ordenar;
ListBox1.Clear;
Aux:=Inicio;
while Aux<>Nil do
begin
ListBox1.Items.Add(Aux^.Info);
Aux:=Aux^.Liga;
end;
end; }
{procedure TForm1.Button3Click(Sender: TObject);
begin
Close;
end; }
procedure TForm1.FormCreate(Sender: TObject);
begin
ListBox1.Clear;
Edit1.Clear;
Edit1.SetFocus;
end;
{procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Destruir;
end; }
end.
No sé cual es el problema, me gustaria que me ayudaran
Muchas gracias