Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RadioGroup 1.0 component will not port to 3.0 or higher

Status
Not open for further replies.

joewolter

Programmer
Aug 31, 2001
4
0
0
US
This is a C++Builder 1.0 RadioGroup component that uses only the strings for selecting and will underline or reverse video the selected item.

I get 3 errors and 2 warnings when I try to compile it in C++Builder 3.0.

(2)Errors::Cannot Override a dynamic with a virtual function
virtual void __fastcall KeyDown();
virtual void __fastcall MouseDown();

(2)Warnings::GetChildren hides virtual function __fastcall
Controls::TWinControl::GetChildern()
virtual void __fastcall GetChildren(Classes::TGetChildProc Proc);

(1)Error::Too few parameters in call to __fastcall
Controls::TWinControl::GetChildern()
void __fastcall
TTextRadioGroup::GetChildren(Classes::TGetChildProc Proc)
{
TCustomControl::GetChildren(Proc);
}

Anyone that has an answer may have the .cpp code for the component. I've listed the .h file below.

Any help would be appreciated,
Joe

////////////////////////////////////////////////////////////////////////////////////
// TextRadioGroup.h
////////////////////////////////////////////////////////////////////////////////////
//---------------------------------------------------------------------------
#ifndef TextRadioGroupH
#define TextRadioGroupH
//---------------------------------------------------------------------------
#include <vcl\SysUtils.hpp>
#include <vcl\Controls.hpp>
#include <vcl\Classes.hpp>
#include <vcl\Forms.hpp>
#include <vcl\Graphics.hpp>
#include <vcl\Messages.hpp>
#include <vcl\Windows.hpp>
#include <vcl\System.hpp>
#include <vcl\consts.hpp>
//---------------------------------------------------------------------------
enum TTextRadioHighlighting { frhUnderline, frhInverse };

//---------------------------------------------------------------------------
class TTextRadioGroup : public TCustomControl
{
private:
Classes::TList* FButtons;
Classes::TStrings* FItems;
int FItemIndex;
int FColumns;
TTextRadioHighlighting FHighlighting;
bool FDrawRect;
bool FReading;
bool FUpdating;
Classes::TNotifyEvent FOnResize;
void __fastcall ArrangeButtons(void);
void __fastcall ButtonClick(System::TObject* Sender);
void __fastcall ItemsChange(System::TObject* Sender);
void __fastcall SetButtonCount(int Value);
void __fastcall SetColumns(int Value);
void __fastcall SetItemIndex(int Value);
void __fastcall SetItems(Classes::TStrings* Value);
void __fastcall SetDrawRect(bool Value);
void __fastcall SetHighlighting(TTextRadioHighlighting Value);
void __fastcall UpdateButtons(void);
MESSAGE void __fastcall CMWantSpecialKey(TCMWantSpecialKey &Message);
HIDESBASE MESSAGE void __fastcall CMEnabledChanged(Messages::TMessage &Message);
HIDESBASE MESSAGE void __fastcall CMFontChanged(Messages::TMessage &Message);
HIDESBASE MESSAGE void __fastcall WMSize(Messages::TWMSize &Message);

protected:
virtual void __fastcall KeyDown(Word &Key, TShiftState Shift);
virtual void __fastcall MouseDown(TMouseButton button,TShiftState shift, int x, int y);
virtual void __fastcall AlignControls(Controls::TControl* AControl, Windows::TRect &Rect);
virtual void __fastcall Paint(void);
virtual void __fastcall ReadState(Classes::TReader* Reader);
virtual bool __fastcall CanModify(void);
virtual void __fastcall GetChildren(Classes::TGetChildProc Proc);

public:
__fastcall TTextRadioGroup(TComponent* Owner);
__fastcall virtual ~TTextRadioGroup(void);
public:
__fastcall TTextRadioGroup(HWND ParentWindow) : TCustomControl(ParentWindow) { };

BEGIN_MESSAGE_MAP
MESSAGE_HANDLER(CM_WANTSPECIALKEY , TCMWantSpecialKey,CMWantSpecialKey)
END_MESSAGE_MAP(TCustomControl)

__published:
__property int Columns = {read=FColumns, write=SetColumns, default=1};
__property int ItemIndex = {read=FItemIndex, write=SetItemIndex, default=-1};
__property Classes::TStrings* Items = {read=FItems, write=SetItems, nodefault};
__property bool DrawRect = {read=FDrawRect, write=SetDrawRect, default=true};
__property TTextRadioHighlighting Highlighting = {read=FHighlighting, write=SetHighlighting, default=0};
__property Font;
__property ParentFont;
__property TabOrder;
__property TabStop;
__property Enabled;
__property Visible;
__property OnEnter;
__property OnExit;
__property OnKeyDown ;
__property OnKeyPress ;
__property OnKeyUp ;
__property OnMouseDown ;
__property OnMouseMove ;
__property OnMouseUp ;
};
//---------------------------------------------------------------------------
#endif

 


1. You declared events as virtual by in ancestor class they are defined as DYNAMIC so you must redeclare this your functions as DYNAMIC.
In, example:
DYNAMIC void __fastcall KeyDown(Word &Key, TShiftState Shift);

2. In 5 Builder, the method of GetChildren is declared as follows:
DYNAMIC void __fastcall GetChildren(Classes::TGetChildProc &Proc, Classes::TComponent* Root);
So, you should check the declaration of that method in 3th Builder and bring your declaration to compliance with it.
Note, what GetChildren is declared as DYNAMIC too. Happy programming!))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top