Bonjour,
J'ai une question : Est-il possible de faire un clik gauche sur un TShape ? Car d'apres ce que j'ai vu, on peut seulement faire un click droit.
Voici un bout de code qui me pose mon second probleme :
Je voudrais lui mettre dans le OnContextPopup ma fonction. Voici ma fonction :Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 for (int PosV = 0; PosV < MaxV; PosV++) { for (int PosH = 0; PosH < MaxH; PosH++) { ColorNo[PosH][PosV] = new TShape (this); ColorNo[PosH][PosV]->Parent = this; ColorNo[PosH][PosV]->Left = InitH + PosH * (LargBt + EspaceHor); ColorNo[PosH][PosV]->Top = InitV + PosV * (HautBt + EspaceVert); ColorNo[PosH][PosV]->Width = LargBt; ColorNo[PosH][PosV]->Height = HautBt; ColorNo[PosH][PosV]->Pen->Width = 1; ColorNo[PosH][PosV]->Shape = stCircle; ColorNo[PosH][PosV]->Brush->Color = ColorTab[j]; ColorNo[PosH][PosV]->Name = "ColorNo" + IntToStr(InitH+j); ColorNo[PosH][PosV]->OnContextPopup = ShapeContextPopup; ColorNo[PosH][PosV]->Show(); j++; } }
Elle est déclaré dans le .h :Code:
1
2
3
4
5 void __fastcall TForm1::ShapeContextPopup(TObject *Sender, TPoint &MousePos, bool &Handled) { ShowMessage("test"); }
Mais j'ai une jolie erreur...Code:
1
2
3
4
5
6
7
8 public: // Déclarations utilisateur __fastcall TForm1(TComponent* Owner); TShape *ColorNo[10][10]; void __fastcall TForm1::CreerSelection(int InitH, int InitV, int HautBt, int LargBt, int EspaceHor, int EspaceVert,int MaxV, int MaxH); void __fastcall TForm1::ShapeContextPopup(TObject *Sender, TPoint &MousePos, bool &Handled); };
Une idée du problème ?Code:[BCC32 Erreur] ufmMain.cpp(72): E2034 Impossible de convertir 'void (_fastcall * (_closure )(TObject *,TPoint &,bool &))(TObject *,TPoint &,bool &)' en 'TContextPopupEvent'