Autor Beitrag
Hasche
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 43



BeitragVerfasst: Do 06.03.08 13:19 
Hey!
Schreibe grad nen Programm, welches Städte abfragt und dann anzeigt, wo sie liegen in Form von Shapes.
Nun möchte ich aber aShape wieder verschwinden lassen bei nem Buttonklick oder ähnlichem. Allerdings meckert das Prog immer rum am Startanfang, da ja noch kein Punkt zum löschen da is..
Wie kann ich dem Prog sagen, dass er den Punkt zwar unsichtbar machen soll, allerdings nich beim 1. Buttonklick sondern erst ab dem 2.?
Hab das Prog mit Quelltext ma angefügt, hoffe es findet jemand Zeit..
Danke

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
procedure TForm1.Button1Click(Sender: TObject);
var
  i: Integer;
begin
  Label5.Visible:=False;

  if bShape.Visible=false then aShape.Visible:=false;
end;

procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var
  Abstand: real;
begin
 // TForm1.CreateNew(0);
  if Button1.Enabled then Exit;

  Label3.Visible := true;
  bShape.Visible := true;

  aShape := TShape.Create(Self);
  aShape.Parent := self;
  aShape.Width := 4;
  aShape.Height := 4;
  aShape.Shape := stCircle;
  aShape.Top := y + Image1.Top - 2;      // Mauspunkt Y
  aShape.Left := x + Image1.Left - 2;      // Mauspunkt X

  Abstand := Round(Sqrt(Sqr(CorrectX - (x + 14)) + Sqr(CorrectY - (y + 102))));
  Label2.Caption := FloatToStr(Abstand * 44.3);
  Gesamtkm := Gesamtkm + Abstand * 44.3;
  Label7.Caption := FloatToStr(Gesamtkm);

  Label8.Visible:=true;

  Button1.Enabled := True;
end;



Moderiert von user profile iconNarses: Topic aus Delphi Language (Object-Pascal) / CLX verschoben am Mi 19.03.2008 um 22:56
Einloggen, um Attachments anzusehen!
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19339
Erhaltene Danke: 1752

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 06.03.08 13:57 
Zum Beispiel geht es wie gesagt so, dass du die Shapes gar nicht erst zur Laufzeit erstellst. Sonst solltest du das dann in FormCreate machen, wenn du das unbedingt machen willst.

Du musst in dem Programm jetzt nur noch beim Klick auf den Button für die nächste Frage den weißen Shape unsichtbar machen. ;-)
Einloggen, um Attachments anzusehen!
Hasche Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 43



BeitragVerfasst: Mi 19.03.08 11:52 
Ein Hoch auf den guten alten jaenicke :)

Danke!