Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > OOP
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Coloboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #9  
Antiguo 10-07-2008
sancarlos sancarlos is offline
Miembro
 
Registrado: sep 2007
Ubicación: Cartago , Tres Rios , Costa Rica
Posts: 48
Poder: 0
sancarlos Va por buen camino
Caro Mira :

type
myarray= array of string ;
var
A:myarray;
tMyBoton: Tedit;
firstrow,secondrow, i : integer;
nameofport:string;
begin

setlength (A,200);

adoports.Close;
adoports.SQL.Clear;
adoports.SQL.Add('select * from ts.tcpports where active='+chr(39)+'T'+chr(39)+'');
adoports.Prepared;
adoports.Open;

firstrow:=0;
secondrow:=0;
i:=0;
while not adoports.Eof do begin

try
tMyBoton := Tedit.create(self);

finally

tmyboton.Name:='s'+adoportsportnumber.AsString+'s';//new
tMyBoton.Parent := MyPanel;
if firstrow <= 600 then begin
firstrow := firstrow + 30;
tMyBoton.left := firstrow;
tMyBoton.Top := 2;
end ;

if (firstrow>600 ) and (firstrow <= 1200) then begin
secondrow := secondrow + 30;
tMyBoton.left := secondrow;
tMyBoton.Top := 30 ;
end ;

tMyBoton.Width := 25;
tMyboton.height := 25;
tMyBoton.visible := true;
tMyBoton.OnClick := self.MyClick;
tMyBoton.tag := 1 ;

if adoportsstatus.AsInteger = 0 then begin
tMyboton.ShowHint:=true;
tMyBoton.Hint:='Ip: '+adoportsaddress.AsString + 'Socket: '+ adoportssocket.AsString;
tMyBoton.Color:=clred;
tMyBoton.font.Color:=clwhite;
tMyBoton.Cursor:=crHandPoint;
tMyBoton.ReadOnly:=true;
tMyBoton.BorderStyle:=bsnone;
tMyBoton.PopupMenu:=menuports;
end ;

if adoportsstatus.AsInteger = 1 then begin

tMyboton.ShowHint:=true;
tMyBoton.Hint:='Ip: '+adoportsaddress.AsString + 'Socket: '+ adoportssocket.AsString;
tMyBoton.Color:=clgreen;
tMyBoton.font.Color:=clwhite;
tMyBoton.Cursor:=crDrag;
tMyBoton.ReadOnly:=true;
tMyBoton.BorderStyle:=bsnone;
tMyBoton.PopupMenu:=menuports;

end ;
// i:=i+1;
A[i]:='s'+adoportsportnumber.AsString+'s' ;
inc(i);
tMyBoton.Text :=adoportsportnumber.AsString;
end;
adoports.Next;
end;

for i := low(A) to high(A) do
begin
listbox1.Items.Add(A[i]);

end;

Este Codigo me Sirve de maravilla , crea los edit , y guardo en un array los nombre de los edit que estan compuestos por el nombre del campo de la tabla y una s al principio y al final.

Todo Bien , pero el asunto es que debo estar refrescando , y pues tengo este otro proceso.

var

scrollbox:tscrollbox;
tMyBoton: Tedit;
firstrow,secondrow, i : integer;
nameofport:string;
begin

mypanel.destroy;

scrollbox := Tscrollbox.create(self);
scrollbox.Parent := frmenu;
scrollbox.Name := 'mypanel';
scrollbox.Width := 664;
scrollbox.Height := 155;
scrollbox.Left :=8;
scrollbox.Top :=426;
scrollbox.BorderStyle :=bsnone;
scrollbox.Enabled:=true;
scrollbox.Visible:=true;

adoports.Close;
adoports.SQL.Clear;
adoports.SQL.Add('select * from ts.tcpports where active='+chr(39)+'T'+chr(39)+'');
adoports.Prepared;
adoports.Open;

i:=adoports.RecordCount;

firstrow:=0;
secondrow:=0;

while not adoports.Eof do begin
try





tMyBoton := Tedit.create(self);
finally

tMyBoton.Parent := mypanel;
if firstrow <= 600 then begin
firstrow := firstrow + 30;
tMyBoton.left := firstrow;
tMyBoton.Top := 2;
end ;

if (firstrow>600 ) and (firstrow <= 1200) then begin
secondrow := secondrow + 30;
tMyBoton.left := secondrow;
tMyBoton.Top := 30 ;
end ;

tMyBoton.Width := 25;
tMyboton.height := 25;
tMyBoton.visible := true;
tMyBoton.OnClick := self.MyClick;
tMyBoton.tag := 1 ;

if adoportsstatus.AsInteger = 0 then begin

tMyboton.ShowHint:=true;
tMyBoton.Hint:='Ip: '+adoportsaddress.AsString + 'Socket: '+ adoportssocket.AsString;
tMyBoton.Color:=clred;
tMyBoton.font.Color:=clwhite;
tMyBoton.Cursor:=crHandPoint;
tMyBoton.ReadOnly:=true;
tMyBoton.BorderStyle:=bsnone;
tMyBoton.PopupMenu:=menuports;

end ;

if adoportsstatus.AsInteger = 1 then begin

tMyboton.ShowHint:=true;
tMyBoton.Hint:='Ip: '+adoportsaddress.AsString + 'Socket: '+ adoportssocket.AsString;
tMyBoton.Color:=clgreen;
tMyBoton.font.Color:=clwhite;
tMyBoton.Cursor:=crDrag;
tMyBoton.ReadOnly:=true;
tMyBoton.BorderStyle:=bsnone;
tMyBoton.PopupMenu:=menuports;

end ;


tMyBoton.Text :=adoportsportnumber.AsString;
end;
adoports.Next;
end;

Que lo mismo solo que destruye todo y vuelve a crear .

Pero lo que necesito es destruir solo los edit que ya no vienen en sql, no todos , por que a cada uno tiene algun proceso vivo en la aplicacion .....como por ejemplo un popumenu .

Pense en meter todo en un arreglo
Compara y eso va bien.... pero como destruyo solo los edit que no necesito...


Gracias... un poco largo , pero asi me explico mejor....
Responder Con Cita
 


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Crear objetos dentro de otro objeto. Nieto OOP 5 28-11-2007 23:09:12
No funcionan componentes TSelectOnRuntime cuando estan controles dentro de un panel gulder API de Windows 6 11-08-2006 09:58:50
Crear un label dentro de un panel abogado Varios 1 28-03-2005 13:43:16
Utilizar propiedad dentro de un objeto senpiterno Varios 4 21-04-2004 18:53:32
colocar un objeto dentro de un StringGrid oneromm Varios 2 27-12-2003 13:45:47


La franja horaria es GMT +2. Ahora son las 16:50:56.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi