 |
Club Builder Foro de C++Builder en español
|
| Ver tema anterior :: Ver tema siguiente |
| Autor |
Mensaje |
Invitado
|
Publicado: Mie 19 Ene, 2005 3:21 am Asunto: Eventos para objetos creados dinamicamente |
|
|
Hola he estado mirando en el foro como crear eventos para los objetos que creo dinamicamente en mi programa y he echo el siguiente codigo pero me da un error, aqui les dejo el codigo para que puedan examinarlo , el error lo da en unit.h en la linea donde aparece tabla->OnDrawCell = pintar :
unit1.h
| Código: |
#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <Grids.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
void __fastcall pintar(TObject *Sender, int ACol, int ARow,
TRect &Rect, TGridDrawState State);
private: // User declarations
public: // User declarations
__fastcall TForm1(TComponent* Owner);
TStringGrid *tabla[];
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif |
Unit1.cc
| Código: |
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
TStringGrid *tabla = new TStringGrid(Owner);
// tabla->DefaultDrawing=false;
tabla->Parent = Form1;
for (int y=0; y<5; y++)
for (int x=0; x<5; x++)
tabla->Cells[x][y] = Format("(%d,%d)", ARRAYOFCONST((x, y)));
tabla->OnDrawCell = pintar;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::pintar(TObject *Sender, int ACol, int ARow,
TRect &Rect, TGridDrawState State)
{
//comienzo
}
//---------------------------------------------------------------------------
|
Espero que puedan ayudarme.
Un saludo |
|
| Volver arriba |
|
 |
rivo Lt JG

Registrado: 13 Mar 2004Mensajes: 72Ubicación: Asturias (España)
|
Publicado: Mie 19 Ene, 2005 3:24 am Asunto: |
|
|
Lo de arriba lo escribi yo es que no me di cuenta de hacer login, en el que da error es en unit1.cpp, que me equivoque arriba.
El error que da es :
| Código: |
[C++ Error] Unit1.cpp(23): E2034 Cannot convert 'void (_fastcall * (_closure )(TObject *,int,int,TRect &,TGridDrawState))(TObject *,int,int,TRect &,TGridDrawState)' to 'void (_fastcall * (_closure )(TObject *,int,int,const TRect &,TGridDrawState))(TObject *,int,int,const TRect &,TGridDrawState)'
|
|
|
| Volver arriba |
|
 |
|
|
No puedes publicar temas nuevos en este foro No puedes responder a temas en este foro No puedes editar tus mensajes en este foro No puedes borrar tus mensajes en este foro No puedes votar en las encuestas de este foro
|
© 2002–2026 Club Builder · Funciona con phpBB.
|