BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Can not found Class problem

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Development)
View previous topic :: View next topic  
Author Message
ray
Guest





PostPosted: Wed Dec 03, 2003 1:50 pm    Post subject: Can not found Class problem Reply with 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?
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





PostPosted: Wed Dec 03, 2003 6:55 pm    Post subject: Re: Can not found Class problem Reply with quote




"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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Development) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.