Ir al contenido


Foto

Barra desplazamiento vertical dbgrid desaparece?


  • Por favor identifícate para responder
13 respuestas en este tema

#1 luk2009

luk2009

    Advanced Member

  • Moderadores
  • PipPipPip
  • 2.040 mensajes
  • LocationSanto Domingo

Escrito 08 enero 2010 - 09:09

Hola a todos

Se me ha presentado un problema raro. Tengo un form para consultas y cuando realizo una consulta que no me envia ningun resultado la barra de desplazamiento vertical scrollbar del dbgrid desaparece para las proximas consultas, no importa que estas si tengan resultado.

Alguna idea de porque pasa esto. :huh:













  • 0

#2 egostar

egostar

    missing my father, I love my mother.

  • Administrador
  • 14.446 mensajes
  • LocationMéxico

Escrito 08 enero 2010 - 09:30

Es un caso raro. ¿ Estas usando componentes nativos o de terceros ?

Salud OS
  • 0

#3 luk2009

luk2009

    Advanced Member

  • Moderadores
  • PipPipPip
  • 2.040 mensajes
  • LocationSanto Domingo

Escrito 08 enero 2010 - 09:32

Nativos

  • 0

#4 luk2009

luk2009

    Advanced Member

  • Moderadores
  • PipPipPip
  • 2.040 mensajes
  • LocationSanto Domingo

Escrito 08 enero 2010 - 09:39

Imagen Enviada

Imagen Enviada


  • 0

#5 egostar

egostar

    missing my father, I love my mother.

  • Administrador
  • 14.446 mensajes
  • LocationMéxico

Escrito 08 enero 2010 - 10:02

Vaya que es raro, hice unas pruebas y si se muestra de nuevo la barra vertical después de que desaparece.

Que base de datos estas usando y que componente de acceso usas, ADO, IBX, dbExpress......

Salud OS
  • 0

#6 luk2009

luk2009

    Advanced Member

  • Moderadores
  • PipPipPip
  • 2.040 mensajes
  • LocationSanto Domingo

Escrito 08 enero 2010 - 10:09

Firebird 2.1  zeos
  • 0

#7 luk2009

luk2009

    Advanced Member

  • Moderadores
  • PipPipPip
  • 2.040 mensajes
  • LocationSanto Domingo

Escrito 08 enero 2010 - 10:13



delphi
  1. unit UFRQcentral;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  7.   Dialogs, Calendar, dateutils, DBCtrls, StdCtrls, Grids, DBGrids, db, ComCtrls,
  8.   Buttons, PngSpeedButton,shellapi;
  9.  
  10. type
  11.   TFRQcentral = class(TForm)
  12.     DBGrid1: TDBGrid;
  13.     Label1: TLabel;
  14.     DBTevento: TDBText;
  15.     DBTcliente: TDBText;
  16.     Label3: TLabel;
  17.     EDCSID: TEdit;
  18.     Label2: TLabel;
  19.     EDCLIENTE: TEdit;
  20.     DateTimePicker1: TDateTimePicker;
  21.     DateTimePicker2: TDateTimePicker;
  22.     Label5: TLabel;
  23.     Label6: TLabel;
  24.     Label4: TLabel;
  25.     DBTdireccion: TDBText;
  26.     Label7: TLabel;
  27.     Label8: TLabel;
  28.     Label9: TLabel;
  29.     Label10: TLabel;
  30.     Label11: TLabel;
  31.     DBTtelefono: TDBText;
  32.     DBTtelefono2: TDBText;
  33.     DBTfechaent: TDBText;
  34.     DBTPanel: TDBText;
  35.     DBTtipo: TDBText;
  36.     DBTciudad: TDBText;
  37.     DBTdircom: TDBText;
  38.     DBTnotacom: TDBText;
  39.     Label12: TLabel;
  40.     DBListBox1: TDBListBox;
  41.     BitBtn1: TBitBtn;
  42.     Label13: TLabel;
  43.     Label14: TLabel;
  44.     procedure FormShow(Sender: TObject);
  45.     procedure FormCreate(Sender: TObject);
  46.     procedure FormKeyDown(Sender: TObject; var Key: Word;
  47.       Shift: TShiftState);
  48.     procedure DBGrid1KeyDown(Sender: TObject; var Key: Word;
  49.       Shift: TShiftState);
  50.     procedure EDCLIENTEEnter(Sender: TObject);
  51.     procedure EDCLIENTEExit(Sender: TObject);
  52.     procedure EDCSIDEnter(Sender: TObject);
  53.     procedure EDCSIDExit(Sender: TObject);
  54.     procedure DBGrid1TitleClick(Column: TColumn);
  55.     procedure DBGrid1EditButtonClick(Sender: TObject);
  56.     procedure BitBtn1Click(Sender: TObject);
  57.     procedure DateTimePicker1CloseUp(Sender: TObject);
  58.     procedure DateTimePicker2CloseUp(Sender: TObject);
  59.     procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
  60.   private
  61.   {  procedure DBGrid1PillaLaRueda(var Message: TMessage);}
  62.     { Private declarations }
  63.   public
  64.     { Public declarations }
  65.   end;
  66.  
  67. var
  68.   FRQcentral: TFRQcentral;
  69.  
  70.   inicio, fin: string;
  71.  
  72. implementation
  73.  
  74. uses  UDMmonitorenred, frmmonitoreoenred, _busy, UFRMNOTAS;
  75.  
  76. {$R *.dfm}
  77. {type
  78.   TomaInvento = class(TControl);
  79.  
  80.  procedure TFRQcentral.DBGrid1PillaLaRueda(var Message: TMessage);
  81.  var
  82.   Cuanto : short;
  83.  begin
  84.  
  85.   if (Message.Msg = WM_MOUSEWHEEL) then begin
  86.     Cuanto:=HIWORD(Message.WParam);
  87.     Cuanto:=Cuanto div 120;
  88.     DbGrid1.DataSource.DataSet.MoveBy(-Cuanto);
  89.  
  90.   end else TomaInvento(DBGrid1).WndProc(Message);
  91.  end;}
  92.  
  93.  
  94.  
  95. procedure TFRQcentral.FormShow(Sender: TObject);
  96.  
  97.   begin
  98. AnimateWindow( Handle, 400, AW_ACTIVATE or AW_SLIDE or AW_HOR_POSITIVE);
  99. RedrawWindow( Handle, nil, 0, RDW_ERASE or RDW_FRAME or
  100. RDW_INVALIDATE or RDW_ALLCHILDREN );
  101.  
  102.   ACTIVECONTROL := EDCLIENTE;
  103.   dmmonitorenred.zqconsultas.SQL.clear;
  104.   DateTimePicker1.Date := (yesterday);
  105.   DateTimePicker2.date := (tomorrow);
  106.   inicio := formatdatetime('yyyy.mm.dd', datetimepicker1.date);
  107.   fin := formatdatetime('yyyy.mm.dd', datetimepicker2.date);
  108.   DBListBox1.Items.Clear;
  109.   EDCLIENTE.Clear;
  110.   FRQcentral.ActiveCONTROL:=FRQCENTRAL.EDCSID;
  111.   FRQcentral.EDCSID.TEXT :=(dmmonitorenred.zqactivasCSID.AsString);
  112.  
  113. end;
  114.  
  115. procedure TFRQcentral.FormCreate(Sender: TObject);
  116. //var
  117. // alto: integer;
  118. begin
  119.  
  120. {DBGrid1.WindowProc := DBGrid1PillaLaRueda;}
  121.  
  122.   KeyPreview := true;
  123. // for alto := 20 to 377 do
  124. // begin
  125.   //  dbgrid1.Height := alto;
  126.   //end;
  127. end;
  128.  
  129. procedure TFRQcentral.FormKeyDown(Sender: TObject; var Key: Word;
  130.   Shift: TShiftState);
  131.  
  132. begin
  133.   if (key = vk_escape) then
  134.   begin
  135.     if (activecontrol = edcliente) or (activecontrol = edcsid) then
  136.     begin
  137.       edcliente.clear;
  138.       edcsid.clear;
  139.     end;
  140.   end;
  141.  
  142.   begin
  143.     if activecontrol = edcliente then
  144.       edcsid.Clear;
  145.     if activecontrol = edcsid then
  146.       edcliente.clear;
  147.     if ((activecontrol = edcsid) or (activecontrol = edcliente)) and (key = 13)
  148.       then
  149.       dbgrid1.SetFocus;
  150.  
  151.   end;
  152.  
  153. end;
  154.  
  155. procedure TFRQcentral.DBGrid1KeyDown(Sender: TObject; var Key: Word;
  156.   Shift: TShiftState);
  157. begin
  158.   if (key = vk_escape) then
  159.   begin
  160.     EDCLIENTE.SetFocus;
  161.     edcliente.Clear;
  162.   end;
  163. end;
  164.  
  165. procedure TFRQcentral.EDCLIENTEEnter(Sender: TObject);
  166. begin
  167.   EDCLIENTE.color := clGradientInactiveCaption;
  168. end;
  169.  
  170. procedure TFRQcentral.EDCLIENTEExit(Sender: TObject);
  171. begin
  172.   EDCLIENTE.Color := clWindow;
  173. end;
  174.  
  175. procedure TFRQcentral.EDCSIDEnter(Sender: TObject);
  176. begin
  177.   EDCSID.color := clGradientInactiveCaption;
  178. end;
  179.  
  180. procedure TFRQcentral.EDCSIDExit(Sender: TObject);
  181. begin
  182.   EDCSID.Color := clWindow;
  183. end;
  184.  
  185. procedure TFRQcentral.DBGrid1TitleClick(Column: TColumn);
  186.  
  187. var
  188.   ordenando: string;
  189.  
  190. begin
  191.   ordenando := Column.Title.Caption;
  192.   if ordenando = 'CSID' then
  193.     ORDENANDO := ' CENTRAL.CSID '
  194.   else if ORDENANDO = 'DETALLE' then
  195.     ORDENANDO := ' CENTRAL.DETALLE '
  196.   else
  197.     if ORDENANDO = 'DETALLE1' then
  198.       orDENANDO := ' evento.Detalle '
  199.   else
  200.     if ORDENANDO = 'EVENTO' THEN
  201.     ordenando := ' central.evento ';
  202.  
  203.   inicio := formatdatetime('yyyy.mm.dd', datetimepicker1.date);
  204.   fin := formatdatetime('yyyy.mm.dd', datetimepicker2.date);
  205.   if edcliente.Text <> '' then
  206.   begin
  207.     dmmonitorenred.zqconsultas.SQL.clear;
  208.     dmmonitorenred.zqconsultas.SQL.Add('select * from  central left join acmsub on central.csid=acmsub.csid ');
  209.     dmmonitorenred.zqconsultas.SQL.Add(' left JOIN evento ON CENTRAL.EVENTO = evento.Evento');
  210.     dmmonitorenred.zqconsultas.SQL.Add(' where ' + 'ACMSUB.clientes LIKE ' + quotedstr('%' + edcliente.Text + '%'));
  211.     dmmonitorenred.zqconsultas.SQL.Add(' and CENTRAL.FECHAN between ' + quotedstr(inicio) + ' and ' + quotedstr(fin));
  212.     dmmonitorenred.zqconsultas.SQL.Add(' order by ' + (ordenando));
  213.     dmmonitorenred.zqconsultas.Open;
  214.   end
  215.   else if edcsid.text <> '' then
  216.   begin
  217.     dmmonitorenred.zqconsultas.SQL.clear;
  218.     dmmonitorenred.zqconsultas.SQL.Add('select * from central left join acmsub on central.csid = acmsub.csid ');
  219.     dmmonitorenred.zqconsultas.SQL.Add(' left JOIN evento ON CENTRAL.EVENTO = evento.Evento ');
  220.     dmmonitorenred.zqconsultas.SQL.Add('  where CENTRAL.CSID like ' + QUOTEDSTR(EDCSID.TEXT + '%'));
  221.     dmmonitorenred.zqconsultas.SQL.Add('    and CENTRAL.FECHAN between ' +  quotedstr(inicio) + 'and' + quotedstr(fin));
  222.     dmmonitorenred.zqconsultas.SQL.add(' order by ' + (ordenando));
  223.     dmmonitorenred.zqconsultas.Open;
  224.   end;
  225. end;
  226.  
  227.  
  228. procedure TFRQcentral.DBGrid1EditButtonClick(Sender: TObject);
  229. var
  230. telefono:string;
  231. CUALBOTON:INTEGER;
  232. begin
  233.   CUALBOTON:=(DBgrid1.SELECTEDINDEX+1);
  234. //ShowMessage(IntToStr(DBgrid1.SelectedIndex+1));
  235.   if CUALBOTON=3  then
  236.     BEGIN
  237.       EDCLIENTE.Text:= DMmonitorenred.ZQconsultasCLIENTES.AsString;
  238.       FRQcentral.ActiveCONTROL:=FRQCENTRAL.BitBtn1;
  239.           END
  240.   ELSE
  241.     If CUALBOTON=8  then
  242.  
  243. begin
  244.   telefono:=dmmonitorenred.zqconsultasDETALLE.AsString;
  245.   telefono:=(copy(telefono,5,8));
  246.  
  247.   dmmonitorenred.ZQconsuldetalle.SQL.clear;
  248.   dmmonitorenred.ZQconsuldetalle.SQL.Add('SELECT * from  acmsub ');
  249.   dmmonitorenred.ZQconsuldetalle.SQL.Add('WHERE telefono LIKE ' + quotedstr('%' + telefono + '%'));
  250.   dmmonitorenred.ZQconsuldetalle.Open;
  251.  
  252.   DBListBox1.Items.Clear;
  253.   DBListBox1.Items.Add(dmmonitorenred.ZQconsuldetalleCSID.AsString + '  ' + dmmonitorenred.ZQconsuldetalleCLIENTES.AsString);
  254. end;
  255. end;
  256. procedure TFRQcentral.BitBtn1Click(Sender: TObject);
  257. var
  258. cc:integer;
  259. begin
  260. if EDCLIENTE.TEXT <> '' then
  261.  
  262. begin
  263.   BusyBegin('realizando busqueda,  espere...', Application.Handle);
  264.  
  265.  
  266.     dmmonitorenred.zqconsultas.SQL.clear;
  267.     dmmonitorenred.zqconsultas.SQL.Add('SELECT * from  central left join acmsub on central.csid=acmsub.csid ');
  268.     dmmonitorenred.zqconsultas.SQL.Add('left JOIN evento ON CENTRAL.EVENTO = evento.Evento');
  269.     dmmonitorenred.zqconsultas.SQL.Add(' where ' + ' (upper(ACMSUB.clientes COLLATE ES_ES_CI_AI )) LIKE ' +quotedstr('%' + edcliente.Text + '%')+'');
  270.     dmmonitorenred.zqconsultas.SQL.Add(' and CENTRAL.FECHAN between ' + quotedstr(inicio) + 'and' + quotedstr(fin));
  271.     dmmonitorenred.zqconsultas.SQL.Add('ORDER BY CENTRAL.FECHAn');
  272.     dmmonitorenred.zqconsultas.Open;
  273.     cc:=DMmonitorenred.ZQconsultas.RecordCount;
  274.     Label13.Visible:=TRUE;
  275.     Label14.Visible:=TRUE;
  276.     label13.Caption:= inttostr(cc);
  277.       Sleep(1); //aqui es donde le das el tiempo para cerrarse en milisegundos
  278. BusyEnd;
  279.  
  280.     end
  281.  
  282.   ELSE
  283.         if EDCSID.TEXT <> '' then
  284.  
  285.   begin
  286. BusyBegin('realizando busqueda,  espere...', Application.Handle);
  287.  
  288.     dmmonitorenred.zqconsultas.SQL.clear;
  289.     dmmonitorenred.zqconsultas.SQL.Add('SELECT * from  central left join acmsub on central.csid=acmsub.csid ');
  290.     dmmonitorenred.zqconsultas.SQL.Add('left JOIN evento ON CENTRAL.EVENTO = evento.Evento');
  291.     dmmonitorenred.zqconsultas.SQL.Add('WHERE CENTRAL.CSID LIKE ' + quotedstr('%' +
  292.       edcsid.Text + '%'));
  293.     dmmonitorenred.zqconsultas.SQL.Add(' and CENTRAL.FECHAN between ' +
  294.       quotedstr(inicio) + 'and' + quotedstr(fin));
  295.     dmmonitorenred.zqconsultas.SQL.add('order by central.fechan');
  296.     dmmonitorenred.zqconsultas.Open;
  297.     cc:=DMmonitorenred.ZQconsultas.RecordCount;
  298.     Label13.Visible:=TRUE;
  299.     Label14.Visible:=TRUE;
  300.     label13.Caption:=inttostr(cc);
  301.     Sleep(5); //aqui es donde le das el tiempo para cerrarse en milisegundos
  302. BusyEnd;
  303.   end;
  304.  
  305.  
  306.  
  307. end;
  308.  
  309. procedure TFRQcentral.DateTimePicker1CloseUp(Sender: TObject);
  310. begin
  311.   inicio := formatdatetime('yyyy.mm.dd', datetimepicker1.date);
  312.  
  313. end;
  314.  
  315. procedure TFRQcentral.DateTimePicker2CloseUp(Sender: TObject);
  316. begin
  317.   fin := formatdatetime('yyyy.mm.dd', datetimepicker2.date);
  318. end;
  319.  
  320. procedure TFRQcentral.FormCloseQuery(Sender: TObject;
  321.   var CanClose: Boolean);
  322. begin
  323. Label13.visible:=false;
  324. label14.visible:=false;
  325.  
  326. end;
  327.  
  328. end.   



aqui esta el codigo de ese form completo.

PD. Cualquier consejo para depurar algun detalle del codigo sera bien recibido.
  • 0

#8 egostar

egostar

    missing my father, I love my mother.

  • Administrador
  • 14.446 mensajes
  • LocationMéxico

Escrito 08 enero 2010 - 10:26

Hice dos pruebas

una con Paradox y BDE y la otra con con Firebird 2.1 e IBX.

En ninguna de las dos hubo problemas.

Salud OS
  • 0

#9 Marc

Marc

    Advanced Member

  • Moderadores
  • PipPipPip
  • 1.484 mensajes
  • LocationMallorca

Escrito 09 enero 2010 - 08:50

¿ Que Delphi utilizas ?, creo que deberías mirar si hay algún Update Pack para ese Delphi que aún no has instalado, ya que tiene todo el aspecto de un bug del propio Delphi.
  • 0

#10 luk2009

luk2009

    Advanced Member

  • Moderadores
  • PipPipPip
  • 2.040 mensajes
  • LocationSanto Domingo

Escrito 09 enero 2010 - 09:03

Es delphi 7.0 build 4.453 
  • 0

#11 Marc

Marc

    Advanced Member

  • Moderadores
  • PipPipPip
  • 1.484 mensajes
  • LocationMallorca

Escrito 09 enero 2010 - 11:53

No utilizo D7, a ver si algun compañero que lo use nos puede confirmar si tu versión está al día o falta algún Update por pasar.
  • 0

#12 Caral

Caral

    Advanced Member

  • Moderador
  • PipPipPip
  • 4.266 mensajes
  • LocationCosta Rica

Escrito 09 enero 2010 - 11:58

Hola
Me ha sucedido cuando la configuracion del tamaño de los campos en el dbgrid excede el tamaño de este.
Doble click al dbgrid y ver campo por campo el tamaño.
Saludos
  • 0

#13 luk2009

luk2009

    Advanced Member

  • Moderadores
  • PipPipPip
  • 2.040 mensajes
  • LocationSanto Domingo

Escrito 09 enero 2010 - 04:43

Amigo Caral ese tampoco es el problema.  Puede ser que marc tenga razon y sea un bug de delphi, dejame hacer el update
para verificar
  • 0

#14 hcdan

hcdan

    Newbie

  • Miembros
  • Pip
  • 1 mensajes

Escrito 23 febrero 2021 - 05:50

Hola Luck2009

 

Efectivamente es un problema que a mi me ha sucedido muchas veces, en distintas versiones de Delphi.

La solución que he encontrado es modificar el ancho del DBGrid. Así vuelven a aparecer.

 

Grid.Width:=Grid.Width - 1;
Grid.Width:=Grid.Width + 1;
 
Lo hago después de actualizar El contenido del DBGrid con nuevos datos.

 


  • 1




IP.Board spam blocked by CleanTalk.