Buenas tardes!
Les cuento que he conseguido parte de lo que necesito, solo me falta poder asignar en tiempo de ejecucion lo que va a hacer al momento de que presionen click en la imagen.
Por ahora este es el codigo que he logrado:
Código Delphi
[-]
procedure TFrmConFotosAros.FormShow(Sender: TObject);
var
NumEdits, I, j: Integer;
begin
j := 11;
if Query1.RecordCount > 0 then
begin
Query1.First;
while not Query1.Eof do
begin
if (Query1Ruta.IsNull) or (Query1Ruta.Value = '') then
begin
NumImagenes := NumImagenes;
Query1.Next;
end
else
begin
NumImagenes := NumImagenes + 1;
with TDBImage.Create(Self) do
begin
Name := 'DBImage' + IntToStr(NumImagenes);
Parent := Self;
Height := 126;
Width := 129;
if NumImagenes = 1 then
begin
j := j;
end
else
begin
j := j + 159;
end;
Top := j;
stretch := true;
Picture.LoadFromFile(Query1Ruta.Value);
onclick := MyClick;
end;
with TEdit.Create(Self) do
begin
Name := 'Edit' + IntToStr(NumImagenes);
Parent := Self;
Top := 25*(NumImagenes + 1);
text := Query1Cod_Prod.Value;
Visible := false;
end;
Query1.Next;
end;
end;
end;
end;
Esto es lo que debe de hacer al momento de darle click en una de las imagenes
Código Delphi
[-]
procedure TFrmConFotosAros.MyClick(Sender:TObject);
var
nomed1 : string;
nomed : integer;
begin
nombreedit:= (Sender as TdbImage).Name;
nomed:= strtoint(copy(nombreedit,8,5));
nomed1:= 'Edit' + IntToStr(nomed);
FConAros.Query1.Close();
FConAros.Query1.SQL.Clear;
FConAros.Query1.SQL.Add('SELECT * FROM QAro');
FConAros.Query1.SQL.Add(' WHERE Cod_Prod like '+quotedStr(('%'+Edit1.Text)+'%')); FConAros.Query1.Open();
if FConAros.Query1Ruta.IsNull then
FConAros.dbImage1.Visible := false
else
begin
FConAros.dbImage1.Visible := true;
FConAros.dbImage1.Picture.LoadFromFile(FConAros.Query1Ruta.Value);
end;
FconAros.Show;
close;
end;
Como puedo tomar el valor (Text) que esta en ese Edit, que el nombre saque en esa variable?.
Es decir si por ej presione en el dbimage1, en la variable nomed1 tendria Edit1. Como puedo convertirlo a un TEdit para poder usar el .text de los edits. (Edit1.text) que ahi es que guardo el codigo que me hace falta para poder filtrar el Query.
Gracias anticipadas
Saludos