FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Temas de Hoy |
|
Herramientas | Buscar en Tema | Desplegado |
#1
|
||||
|
||||
Crear un DbGrid en una TTabSheet
Estoy intentando crear un DBGrid dentro una pestaña de un PageControl, para lo cual estoy empleando el siguiente código
pero al intentar correr la apliación me envía el siguiente mensaje Incompatibles types TWidgetControl And TTabSheet, al comentariar la línea donde fijo de parent del DBGrid, corre, pero no me dibuja el compnente, no se como puede remediar el error o cual sintaxis a emplear Última edición por dec fecha: 21-07-2007 a las 02:01:19. |
#2
|
||||
|
||||
Hola,
¿De dónde se supone que sale "TWidgetControl"? |
#3
|
||||
|
||||
No se porque sale ese error pero ami si q me corre esa prsion de codigo, esta es la forma en la q corre
como no mencionas de q tipo es Hoja1 supuse q era TTabSheet |
#4
|
||||
|
||||
Codigo Completo
Como tal vez o fui claro en la pregunta, me permito enviar la totalidad del código (no es muy largo por fortuna), y para mayor información estoy trabajando en Delphi 6 Enterprise.
el código es el siguiente unit UFormulario; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, QComCtrls,DB, ComCtrls, QDBGrids; type TForm1 = class(TForm) procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; PCInformacion : TPageControl; DTPFecha : TDateTimePicker; Hoja1, Hoja2: TTabSheet; DataSource : TDataSource; DBGDatos: TDBGrid; implementation {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject); begin PCInformacion:= TPageControl.Create(Self); with PCInformacion do begin Parent:= Form1; Align:= AlClient; end; Hoja1:=TTabSheet.Create(PCInformacion); with Hoja1 do begin PageControl:= PCInformacion; Caption:= 'Hola Mundo'; DTPFecha:= TDateTimePicker.Create(Self); DBGDatos:= TDBGrid.Create(Self); DataSource:= TDataSource.Create(Self); DTPFecha.Parent:= Hoja1; DBGDatos.Parent := Hoja1; // aqui es donde sale el error mencionado en la pregunta end; Hoja2:= TTabSheet.Create(PCInformacion); with Hoja2 do begin PageControl:= PCInformacion; Caption:= 'Hola Mundo en la Hoja 2'; end; end; procedure TForm1.FormDestroy(Sender: TObject); begin DTPFecha.Destroy; Hoja1.Destroy; Hoja2.Destroy; PCInformacion.Destroy; end; end. Gracías de antemano por su tiempo y colaboración |
#5
|
||||
|
||||
Pues no le veo utilidad a las unidades QComCtrls, QDBGrids, o almenos a mi no me las reconoce , en vez de eso use ComCtrls, DBGrids y corre normal, te pego el codigo sin esas unidades. una cosa mas para liberar, se usa la rutina Free o FreeAndNil... un consejo al escribir tu mensaje resalta tu codigo con el boton Resaltar sintaxis delphi y quedara mas legible, suerte que existe Jedi Code Format, sino, no seria legible tu codigo.
Una cosa mas al crear los controles, debes darles las coordenadas y dimensiones sino no los vaz a ver o van estar desordenados Última edición por ariefez fecha: 22-07-2007 a las 16:12:38. |
#6
|
||||
|
||||
Mejor Imposible
Les agradezco a todos su colaboración, me agrada muchisimo poder contar con gente con ustedes y con un sitio tan especilizado y organizado como el club.
Gracías |
|
|
Temas Similares | ||||
Tema | Autor | Foro | Respuestas | Último mensaje |
crear TTabSheet en tiempo de ejecucion | Neiro | Lazarus, FreePascal, Kylix, etc. | 4 | 06-10-2006 23:03:08 |
TTabSheet - TForm - Parent | neon | OOP | 0 | 11-01-2005 16:34:03 |
editor sencillo con pagecontrol y ttabsheet | oesteve | OOP | 0 | 03-07-2003 10:36:47 |
como duplico intancias TtabSheet | orfeo | OOP | 2 | 12-05-2003 04:15:04 |
|