StringGrid



  • Hallo,

    ich habe eine StringGrid tabelle, habe dort schon soweit alles fertig, mit name etc. aus einer datei laden! das funktioniert, ich will nur jetzt, wenn ich vorne die erste zelle anklicke, das er mir die ganze zeile übernimmt und mir in meine EditObjekte reinpackt

    habs schon folgendermaßen probiert:

    void __fastcall TForm4::StringGrid1SelectCell(TObject *Sender, int ACol,
          int ARow, bool &CanSelect)
    {
      Form2->Edit3->Text=(StringGrid1->Cells [1] [1]);
      Form2->Label22->Caption=(StringGrid1->Cells [2] [1]);
      Form2->Edit4->Text=(StringGrid1->Cells [3] [1]);
      Form2->Edit6->Text=(StringGrid1->Cells [4] [1]);
    }
    

    leider weiß ich nicht, warum er nicht darauf reagiert wenn ich eine zelle anklicke, also ich weiß, das ich die cellen schon in meinem code drin habe, aber ich weiß einfach nicht, wie ich es anders machen sollte!

    void __fastcall TForm4::StringGrid1SelectCell(TObject *Sender, int ACol,
          int ARow, bool &CanSelect)
    {
      Form2->Edit3->Text=(StringGrid1->OnSelectCell);
      Form2->Label22->Caption=(StringGrid1->OnSelectCell);
      Form2->Edit4->Text=(StringGrid1->OnSelectCell);
      Form2->Edit6->Text=(StringGrid1->OnSelectCell);
    }
    

    das funktioniert leider nicht!

    kann mir da wer weiterhelfen?



  • Hallo

    wo ist das Problem?

    void __fastcall TForm4::StringGrid1SelectCell(TObject *Sender, int ACol,
          int ARow, bool &CanSelect)
    {
      Form2->Edit3->Text= StringGrid1->Cells [1] [StringGrid1->Row];
      Form2->Label22->Caption= StringGrid1->Cells [2] [StringGrid1->Row];
      Form2->Edit4->Text= StringGrid1->Cells [3] [StringGrid1->Row];
      Form2->Edit6->Text= StringGrid1->Cells [4] [StringGrid1->Row]);
    }
    

    Btw : Verwende für deine Controls und Forms eindeutige treffende Namen.

    Außerdem ist auch der Threadtitel hier nicht aussgekräftig.

    bis bald
    akari



  • void __fastcall TForm4::StringGrid1SelectCell(TObject *Sender, int ACol,
          int ARow, bool &CanSelect)
    {
      Form2->Edit3->Text= StringGrid1->Cells [1] [ARow];
      Form2->Label22->Caption= StringGrid1->Cells [2] [ARow];
      Form2->Edit4->Text= StringGrid1->Cells [3] [ARow];
      Form2->Edit6->Text= StringGrid1->Cells [4] [ARow);
    }
    

    nicht das ich akari wiedersprechen möchte, aber so siehts doch schöner aus und ist portabler 😉

    mfg
    BigNeal



  • vielen dank!
    @akari, ich werds mir merken 😉


Anmelden zum Antworten