Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 21-11-2009
Avatar de José Luis Garcí
[José Luis Garcí] José Luis Garcí is offline
Miembro Premium
 
Registrado: may 2003
Ubicación: Las Palmas de G.C.
Posts: 1.372
Poder: 23
José Luis Garcí Va camino a la fama
Problemas con un statusbar

Hola compañeros el problema es el siguiente creo por código un statusbar y creo el parent a un dbgrid, lo posiciono y entonces creo los paneles, hasta aquí todo bien de momento, eñll problema aparece cuando hago lo siguiente
Código Delphi [-]
Footer.Panels.Count

Me da un Error

---------------------------
Project1
---------------------------
Access violation at address 004E3D5C in module 'Project1.exe'. Read of address 00000260.
---------------------------
Aceptar
---------------------------

Tenéis idea por que
__________________
Un saludo desde Canarias, "El abuelo Cebolleta"
Responder Con Cita
  #2  
Antiguo 21-11-2009
Avatar de jhonny
jhonny jhonny is offline
Jhonny Suárez
 
Registrado: may 2003
Ubicación: Colombia
Posts: 7.058
Poder: 30
jhonny Va camino a la famajhonny Va camino a la fama
Para este caso, creo que sería muy conveniente que nos muestres la parte de tu código, donde creas dicho statusbar en tiempo de ejecución.
__________________
Lecciones de mi Madre. Tema: modificación del comportamiento, "Pará de actuar como tu padre!"

http://www.purodelphi.com/
http://www.nosolodelphi.com/
Responder Con Cita
  #3  
Antiguo 21-11-2009
Avatar de José Luis Garcí
[José Luis Garcí] José Luis Garcí is offline
Miembro Premium
 
Registrado: may 2003
Ubicación: Las Palmas de G.C.
Posts: 1.372
Poder: 23
José Luis Garcí Va camino a la fama
Gracias por tu ayuda Jhonny, respondiendo a la pregunta a qui va las partes del código

Variables generales
Código Delphi [-]
var
  Form1: TForm1;
  footer:tstatusbar;
  fin, Colfin,colini: integer;

El OnCreate del Form
Código Delphi [-]
procedure TForm1.FormCreate(Sender: TObject);
var footer:tstatusbar;
  i:integer;
begin
     footer:=TStatusBar.Create(self);
   //  footer.SetParentComponent(DBGrid1);
     footer.Parent:=DBGrid1;
     footer.Top:=DBGrid1.Height;
     footer.Left:=DBGrid1.Left;
     footer.Width:=dbgrid1.Width;
     footer.Panels.Add;
     footer.Panels.Items[0].Width:=11;
     for I := 1 to DBGrid1.Columns.Count-1  do
     begin
        footer.Panels.Add;
        footer.Panels.Items[i].Width:=DBGrid1.Columns.Items[i-1].Width+2;
     end;
     fin:=0;
     colfin:=0;
end;

Y El DrawColumnCell
Código Delphi [-]
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
  DataCol: Integer; Column: TColumn; State: TGridDrawState);
  var i:integer;
begin
    if fin=0 then
    begin
       fin:=1;
       colini:=Column.ID;
    end;
    if column.id>Colfin then colfin:=Column.ID;

     if (DBGrid1.DataSource.DataSet.RecNo=DBGrid1.DataSource.DataSet.RecordCount)
        and
        (Column.ID=colfin) then//Saber si estamos en la última fila visible
     begin
//             
             for I := 0 to footer.Panels.Count -1  do  //AQUI DA EL FALLO
              begin
                  if (i>=(colini))and(i<=(Colfin)) then
                  begin
                    footer.Panels.Items[i].Width:=DBGrid1.Columns.Items[i].Width;
                    footer.Panels.Items[i].Text:=IntToStr(Column.ID);

                  end else Footer.Panels.Items[i].Width:=0;

              end;
              
              fin:=0;
     end;
end;
__________________
Un saludo desde Canarias, "El abuelo Cebolleta"
Responder Con Cita
  #4  
Antiguo 22-11-2009
Avatar de José Luis Garcí
[José Luis Garcí] José Luis Garcí is offline
Miembro Premium
 
Registrado: may 2003
Ubicación: Las Palmas de G.C.
Posts: 1.372
Poder: 23
José Luis Garcí Va camino a la fama
Resuelto, el problema era que declaraba footer, tanto en las variables generales del form y luego lo repetía declarándolo en el OnCreate del Form


Código Delphi [-]
var
  Form1: TForm1;
  footer:tstatusbar;
  fin, Colfin,colini: integer;


Código Delphi [-]
procedure TForm1.FormCreate(Sender: TObject);
var footer:tstatusbar;
  i:integer;
begin

Elimine este último y funciono, ahora me toca pelearme con otras partes del código.
__________________
Un saludo desde Canarias, "El abuelo Cebolleta"
Responder Con Cita
Respuesta



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
Problemas con un Panel del StatusBar - psOwnerDrw sitrico Varios 1 05-09-2007 23:20:26
Statusbar con colores JULIPO Varios 4 04-06-2006 00:22:05
StatusBar de dos lineas melon OOP 8 14-01-2006 14:15:31
Textos En StatusBar kman Varios 2 22-12-2005 00:06:56
statusbar y hints urush30 Varios 3 05-08-2004 12:43:55


La franja horaria es GMT +2. Ahora son las 22:50:49.


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