Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Otros entornos y lenguajes > C++ Builder
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

 
 
Herramientas Buscar en Tema Desplegado
  #2  
Antiguo 08-01-2015
Avatar de escafandra
[escafandra] escafandra is offline
Miembro Premium
 
Registrado: nov 2007
Posts: 2.210
Poder: 22
escafandra Tiene un aura espectacularescafandra Tiene un aura espectacular
Te muestro un ejemplo usando ModalResult:
Crea el formulario que va a ser modal como disponible y no como autocreado.

UNIT1.CPP
Código PHP:
#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
#include "Unit2.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponentOwner)
  : 
TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  
TForm2 *Dialog = new TForm2(this);
  
TModalResult Result Dialog->ShowModal();
  if(
Result == mrOkShowMessage("OK");
  else if(
Result == mrCancelShowMessage("Cancel");
  else if(
Result == mrOtroShowMessage("Otro");
}
//--------------------------------------------------------------------------- 
UNIT2.H
Código PHP:
#ifndef Unit2H
#define Unit2H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
//---------------------------------------------------------------------------

TModalResult mrOtro mrNo 1;

class 
TForm2 : public TForm
{
__published:    // IDE-managed Components
  
TButton *Button1;
  
TButton *Button2;
  
TButton *Button3;
  
void __fastcall Button1Click(TObject *Sender);
  
void __fastcall Button2Click(TObject *Sender);
  
void __fastcall Button3Click(TObject *Sender);
private:    
// User declarations
public:        // User declarations
  
__fastcall TForm2(TComponentOwner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm2 *Form2;
//---------------------------------------------------------------------------
#endif 
UNIT2.CPP
Código PHP:
#include <vcl.h>
#pragma hdrstop

#include "Unit2.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm2 *Form2;
//---------------------------------------------------------------------------
__fastcall TForm2::TForm2(TComponentOwner)
  : 
TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm2::Button1Click(TObject *Sender)
{
  
ModalResult mrOk;
}
//---------------------------------------------------------------------------

void __fastcall TForm2::Button2Click(TObject *Sender)
{
  
ModalResult mrCancel;
}
//---------------------------------------------------------------------------

void __fastcall TForm2::Button3Click(TObject *Sender)
{
  
ModalResult mrOtro;
}
//--------------------------------------------------------------------------- 
Saludos.
Responder Con Cita
 



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
LLamar a un Form y que no sea Modal chinchan C++ Builder 2 23-09-2011 15:15:25
Liberación de un Form No Modal vejerf OOP 1 06-09-2010 19:41:20
Form Principal Modal CarlosHernandez Varios 9 26-02-2009 01:47:01
Form modal deja que el form llamante tome el foco tata Varios 6 17-05-2006 11:51:37
Saber si una Form es modal Delfino Varios 3 18-09-2005 04:12:14


La franja horaria es GMT +2. Ahora son las 06:10:21.


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