Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Abkürzungstasten geht net (https://www.delphipraxis.net/105467-abkuerzungstasten-geht-net.html)

SaFu 22. Dez 2007 10:26


Abkürzungstasten geht net
 
Hat jemand mal ne ahnung wie ich es anstellen kann das ich mit hilfe von Abkürzungen, den String "aa" oder "AA" in einer Zelle eines StringGrids einfüghen lassen kann

Delphi-Quellcode:
procedure TForm7.StringGrid1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
var Celltext :string;
     n ,ACol, ARow :integer;
begin
   with (Sender as TStringGrid) do

    begin
     Celltext:= Cells[ACol, ARow];
 if ((Shift =[ssCtrl]) and (Key = VK_F8)) then
      if (Cells[ACol,ARow] = 'aa') or (Cells[ACol,ARow] = 'AA')then
       begin
        Canvas.Brush.Color:= ClGreen; //Zellenfarbe
        Canvas.Font.Color:= ClWhite; //Schriftfarbe
        Canvas.Font.Style:= Canvas.Font.Style + [fsBold]; //Text fett
        end;
   MESSAGEbeep(0)
end;
end;

inherited 22. Dez 2007 10:32

Re: Abkürzungstasten geht net
 
Du greifst auf Cells[ACol,ARow] zu, ohne diese vorher zu initialisieren...

SaFu 22. Dez 2007 12:05

Re: Abkürzungstasten geht net
 
muss man das überhaupt hohl mir doch aus dem StringGrid oder :gruebel:

Die Muhkuh 22. Dez 2007 12:11

Re: Abkürzungstasten geht net
 
Zeile 9:

Delphi-Quellcode:
Celltext:= Cells[ACol, ARow];
Woher soll das StringGrid wissen, welche ACol und ARow Du meinst? ;-) Du musst dem Zeugs schon Werte zuweisen.

SaFu 22. Dez 2007 12:12

Re: Abkürzungstasten geht net
 
hah Also geht das garnicht so einfach wie ich gedacht habe, ich muss also vorher noch abfragen welche Zelle makiert ist ???


Alle Zeitangaben in WEZ +1. Es ist jetzt 21:58 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz