Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

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

Grupo de Teaming del ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 19-10-2007
Andres_vl Andres_vl is offline
Registrado
 
Registrado: sep 2007
Posts: 4
Poder: 0
Andres_vl Va por buen camino
Como hacer que el Código se ejecute al abrir la ventana

Hola a todos
Ojalá alguien me puede guiar con estas dos dudas :
Estoy en mis primeros prog con Delphi.
Tengo un programa con tres ventanas, cada una se abre con un botonclick desde la anterior,
1. Exáctamente donde se pone el código para que cuando hago click en el boton de la segunda ventana , que abre la tercera, este se ejecute solo sin necesidad de poner un boton en la tercera ventana.
2.Como desactivo la segunda ventana, quiero desactivarla no ocultarla para que no consuma memoria.
Muchas Gracias
Andrés
Responder Con Cita
  #2  
Antiguo 19-10-2007
Avatar de enecumene
[enecumene] enecumene is offline
Miembro de Oro
 
Registrado: may 2006
Ubicación: Santo Domingo, Rep. Dom.
Posts: 3.040
Poder: 21
enecumene Va por buen camino
Hola Andres_vl, el codigo lo puedes poner en los eventos OnCreate y/o OnShow del form.

Saludos.
__________________

Mi BLOG - ¡Joder, leanse la guia de estilo!
Las Palabras son enanas, los ejemplos gigantes.
Responder Con Cita
  #3  
Antiguo 19-10-2007
Andres_vl Andres_vl is offline
Registrado
 
Registrado: sep 2007
Posts: 4
Poder: 0
Andres_vl Va por buen camino
Re, Còdigo

Hola
Gracias
Lo voy a probar
Saludos
Andrés
Responder Con Cita
  #4  
Antiguo 20-10-2007
Andres_vl Andres_vl is offline
Registrado
 
Registrado: sep 2007
Posts: 4
Poder: 0
Andres_vl Va por buen camino
Más ayuda porf

Cita:
Empezado por enecumene Ver Mensaje
Hola Andres_vl, el codigo lo puedes poner en los eventos OnCreate y/o OnShow del form.

Saludos.
Mi programa debe leer el port contínuamente y exponer los datos en el form4
Acá pongo el codigo que generó delphi más lo que puse
Tengo estas preguntas a ver si me pueden dar una mano

1. En el form4 tengo un boton de Salir pero no me funciona , parece que se queda pegado en el while.
2. Me pueden escribir en este còdigo como llamar a un procedimiento que esté en la unit4
3.Me pueden indicar como declaro en el uses del programa “program MAQ_ARAND_00”que se vá a usar la unit4 y un procedimiento de esta.

Nota, estoy usando los componente abakus que estan todos en la unit 4 y me reclama cuando trato de leer la comm1 con alguna instrucción en el program MAQ…

Adjunto el código

De antemano Muchas Gracias por la ayuda

Cristian

program MAQ_ARAND_00;

uses
Forms,
Unit1 in 'Unit1.pas' {Form1},
Unit2 in 'Unit2.pas' {Form2},
Unit3 in 'Unit3.pas' {Form3},
Unit4 in 'Unit4.pas' {Form4};
{$R *.res}



begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.CreateForm(TForm2, Form2);
Application.CreateForm(TForm3, Form3);
Application.CreateForm(TForm4, Form4);
Application.Run;


end.


unit Unit4;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, AbCBitBt, AbVInd, AbDBCtrls, _GClass, AbLED, AbBar, StdCtrls,
ExtCtrls, jpeg, AbTank, AbOpHour, CPortCtl, CPort;

type
TForm4 = class(TForm)
Label1: TLabel;
GRAMOS: TAbDBValueInd;
AbColBitBtn4: TAbColBitBtn;
AbDBValueInd1: TAbDBValueInd;
AbDBValueInd2: TAbDBValueInd;
AbBar1: TAbBar;
AbBar2: TAbBar;
AbBar4: TAbBar;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
AbValueInd2: TAbValueInd;
Label5: TLabel;
AbValueInd3: TAbValueInd;
AbValueInd4: TAbValueInd;
Label6: TLabel;
AbValueInd5: TAbValueInd;
Label7: TLabel;
Label8: TLabel;
AbValueInd6: TAbValueInd;
Shape1: TShape;
Shape2: TShape;
Shape11: TShape;
AbValueInd8: TAbValueInd;
AbValueInd9: TAbValueInd;
AbValueInd10: TAbValueInd;
Label13: TLabel;
Label14: TLabel;
AbValueInd12: TAbValueInd;
AbValueInd13: TAbValueInd;
AbOpHourCounter2: TAbOpHourCounter;
AbOpHourCounter3: TAbOpHourCounter;
AbValueInd7: TAbValueInd;
Label18: TLabel;
Label19: TLabel;
AbValueInd11: TAbValueInd;
AbValueInd1: TAbValueInd;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label15: TLabel;
Label16: TLabel;
AbOpHourCounter4: TAbOpHourCounter;
Image1: TImage;
Button1: TButton;
ComTerminal1: TComTerminal;
Edit1: TEdit;
Label17: TLabel;
Edit2: TEdit;
ComPort1: TComPort;
procedure AbColBitBtn4Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }

end;
var
Form4: TForm4;
Str: Char;
Strcomp1:String;
Strcomp2:String;
Strcomp3:String;
Strcomp4 :String;
Strcomp5 :String;
Str1:String;
Str2:String;
Str3:String;
Valor:Integer;
texto:string;
Valor1:double;
ByteC_ON:Char;
Peso1L,Peso2L,Peso3L:String;
Peso1H,Peso2H,Peso3H:String;
PESO1,PESO2,PESO3: String;

implementation

{$R *.dfm}
//

function IntToBinRec(valor,digitos:integer):string;

begin
if digitos=0 then
result:=''
else
begin
if (valor AND (1 shl (digitos-1)))>0 then
result:='1'+IntToBinRec(valor,digitos-1)
else
result:='0'+IntToBinRec(valor,digitos-1)
end;
end;

function BinToInt(Value: String): Integer;
var
i,Size: Integer;
begin
Result:=0;
Size:=Length(Value);
for i:=Size downto 1 do
if Value[i]='1' then Result:=Result+(1 shl (Size-i));
end;

procedure TForm4.AbColBitBtn4Click(Sender: TObject);
begin
Strcomp5:='A';
form4.close
end;

procedure TForm4.Button1Click(Sender: TObject);
begin
Str:='4';
Strcomp1:='A';
Strcomp2:='A';
Strcomp3:='B';
Strcomp4:='A';
Strcomp5:='C';
Comport1.Open ;

While (Strcomp5 <> Strcomp4) do // espera una 'A'
begin
While (Strcomp2 <> Strcomp1) or (Strcomp5 <> Strcomp4) do // espera una 'A'
begin
Comport1.ReadStr(Strcomp2,1);
end;

While (Strcomp2 <> Strcomp3) or (Strcomp5 <> Strcomp4) do //Loop espera una 'B'
begin
ComPort1.ReadStr(Peso1L,1);
ComPort1.ReadStr(Peso1H,1);
ComPort1.ReadStr(Peso2L,1);
ComPort1.ReadStr(Peso2H,1);
ComPort1.ReadStr(Peso3L,1);
ComPort1.ReadStr(Peso3H,1);

PESO1:= Peso1L+Peso1H;
PESO2:= Peso2L+Peso2H;
PESO3:= Peso3L+Peso3H;

GRAMOS.ValueStr:= IntToStr(BinToInt(PESO1));
AbDBValueInd1.ValueStr:= IntToStr(BinToInt(PESO2));
AbDBValueInd2.ValueStr:= IntToStr(BinToInt(PESO3));

Comport1.ReadStr(Strcomp2,1);

end;
end;
end;
end.


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
Como activar ventana MDIChildren mediante código. abracadabra OOP 3 20-03-2010 17:48:35
COmo hacer que la ventana haga destellos, (se encienda y apague) JuanErasmo API de Windows 4 28-03-2007 11:02:33
Cómo hacer que se ejecute mi aplicación cuando se abra Internet Explorer? JuanErasmo API de Windows 3 19-04-2006 19:12:33
Alguien sabe como hacer que tu aplicacion se ejecute... Supra Varios 7 05-02-2005 21:10:09
metodos para hacer que una forma solo se ejecute una vez DEPROE Varios 7 18-11-2004 19:48:25


La franja horaria es GMT +2. Ahora son las 22:26:52.


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