 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
ray Guest
|
Posted: Wed Dec 03, 2003 1:50 pm Post subject: Can not found Class problem |
|
|
I write a component named TMenuBar,it's base on TToolBar.T function is put
MainMenu anywhere on the form.he It's build ok,and can work in design
mode,but running the executable file include TMenuBar,it report a error "can
not found class TToolButton".what's happend?
This is the source code :
MenuBar.cpp
//--------------------------------------------------------------------------
-
#include <vcl.h>
#pragma hdrstop
#include "MenuBar.h"
#pragma package(smart_init)
//--------------------------------------------------------------------------
-
// ValidCtrCheck is used to assure that the components created do not have
// any pure virtual functions.
//
static inline void ValidCtrCheck(TMenuBar *)
{
new TMenuBar(NULL);
}
//--------------------------------------------------------------------------
-
__fastcall TMenuBar::TMenuBar(TComponent* Owner)
: TToolBar(Owner)
{
TToolBar::TToolBar(Owner);
Flat=true;
FMenu=NULL;
ShowCaptions = true;
EdgeBorders.Clear();
ControlStyle
<
}
void __fastcall TMenuBar::SetMenu(TMainMenu * Value)
{
int i;
if(FMenu==Value) return;
if(FMenu!=NULL)
for(i=ButtonCount-1;i>=0;i--)
delete Buttons[i];
FMenu=Value;
if(FMenu==NULL) return;
for(i=ButtonCount;i<FMenu->Items->Count;i++)
{
try
{
Button=new TToolButton(this);
Button->AutoSize=true;
Button->Grouped=true;
Button->Parent=this;
Buttons[i]->MenuItem=FMenu->Items->Items[i];
}
catch(...)
{
delete Button;
}
}
for(i=0;i<FMenu->Items->Count;i++)
Buttons[i]->MenuItem=FMenu->Items->Items[i];
}
//--------------------------------------------------------------------------
-
namespace Menubar
{
void __fastcall PACKAGE Register()
{
TComponentClass classes[1] = {__classid(TMenuBar)};
RegisterComponents("Samples", classes, 0);
}
}
//--------------------------------------------------------------------------
-
MenuBar.hpp
//--------------------------------------------------------------------------
-
#ifndef MenuBarH
#define MenuBarH
//--------------------------------------------------------------------------
-
#include <SysUtils.hpp>
#include <Controls.hpp>
#include <Classes.hpp>
#include <Forms.hpp>
#include <ComCtrls.hpp>
#include <ToolWin.hpp>
//--------------------------------------------------------------------------
-
class PACKAGE TMenuBar : public TToolBar
{
private:
TMainMenu *FMenu;
TToolButton * Button;
void __fastcall SetMenu(TMainMenu * Value);
protected:
public:
__fastcall TMenuBar(TComponent* Owner);
__published:
__property TMainMenu * Menu = {read=FMenu,write=SetMenu,default=NULL};
//__property EdgeBorders ;
};
//--------------------------------------------------------------------------
-
#endif
|
|
| Back to top |
|
 |
Ralph Kazemier Guest
|
Posted: Wed Dec 03, 2003 6:55 pm Post subject: Re: Can not found Class problem |
|
|
"ray" <raysie73 (AT) yahoo (DOT) com> wrote
| Quote: | I write a component named TMenuBar,it's base on TToolBar.T function is put
MainMenu anywhere on the form.he It's build ok,and can work in design
mode,but running the executable file include TMenuBar,it report a error
"can
not found class TToolButton".what's happend?
|
Check to see whether there resides an unnamed TToolButton on the form. If
so, give it name (via the Object Inspector) and try again.
Ralph
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|