Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Shape transparent/unsichtbar, aber anklickbar (https://www.delphipraxis.net/10515-shape-transparent-unsichtbar-aber-anklickbar.html)

Char 20. Okt 2003 13:15


Shape transparent/unsichtbar, aber anklickbar
 
Hallo,

ich hab mal wieder ein Problem:

Wie kann man eine Shape-Komponente unsichtbar machen? Dennoch muss sie anklickbar sein.
Mit Shape.hide geht das leider nicht.

Ich habe mehrere Shapes, die an bestimmten Positionen auf einer Image-Kompnente liegen und einzeln anklickbar sein sollen.

Insgesamt soll das Bild also quasi in verschiedene Bereiche eingeteilt sein. Deshalb dachte ich, ich lege einfach an die entsprechenden Stellen unsichtbare Shapes.

Ginge das noch anders?

sakura 20. Okt 2003 13:20

Re: Shape transparent/unsichtbar, aber anklickbar
 
Dein Problem dürfte damit anfangen, daß eine Shape nicht einmal ein OnClick Ereignis besitzt :mrgreen:

Ansonsten versuche es mal mit Shape.BrushStyle := bsClear und Shape.PenStyle := psClear;

...:cat:...

Robert Marquardt 20. Okt 2003 13:22

Re: Shape transparent/unsichtbar, aber anklickbar
 
Ein leeres TImage sollte doch auch gehen. Zumindest wenn dir Rechtecke genuegen.

TShape hat durchaus ein OnClick. Es ist nur nicht public sondern protected.

sakura 20. Okt 2003 13:24

Re: Shape transparent/unsichtbar, aber anklickbar
 
Zitat:

Zitat von Robert Marquardt
TShape hat durchaus ein OnClick. Es ist nur nicht public sondern protected.

Gut :angle2: Dann muss er aber immer noch mindestens eine Komponente ableiten, um im OI darauf zuzugreifen, bzw. den üblichen Trick des (Fake)-Castings anwenden, um ranzukommen ;-)

...:cat:...

Char 20. Okt 2003 13:32

Re: Shape transparent/unsichtbar, aber anklickbar
 
So habs:

Meine Shapes werden zur Laufzeit erstellt, hätte ich vielleicht sagen sollen:

Delphi-Quellcode:
   
while blah do
begin

Shape := TShape.Create(self);

 with Shape do
  begin
     parent := PMap;
     height := iHeight;
     width := iWidth;
     left  := iXPos;
     top   := iYPos;
     hint  := sName;
     ShowHint := true;
     brush.style := bsClear;
     onMouseDown := ShMouseDown; { <-- onMouseDown statt OnClick }
     show;
  end;

end;
Mit brush.style := bsClear funktioniert es super, genau so wie ich wollte...

Vielen Dank :)


Alle Zeitangaben in WEZ +1. Es ist jetzt 16:56 Uhr.

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