![]() |
![]() |
| Paypal | FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
|
|
#1
|
|||
|
|||
|
Foco en PageControl
Gracias Román pero no hace nada poner la propiedad TabStop en false; sigue como congelado el dbgrid hasta que no le doy clic en alguna de sus celdas....
|
|
#2
|
||||
|
||||
|
Hola,
Aparentemente me funciona si pongo el DBGDatos.SetFocus en el evento OnEnter del TabSheet que contiene al DBGrid. // Saludos |
|
#3
|
||||
|
||||
|
Hola Valeria.
Una forma podría ser usando el evento OnChanging del TPageControl. Código:
...
type
TForm1 = class(TForm)
private
procedure MiPageControlChanging(Sender: TObject;
var AllowChange: Boolean);
public
procedure FormCreate(Sender: TObject);
procedure FormActivate(Sender: TObject);
end;
var
Form1: TForm1;
MiPageControl: TPageControl;
DBGDatos,DBGDatos1: TDBGrid;
Hoja1,Hoja2: TTabSheet;
implementation
procedure TForm1.MiPageControlChanging(Sender: TObject;
var AllowChange: Boolean);
begin
case TPageControl(Sender).TabIndex of
0: DBGDatos.SetFocus;
1: DBGDatos1.SetFocus;
3: // otro TTabSheet...
4: // ...
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
MiPageControl := TPageControl.Create(Self);
with MiPageControl do
begin
Parent := Self;
Align:= AlClient;
OnChanging:= MiPageControlChanging;
end;
DBGDatos:= TDBGrid.Create(self);
DBGDatos1:= TDBGrid.Create(self);
Hoja1:= TTabSheet.Create(MiPageControl);
Hoja2:= TTabSheet.Create(MiPageControl);
with Hoja1 do
begin
PageControl := MiPageControl;
DBGDatos.Parent := Hoja1;
DBGDatos.Top:= 60;
DBGDatos.Width:= 600;
DBGDatos.DataSource:= DataSource1;
ADODataSet.Active:= true;
end;
with Hoja2 do
begin
PageControl := MiPageControl;
DBGDatos1.Parent := Hoja2;
DBGDatos1.Top:= 60;
DBGDatos1.Width:= 600;
DBGDatos1.DataSource:= DataSource2;
ADODataset1.Active:= true;
end;
end;
{ FormActivate, para que aparezca con foco en DBGDatos al entrar al Form }
procedure TForm1.FormActivate(Sender: TObject);
begin
with MiPageControl do
begin
ActivePage:= Hoja1;
DBGDatos.SetFocus;
end;
end;
end.
Una cosa mas, el uso del parámetro self, es innecesario en este caso. Saludos.
__________________
Daniel Didriksen Guía de estilo - Uso de las etiquetas - La otra guía de estilo .... Última edición por ecfisa fecha: 03-08-2010 a las 04:24:06. |
|
#4
|
|||
|
|||
|
Gracias Ecfisa!!! ahora si funciona como yo queria,muchisiiiimas gracias!!
|
![]() |
| Herramientas | Buscar en Tema |
| Desplegado | |
|
|
Temas Similares
|
||||
| Tema | Autor | Foro | Respuestas | Último mensaje |
| PageControl {El Muy Mencionado} | GeoAvila | Varios | 6 | 01-03-2007 13:37:19 |
| Pagecontrol | emiliu | Varios | 3 | 02-12-2005 07:59:23 |
| Bordes de un PageControl | roman | OOP | 3 | 08-09-2004 08:56:49 |
| Ayuda con PageControl | elbilla | Varios | 3 | 19-07-2004 19:57:37 |
| Pagecontrol | Fita | Varios | 2 | 21-12-2003 05:07:03 |
|