Modifying TCursor
Posted: Mon Sep 12, 2005 12:24 pm
Hi Guys,
All the TControl objects have a Cursor property that can be modified at design or runtime with values such as crDefault, crSQLWait, crHandPoint etc. TChart also has the Cursor property that can only be set a design time. When set at runtime the cursor is overridden or something...
Could you give me some pointers on how I can control this property at runtime, remember that this is not TCursorTool.
I used this example with a form containing a TChart and TPanel component. It works for TPanel but not TChart.
Regards, John.
All the TControl objects have a Cursor property that can be modified at design or runtime with values such as crDefault, crSQLWait, crHandPoint etc. TChart also has the Cursor property that can only be set a design time. When set at runtime the cursor is overridden or something...
Could you give me some pointers on how I can control this property at runtime, remember that this is not TCursorTool.
I used this example with a form containing a TChart and TPanel component. It works for TPanel but not TChart.
Code: Select all
class TfrmMain : public TForm
{
__published: // IDE-managed Components
TChart *Chart;
TChartEditor *ChartEditor;
TPopupMenu *PopupMenu;
TMenuItem *ChartProperties;
TPanel *Panel;
TComboBox *ComboBox;
void __fastcall FormShow(TObject *Sender);
void __fastcall ChartPropertiesClick(TObject *Sender);
void __fastcall ComboBoxChange(TObject *Sender);
private: // User declarations
public: // User declarations
__fastcall TfrmMain(TComponent* Owner);
};
//---------------------------------------------------------------------------
__fastcall TfrmMain::TfrmMain(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TfrmMain::FormShow(TObject *Sender)
{
TLineSeries *ptrToLineSeries;
Chart->Legend->CheckBoxes = true;
for( int i=0; i < 3; i++ )
{
ptrToLineSeries = new TLineSeries(Chart);
ptrToLineSeries->Title = "Series " + AnsiString(i);
ptrToLineSeries->FillSampleValues(20);
ptrToLineSeries->ShowInLegend = true;
ptrToLineSeries->Pointer->Visible = true;
Chart->AddSeries( ptrToLineSeries );
}
}
//---------------------------------------------------------------------------
void __fastcall TfrmMain::ChartPropertiesClick(TObject *Sender)
{
ChartEditor->Execute();
}
//---------------------------------------------------------------------------
void __fastcall TfrmMain::ComboBoxChange(TObject *Sender)
{
// Update the Cursor Image for the objects when the mouse moves over them.
// This is used during various phases of the program.
switch( ComboBox->ItemIndex )
{
case 0:
Chart->Cursor = crDefault;
Panel->Cursor = crDefault;
break;
case 1:
Chart->Cursor = crHourGlass;
Panel->Cursor = crHourGlass;
break;
case 2:
Chart->Cursor = crSQLWait;
Panel->Cursor = crSQLWait;
break;
case 3:
Chart->Cursor = crAppStart;
Panel->Cursor = crAppStart;
break;
}
}