Delphi-Crear objetos mediante su clase

Embed Size (px)

Citation preview

  • 7/21/2019 Delphi-Crear objetos mediante su clase

    1/5

    pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

    Secciones Foros

    Trucos

    Trabajo

    Enlaces

    FTP Club Delphi

    Componentes CCD

    Wiki

    Regstrate Usuario

    Pass

    Recurdame

    Ingresar

    Novedades Temas de hoy

    Nuevos mensajes

    Ajedrez

    FTP CCD Enlaces Buscar Trucos Trabajo Foros

    Trucos

    Palabras de bsqueda

    En ttulos y autor En ttulos texto y autor

    Buscar en... Todas las categoras

    Ordenacin

    Fecha Ttulo Autor Nmero Categ oraPara insertar trucos debes estar registrado, puedes registrarte aqu

    enviar Ocultar formulario

    ltimos trucos

    ama e

    30/03/09 581 Eliminar acentos y otros agregados de un caracter/cadenaDelphi 2009 Delphi - Cadenas Cheerpipe 2

    16/03/09 580 Noche estrellada Delphi - Grficos coso 426/02/09 578 Calendario de Semana Santa C++ Builder - Varios escafandra 317/02/09 577 Cuadros de dilogo con botones personalizados Delphi - Varios Lord Delfos 928/01/09 576 Evento OnMinimize del formulario Delphi - OOP Neftal -Germn Estvez- 529/12/08 575 Pasar un HICON a un TIcon o a un archivo C++ Builder - Varios escafandra 0

    26/12/08 574 Modificar tipo, estilo, ta mao de l etra e n TMen u yTPopUpMenu Delphi - OOP Dr. Jorge H Chamale 1

    05/12/08 572 Crear objetos mediante su clase coso 0Siguiente

    Encontrados 506, mostrando del 1 al 20

    Crear objetos mediante su clase

    Datos del autor 1909 Veces visitado Fecha ltima revisin 0

    Autor coso

    Del phi 7 Del phi InterBase Trucos Delphi XE3

    http://www.clubdelphi.com/http://www.clubdelphi.com/http://www.clubdelphi.com/http://terawiki.clubdelphi.com/http://componentes.clubdelphi.com/http://www.clubdelphi.com/enlaces/http://www.clubdelphi.com/http://www.clubdelphi.com/foros/forumdisplay.php?f=52http://www.clubdelphi.com/foros/http://www.clubdelphi.com/http://embt.co/LatAmCodeRage2http://embt.co/LatAmCodeRage2http://embt.co/LatAmCodeRage2http://pdfcrowd.com/customize/http://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdfhttp://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.clubdelphi.com%2ftrucos%2findex.php%3fid%3d572%26scroll%3d90.90908893868948%26scrollb%3d0&id=ma-150503142726-dbb440b7http://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdfhttp://www.ajedrezchat.com/http://www.clubdelphi.com/http://embt.co/LatAmCodeRage2http://terawiki.clubdelphi.com/http://componentes.clubdelphi.com/http://www.clubdelphi.com/enlaces/http://www.clubdelphi.com/foros/search.phphttp://www.clubdelphi.com/foros/forumdisplay.php?f=52http://www.clubdelphi.com/trabajo.phphttp://www.clubdelphi.com/foros/http://www.clubdelphi.com/foros/register.phphttps://www.google.com/url?ct=abg&q=https://www.google.com/adsense/support/bin/request.py%3Fcontact%3Dabg_afc%26url%3Dhttp://www.clubdelphi.com/trucos/index.php%253Fid%253D572%2526scroll%253D90.90908893868948%2526scrollb%253D0%26gl%3DUS%26hl%3Den%26client%3Dca-pub-5924059191854515&usg=AFQjCNGlCA0ebwiijyqTBPJikz3VPN4NEghttp://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-5924059191854515&output=html&h=15&slotname=8182673663&adk=3105735051&w=728&lmt=0&flash=0&url=http%3A%2F%2Fwww.clubdelphi.com%2Ftrucos%2Findex.php%3Fid%3D572%26scroll%3D90.90908893868948%26scrollb%3D0&dt=1430677645848&bpp=5&shv=r20150428&cbv=r20150409&saldr=sa&correlator=5508650508289&frm=20&ga_vid=*&ga_sid=*&ga_hid=*&ga_fc=0&u_tz=-240&u_his=1&u_java=0&u_h=1024&u_w=1280&u_ah=0&u_aw=0&u_cd=24&u_nplug=0&u_nmime=0&dff=sans-serif&dfs=16&biw=813&bih=568&eid=575144603%2C317150304&rx=0&eae=0&fc=24&brdim=0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C813%2C568&vis=0&rsz=%7C%7C%7C&abl=CS&ppjl=f&fu=1024&bc=1&ifi=1&xpc=eiLImcetkL&p=http%3A//www.clubdelphi.com&dtd=181&rl_rc=true&adsense_enabled=true&ad_type=text&oe=utf8&height=15&width=728&format=fpkc_al_lp&prev_fmts=728x15_0ads_al_s&kw_type=radlink&hl=en&kw0=Delphi+7&kw1=Delphi+InterBase&kw2=Trucos&kw3=Delphi+XE3&okw=Delphi+7&rt=ChBVRmiOAALUXwoMQlJfAGKcEghEZWxwaGkgNxoIUEkneOwAjAYoAVITCOWbhseZpsUCFY8GgQodFxEACAhttp://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-5924059191854515&output=html&h=15&slotname=8182673663&adk=3105735051&w=728&lmt=0&flash=0&url=http%3A%2F%2Fwww.clubdelphi.com%2Ftrucos%2Findex.php%3Fid%3D572%26scroll%3D90.90908893868948%26scrollb%3D0&dt=1430677645848&bpp=5&shv=r20150428&cbv=r20150409&saldr=sa&correlator=5508650508289&frm=20&ga_vid=*&ga_sid=*&ga_hid=*&ga_fc=0&u_tz=-240&u_his=1&u_java=0&u_h=1024&u_w=1280&u_ah=0&u_aw=0&u_cd=24&u_nplug=0&u_nmime=0&dff=sans-serif&dfs=16&biw=813&bih=568&eid=575144603%2C317150304&rx=0&eae=0&fc=24&brdim=0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C813%2C568&vis=0&rsz=%7C%7C%7C&abl=CS&ppjl=f&fu=1024&bc=1&ifi=1&xpc=eiLImcetkL&p=http%3A//www.clubdelphi.com&dtd=181&rl_rc=true&adsense_enabled=true&ad_type=text&oe=utf8&height=15&width=728&format=fpkc_al_lp&prev_fmts=728x15_0ads_al_s&kw_type=radlink&hl=en&kw0=Delphi+7&kw1=Delphi+InterBase&kw2=Trucos&kw3=Delphi+XE3&okw=Delphi+InterBase&rt=ChBVRmiOAALUaAoMQlJfAGKcEhBEZWxwaGkgSW50ZXJCYXNlGggzP22bngsI-ygBUhMI5ZuGx5mmxQIVjwaBCh0XEQAIhttp://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-5924059191854515&output=html&h=15&slotname=8182673663&adk=3105735051&w=728&lmt=0&flash=0&url=http%3A%2F%2Fwww.clubdelphi.com%2Ftrucos%2Findex.php%3Fid%3D572%26scroll%3D90.90908893868948%26scrollb%3D0&dt=1430677645848&bpp=5&shv=r20150428&cbv=r20150409&saldr=sa&correlator=5508650508289&frm=20&ga_vid=*&ga_sid=*&ga_hid=*&ga_fc=0&u_tz=-240&u_his=1&u_java=0&u_h=1024&u_w=1280&u_ah=0&u_aw=0&u_cd=24&u_nplug=0&u_nmime=0&dff=sans-serif&dfs=16&biw=813&bih=568&eid=575144603%2C317150304&rx=0&eae=0&fc=24&brdim=0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C813%2C568&vis=0&rsz=%7C%7C%7C&abl=CS&ppjl=f&fu=1024&bc=1&ifi=1&xpc=eiLImcetkL&p=http%3A//www.clubdelphi.com&dtd=181&rl_rc=true&adsense_enabled=true&ad_type=text&oe=utf8&height=15&width=728&format=fpkc_al_lp&prev_fmts=728x15_0ads_al_s&kw_type=radlink&hl=en&kw0=Delphi+7&kw1=Delphi+InterBase&kw2=Trucos&kw3=Delphi+XE3&okw=Trucos&rt=ChBVRmiOAALUagoMQlJfAGKcEgZUcnVjb3MaCMZ6NPQ4_nscKAFSEwjlm4bHmabFAhWPBoEKHRcRAAghttp://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-5924059191854515&output=html&h=15&slotname=8182673663&adk=3105735051&w=728&lmt=0&flash=0&url=http%3A%2F%2Fwww.clubdelphi.com%2Ftrucos%2Findex.php%3Fid%3D572%26scroll%3D90.90908893868948%26scrollb%3D0&dt=1430677645848&bpp=5&shv=r20150428&cbv=r20150409&saldr=sa&correlator=5508650508289&frm=20&ga_vid=*&ga_sid=*&ga_hid=*&ga_fc=0&u_tz=-240&u_his=1&u_java=0&u_h=1024&u_w=1280&u_ah=0&u_aw=0&u_cd=24&u_nplug=0&u_nmime=0&dff=sans-serif&dfs=16&biw=813&bih=568&eid=575144603%2C317150304&rx=0&eae=0&fc=24&brdim=0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C813%2C568&vis=0&rsz=%7C%7C%7C&abl=CS&ppjl=f&fu=1024&bc=1&ifi=1&xpc=eiLImcetkL&p=http%3A//www.clubdelphi.com&dtd=181&rl_rc=true&adsense_enabled=true&ad_type=text&oe=utf8&height=15&width=728&format=fpkc_al_lp&prev_fmts=728x15_0ads_al_s&kw_type=radlink&hl=en&kw0=Delphi+7&kw1=Delphi+InterBase&kw2=Trucos&kw3=Delphi+XE3&okw=Delphi+XE3&rt=ChBVRmiOAALUbAoMQlJfAGKcEgpEZWxwaGkgWEUzGghD9TwI6GtLtSgBUhMI5ZuGx5mmxQIVjwaBCh0XEQAI
  • 7/21/2019 Delphi-Crear objetos mediante su clase

    2/5

    pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

    Enviado por coso

    Este componente muestra como trabajar con una lista de objetos neutros mediante arreglos o arrays, asi como crear un objclase, o bien el nombre de clase desde una cadena

    Delphi [-]

    unit caja;

    interface

    uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls,extctrls,typinfo;

    type TCaja = class (TScrollBox) public objetos : array of TObject; procedure Add(AClass : TPersistentClass); constructor Create(AOwner : TComponent); override ; destructor Destroy; override ;end ;

    procedure Register ;

    implementation

    constructor TCaja.Create(AOwner : TComponent);begin inherited Create(AOwner); setlength(objetos,0);end ;

    destructor TCaja.Destroy;var i : integer;begin for i := High(objetos) downto 0 do objetos[i].Free;

    setlength(objetos,0); inherited Destroy;end ;

    procedure TCaja.Add(AClass : TPersistentClass);var ComponentMetaClass : TComponentClass; l : integer;

    http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.clubdelphi.com%2ftrucos%2findex.php%3fid%3d572%26scroll%3d90.90908893868948%26scrollb%3d0&id=ma-150503142726-dbb440b7http://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdf
  • 7/21/2019 Delphi-Crear objetos mediante su clase

    3/5

    pdfcrowd comopen in browser PRO version Are you a developer? Try out the HTML to PDF API

    j : integer; w : TControl;begin registerclass(AClass); ComponentMetaClass := TComponentClass(AClass);

    l := length(objetos);

    setlength(objetos,l+1); objetos[l] := ComponentMetaClass.Create(self);

    if objetos[l] is TControl then begin w := objetos[l] as TControl; w.Name := w.ClassName + inttostr(l);

    for j := l - 1 downto 0 do if objetos[j] is TControl then begin w.Top := (objetos[l-1] as TControl).Top + (objetos[l-1] as TControl).Height+5; break; end ; w.Parent := self; w.Left := 10;

    end ;end ;

    procedure Register ;begin RegisterComponents( 'test' , [TCaja]);end ;

    end .

    y un ejemplo de uso

    Delphi [-]

    procedure TForm1.Button1Click(Sender: TObject);var i : integer;begin for i := 0 to 10000 do begin Caja1.Add(TDBGrid);

    http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.clubdelphi.com%2ftrucos%2findex.php%3fid%3d572%26scroll%3d90.90908893868948%26scrollb%3d0&id=ma-150503142726-dbb440b7http://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdf
  • 7/21/2019 Delphi-Crear objetos mediante su clase

    4/5

    pdfcro d comopen in bro ser PRO ersion Are you a developer? Try out the HTML to PDF API

    Caja1.Add(TShape); Caja1.Add(TButton); Application.ProcessMessages; end ;end ;

    procedure TForm1.Button2Click(Sender: TObject);begin registerclasses([TLabel,TDBGrid,TShape,TQuickRep]);

    try

    Caja1.Add(GetClass(InputBox( 'clase' , 'clase (tiene que estar previamente registrada en la aplicacin)' , ' except MessageDLG( 'probablemente esta clase no esta registrada' ,mtError,[mbOk],0); end ;end ;

    Comentarios de otros usuarios

    Tus comentarios son importantes

    [CODE] [HTML] [DELPHI] [SQL] [B] [U] [I]

    Enviar tu comentario

    http://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.clubdelphi.com%2ftrucos%2findex.php%3fid%3d572%26scroll%3d90.90908893868948%26scrollb%3d0&id=ma-150503142726-dbb440b7http://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdfhttp://www.clubdelphi.com/trucos/imprimir.php?id=572
  • 7/21/2019 Delphi-Crear objetos mediante su clase

    5/5

    df di b PRO i Are o a de eloper? Tr o t the HTML to PDF API

    Inicio | Contacto | Foros | Noticias | Hosting | Trabajo

    1996-2012 Club Delphi - El punto de encuentro de los programadores de habla hispana

    Delphi Firebird Jue gos Para PC Para El Dinero Para Jugar

    http://pdfcrowd.com/customize/http://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdfhttp://pdfcrowd.com/http://pdfcrowd.com/redirect/?url=http%3a%2f%2fwww.clubdelphi.com%2ftrucos%2findex.php%3fid%3d572%26scroll%3d90.90908893868948%26scrollb%3d0&id=ma-150503142726-dbb440b7http://pdfcrowd.com/customize/http://pdfcrowd.com/html-to-pdf-api/?ref=pdfhttp://www.clubdelphi.com/http://www.clubdelphi.com/foros/sendmessage.phphttp://www.clubdelphi.com/foros/http://www.clubdelphi.com/foros/forumdisplay.php?f=34http://www.clubdelphi.net/http://www.clubdelphi.com/trabajo.phphttps://www.google.com/url?ct=abg&q=https://www.google.com/adsense/support/bin/request.py%3Fcontact%3Dabg_afc%26url%3Dhttp://www.clubdelphi.com/trucos/index.php%253Fid%253D572%2526scroll%253D90.90908893868948%2526scrollb%253D0%26gl%3DUS%26hl%3Den%26client%3Dca-pub-5924059191854515&usg=AFQjCNGlCA0ebwiijyqTBPJikz3VPN4NEghttp://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-5924059191854515&output=html&h=15&slotname=8182673663&adk=3234185753&w=728&lmt=0&flash=0&url=http%3A%2F%2Fwww.clubdelphi.com%2Ftrucos%2Findex.php%3Fid%3D572%26scroll%3D90.90908893868948%26scrollb%3D0&dt=1430677645924&bpp=5&shv=r20150428&cbv=r20150409&saldr=sa&prev_slotnames=8182673663&correlator=5508650508289&frm=20&ga_vid=*&ga_sid=*&ga_hid=*&ga_fc=0&u_tz=-240&u_his=1&u_java=0&u_h=1024&u_w=1280&u_ah=0&u_aw=0&u_cd=24&u_nplug=0&u_nmime=0&dff=sans-serif&dfs=16&biw=813&bih=568&eid=575144603%2C317150304&rx=0&eae=0&fc=24&brdim=0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C813%2C568&vis=0&rsz=%7C%7C%7C&abl=CS&ppjl=f&fu=1024&bc=1&ifi=2&xpc=Uae4l3r7v3&p=http%3A//www.clubdelphi.com&dtd=198&rl_rc=true&adsense_enabled=true&ad_type=text&oe=utf8&height=15&width=728&format=fpkc_al_lp&prev_fmts=728x15_0ads_al_s&kw_type=radlink&hl=en&kw0=Delphi+Firebird&kw1=Juegos+Para+PC&kw2=Para+El+Dinero&kw3=Para+Jugar&okw=Delphi+Firebird&rt=ChBVRmiOAARgWQoMCAQsADWwEg9EZWxwaGkgRmlyZWJpcmQaCHJI9X9zqMO3IO25zyAoATACSO25zyBSEwj1hJHHmabFAhUMGYEKHf8CAC0http://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-5924059191854515&output=html&h=15&slotname=8182673663&adk=3234185753&w=728&lmt=0&flash=0&url=http%3A%2F%2Fwww.clubdelphi.com%2Ftrucos%2Findex.php%3Fid%3D572%26scroll%3D90.90908893868948%26scrollb%3D0&dt=1430677645924&bpp=5&shv=r20150428&cbv=r20150409&saldr=sa&prev_slotnames=8182673663&correlator=5508650508289&frm=20&ga_vid=*&ga_sid=*&ga_hid=*&ga_fc=0&u_tz=-240&u_his=1&u_java=0&u_h=1024&u_w=1280&u_ah=0&u_aw=0&u_cd=24&u_nplug=0&u_nmime=0&dff=sans-serif&dfs=16&biw=813&bih=568&eid=575144603%2C317150304&rx=0&eae=0&fc=24&brdim=0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C813%2C568&vis=0&rsz=%7C%7C%7C&abl=CS&ppjl=f&fu=1024&bc=1&ifi=2&xpc=Uae4l3r7v3&p=http%3A//www.clubdelphi.com&dtd=198&rl_rc=true&adsense_enabled=true&ad_type=text&oe=utf8&height=15&width=728&format=fpkc_al_lp&prev_fmts=728x15_0ads_al_s&kw_type=radlink&hl=en&kw0=Delphi+Firebird&kw1=Juegos+Para+PC&kw2=Para+El+Dinero&kw3=Para+Jugar&okw=Juegos+Para+PC&rt=ChBVRmiOAARgZAoMCAQsADWwEg5KdWVnb3MgUGFyYSBQQxoIsve4cmX0b_Qg7bnPICgBMAJI7bnPIFITCPWEkceZpsUCFQwZgQod_wIALQhttp://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-5924059191854515&output=html&h=15&slotname=8182673663&adk=3234185753&w=728&lmt=0&flash=0&url=http%3A%2F%2Fwww.clubdelphi.com%2Ftrucos%2Findex.php%3Fid%3D572%26scroll%3D90.90908893868948%26scrollb%3D0&dt=1430677645924&bpp=5&shv=r20150428&cbv=r20150409&saldr=sa&prev_slotnames=8182673663&correlator=5508650508289&frm=20&ga_vid=*&ga_sid=*&ga_hid=*&ga_fc=0&u_tz=-240&u_his=1&u_java=0&u_h=1024&u_w=1280&u_ah=0&u_aw=0&u_cd=24&u_nplug=0&u_nmime=0&dff=sans-serif&dfs=16&biw=813&bih=568&eid=575144603%2C317150304&rx=0&eae=0&fc=24&brdim=0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C813%2C568&vis=0&rsz=%7C%7C%7C&abl=CS&ppjl=f&fu=1024&bc=1&ifi=2&xpc=Uae4l3r7v3&p=http%3A//www.clubdelphi.com&dtd=198&rl_rc=true&adsense_enabled=true&ad_type=text&oe=utf8&height=15&width=728&format=fpkc_al_lp&prev_fmts=728x15_0ads_al_s&kw_type=radlink&hl=en&kw0=Delphi+Firebird&kw1=Juegos+Para+PC&kw2=Para+El+Dinero&kw3=Para+Jugar&okw=Para+El+Dinero&rt=ChBVRmiOAARgZgoMCAQsADWwEg5QYXJhIEVsIERpbmVybxoID1ftqX-IJoIg7bnPICgBMAJI7bnPIFITCPWEkceZpsUCFQwZgQod_wIALQhttp://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-5924059191854515&output=html&h=15&slotname=8182673663&adk=3234185753&w=728&lmt=0&flash=0&url=http%3A%2F%2Fwww.clubdelphi.com%2Ftrucos%2Findex.php%3Fid%3D572%26scroll%3D90.90908893868948%26scrollb%3D0&dt=1430677645924&bpp=5&shv=r20150428&cbv=r20150409&saldr=sa&prev_slotnames=8182673663&correlator=5508650508289&frm=20&ga_vid=*&ga_sid=*&ga_hid=*&ga_fc=0&u_tz=-240&u_his=1&u_java=0&u_h=1024&u_w=1280&u_ah=0&u_aw=0&u_cd=24&u_nplug=0&u_nmime=0&dff=sans-serif&dfs=16&biw=813&bih=568&eid=575144603%2C317150304&rx=0&eae=0&fc=24&brdim=0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C813%2C568&vis=0&rsz=%7C%7C%7C&abl=CS&ppjl=f&fu=1024&bc=1&ifi=2&xpc=Uae4l3r7v3&p=http%3A//www.clubdelphi.com&dtd=198&rl_rc=true&adsense_enabled=true&ad_type=text&oe=utf8&height=15&width=728&format=fpkc_al_lp&prev_fmts=728x15_0ads_al_s&kw_type=radlink&hl=en&kw0=Delphi+Firebird&kw1=Juegos+Para+PC&kw2=Para+El+Dinero&kw3=Para+Jugar&okw=Para+Jugar&rt=ChBVRmiOAARgaQoMCAQsADWwEgpQYXJhIEp1Z2FyGgiAoBBzWVyUiSDtuc8gKAEwAkjtuc8gUhMI9YSRx5mmxQIVDBmBCh3_AgAt