Komponenten-Entwicklung - im Objektinspector bei TPicture Bildeditor aufrufen
-
ich versuche mich grade mit der Komponentenentwicklung.
jetzt möchte ich im ObjektInspektor ein TPicture anzeigen, und dass man mit dem Button den Bild-Editor aufruft (genau wie bei TImage).
jetzt habe ich aber das problem, dass wenn ich das mit __property löse, die mein TPicture zwar im ObjektInspector auftaucht, aber immer ne fehlermeldung kommt, wenn ich auf die Komponente klicke..__published: __property TPicture* BildDuese = {read=GetSpray,write=SetSpray}; __property TPicture* BildSektor = {read=GetSector,write=SetSector}; // ich denke der Fehler liegt hier und ich habe etwas falsch verstanden private: TPicture* picSector; protected: TPicture* __fastcall GetSector(){return (picSector);} void __fastcall SetSector(TPicture* pSektor){picSector = pSektor;}für jegliche anregungen bin ich dankbar
BigNeal
-
ich mache das so, geht natuerlich auch mit einem Graphics::TBitmap
im header:
private: TImage *FImage; protected: void __fastcall SetImage(TPicture *Value); TPicture* __fastcall GetImage(); __published: __property TPicture *Image = { read = GetImage, write = SetImage };in der unit:
//--------------------------------------------------------------------------- // Get-Funktion für Image-Property //--------------------------------------------------------------------------- TPicture* __fastcall TRSImagePanel::GetImage() { return FImage->Picture; } //--------------------------------------------------------------------------- // Set-Funktion für Image-Property //--------------------------------------------------------------------------- void __fastcall TRSImagePanel::SetImage(TPicture *Value) { FImage->Picture->Assign(Value); FImage->Refresh(); }
-
danke für deine Antwort..
ich habe meinen code soweit angepasst, aber es will immernochnicht klappenprivate: TPicture *picSector; __published: __property TPicture *BildSektor = {read=GetSector,write=SetSector}; protected: TPicture* __fastcall GetSector(); void __fastcall SetSector(TPicture *pSektor);in der Unit
TPicture* __fastcall TElTecGraph::GetSector() { return (picSector); } void __fastcall TElTecGraph::SetSector(TPicture *pSektor) { picSector->Assign(pSektor); }
bin komplett ratlos 
-
ich habe nun auch eine Test-Komponente nur mit obenangegebenen Code erstellt.
es klappt auch nicht..
hat das noch niemand gemacht?
-
BigNeal schrieb:
private:
TPicture *picSector;.
.
.void __fastcall TElTecGraph::SetSector(TPicture *pSektor)
{
picSector->Assign(pSektor);
}**************************************************************************
* *
* Und wo erzeugst Du eine Instanz von picsector???? *
* Das solltest Du im Konstruktor mit new machen!!! *
* Und im Destructor nicgt das deleten vergessen!!! *
* *
**************************************************************************
-
habe mich soeben in dich verliebt @ DerAltenburgr

habe wohl vor lauter bäumen den wald nicht mehr gesehen.. naja ist noch montag morgen
thx vielmal
BigNeal