FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Temas de Hoy |
|
Herramientas | Buscar en Tema | Desplegado |
|
#1
|
|||
|
|||
Declarar un nombre a un edit creado en tiempo de ejecucion
Hola a todos...
lo que pasa es que quiero declararle un nombre a un TEdit que estoy creando en tiempo de ejcucion pero el problema es que los estoy creando con una matriz y no se como hacer para declararle todos los nombres a todos los TEdit... les agradesco su ayuda. Este es el codigo.
|
#2
|
||||
|
||||
¿Para qué quieres ponerle un nombre? Normalmente, el nombre de un control se utiliza sólamente para referirnos a él en código, pero, dado que lo creas en tiempo de ejecución, no hace mucho sentido.
// Saludos |
#3
|
|||
|
|||
roman lo que pasa es que después necesito llamar a todos los Edit creados para así llenarlos con una matriz y la única forma que se me ocurría era llamarlos por el nombre.
|
#4
|
|||
|
|||
Hola,
Probaste hacer esto: Código:
for f := 1 to NEdits do begin Edits := TEdit.Create(Self); Edits.Left := 21 * (c + 1); Edits.Top := 21 * (f + 1); Edits.Width := 20; Edits.Height := 20; Edits.Enabled := False; Edits.Parent := Panel1; Edits.name := 'Edit'+f.ToString; Button3.Visible := True; end; |
#5
|
|||
|
|||
juniorSoft si claro ya lo intente
|
#6
|
|||
|
|||
Amigo muchas gracias por su ayuda ya busque y pude solucionar mi error
les dejo mi solucion y me dicen que les parece
|
#7
|
||||
|
||||
El problema es que, para encontrar un control por su nombre utilizas FindComponent. Pero este método, a su vez, es un ciclo que recorre todos los componentes del formulario para encontrar una coincidencia de nombre. Entonces, si tu rejilla es, digamos, de 10x10, estarías recorriendo el formulario 100 veces.
Dado que estás creando los controles por código, fácilmente puedes declarar una matriz de Edits:
y llenarla con los controles que creas. Posteriormente será mucho más fácil utilizarlos por sus coordenadas:
// Saludos |
#8
|
|||
|
|||
Si ramon yo lo declaro así solo que es dinámico y defino la matriz a través de un TEdit y como es una matriz cuadrada no hay problema,
Declaro la matriz asi:
y defino el valor asi:
|
#9
|
|||
|
|||
Si ramon yo lo declaro así solo que es dinámico y defino la matriz a través de un TEdit y como es una matriz cuadrada no hay problema,
Declaro la matriz asi:
y defino el valor asi:
|
|
|
Temas Similares | ||||
Tema | Autor | Foro | Respuestas | Último mensaje |
Asignar un evento a un componente creado en tiempo de ejecucion | FGarcia | OOP | 7 | 12-09-2014 23:27:35 |
Evento en BitBtn creado en tiempo de ejecución | newtron | OOP | 2 | 10-05-2012 16:54:14 |
eventos de PageControl creado en tiempo de ejecucion | kaozz | OOP | 5 | 17-07-2007 15:02:10 |
Mostrar un texto creado en tiempo de ejecución | FunBit | Varios | 1 | 10-10-2005 13:23:39 |
saber el nombre de un control creado en tiempo de ejecucion | xxxlincexxx | Varios | 10 | 10-08-2003 23:45:54 |
|