Autor Beitrag
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 16.03.15 21:51 
Moin!

Nur auf den ersten Blick, eigentlich ist das fast immer das Gleiche und total regelmäßig. ;)

Dann schau mal hier rein, das ist die Lösung: de.m.wikipedia.org/w...e_Morgansche_Gesetze

Einfach mal versuchen, ist nicht schwer. :zustimm:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Nini Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 170
Erhaltene Danke: 12



BeitragVerfasst: Mo 16.03.15 22:11 
das heißt jetzt, dass not (a and b) = (not a) or (not b)
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 16.03.15 22:15 
Moin!

Top! :zustimm: Erkenntnis: wenn man bool'sche Terme negiert, müssen auch die Operatoren angepasst werden. Aus und wird oder und umgekehrt. :idea: Spannend, oder? :D

Und jetzt solltest du auch die Delphi-Zeile wieder reparieren können. ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Nini Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 170
Erhaltene Danke: 12



BeitragVerfasst: Mo 16.03.15 22:21 
so?

ausblenden Delphi-Quelltext
1:
if  ((not a) or (not b))<>0)  then					
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 16.03.15 22:24 
Moin!

Ne ;) "a" steht doch für "dx = 0", ein a kam vorher ja auch nicht vor... :lupe:

cu
Narses

PS: Öhm, vor deinem Edit war's richtiger... :?

_________________
There are 10 types of people - those who understand binary and those who don´t.
Nini Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 170
Erhaltene Danke: 12



BeitragVerfasst: Mo 16.03.15 22:27 
dann vielleicht so:
ausblenden Delphi-Quelltext
1:
if  ((dx<>0or (dy<>0)) then					
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 16.03.15 22:31 
Moin!

Genau so, optimal! :zustimm: Schon ausprobiert? ;)

Dann können wir uns langsam wieder den Shapes zuwenden. :les:

cu
Narses

PS: Ich bin gleich mal ne Stunde oder so offline.

_________________
There are 10 types of people - those who understand binary and those who don´t.
Nini Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 170
Erhaltene Danke: 12



BeitragVerfasst: Mo 16.03.15 22:43 
jaaa, es funktioniert :)
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 16.03.15 23:38 
Moin!

Soo, dann gehen wir mal an die dynamischen Shapes. ;)

Leg ein neues Projekt (zum Testen) an und lege einfach irgendwo (in die Mitte z.B.) einen Button ab. In dessen Handler schreibst du:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
procedure TForm1.btnTestClick(Sender: TObject);
  var
    Shape: TShape;
begin
  Shape := TShape.Create(Self); // Shape-Objekt erzeugen, als Eigentümer das Formular (=Self) angeben
  Shape.Parent := Self; // das neue Shape soll auf dem Formular (=Self) angezeigt werden
  Shape.Name := 'Shape1'// Name der Komponente
  Shape.Left := 8// 8 Pixel vom linken Rand
  Shape.Top := 8// 8 Pixel vom oberen Rand
  Shape.Width := 25// 25 Pixel breit
  Shape.Height := 25// 25 Pixel hoch
// Shape.OnMouseDown := Shape1MouseDown; // haben wir hier nicht, aber so weist man eine Methode zu
end;

Damit machen wir per Programmcode genau das, was die IDE automatisch macht, wenn du ein Shape aus der Komponentenpalette auf das Formular klickst. Aber eben nicht zur Entwurfszeit, sondern (erst) zur Laufzeit des Programms! :idea:

Noch etwas zu dem "Self"-Parameter beim Create: normalerweise muss man Objekte, die man zur Laufzeit erstellt, auch selbst wieder freigeben (weil dafür Speicher reserviert wird, der sonst nicht wieder freigegeben wird - das berühmte "memory leak"). Bei visuellen Komponenten gibt es aber einen praktischen Mechanismus, man kann nämlich beim Erzeugen einen "Eigentümer" angeben - und der ist dann dafür verantwortlich, dass die Komponente (und der zugehörige Speicher) beim Beenden des Programmes auch wieder freigegeben wird.

Probier mal aus, was da passiert. Wenn du das Programm startest und auf den Button klickst, sollte ein Shape links oben in der Ecke erscheinen. ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mi 18.03.15 20:58 
Moin!

Und, schon ausprobiert? ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Nini Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 170
Erhaltene Danke: 12



BeitragVerfasst: Mi 18.03.15 21:12 
ja,gere eben ausprobiert, wollte auch gleich noch antworten :P

es kommen voll viele fehlermeldungen :/
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mi 18.03.15 21:14 
Moin!

Du hast auch ein komplett neues Projekt zum Testen genommen? (wenn beim 2. Klick auf den Button Fehlermeldungen kommen, ist das normal)

Welche Fehler kommen? Kannste die mal hier reinkopieren? :lupe: :les:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Nini Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 170
Erhaltene Danke: 12



BeitragVerfasst: Mi 18.03.15 22:25 
die fehlermeldugnen auf dem bild zeigts mir alle an

ja, ich hab nen gesamtneues dings genommen
Einloggen, um Attachments anzusehen!
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mi 18.03.15 22:45 
Moin!

Ach so, der Compiler sagt doch nur, dass er TShape nicht kennt... :P Füg mal oben in der uses-Klausel ein:
ausblenden Delphi-Quelltext
1:
2:
uses
  ..., ExtCtrls;

Das sollte dann klappen. ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Nini Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 170
Erhaltene Danke: 12



BeitragVerfasst: Mo 23.03.15 16:23 
so, jetzt hab ich mal wieder Zeit zum programmieren :)

irgendwas klappt dann immer noch nicht, ich bekomme 49 Fehlermeldungen o.O
Einloggen, um Attachments anzusehen!
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 23.03.15 21:32 
Moin!

user profile iconNini hat folgendes geschrieben Zum zitierten Posting springen:
so, jetzt hab ich mal wieder Zeit zum programmieren :)
:zustimm:

user profile iconNini hat folgendes geschrieben Zum zitierten Posting springen:
irgendwas klappt dann immer noch nicht
:gruebel: Sehr komische Meldungen. Ich bin zugegeben nicht so firm mit Lazarus (muss mir doch mal bei Gelegenheit eine Test-Installation anlegen; welches Lazarus verwendest du? :lupe:)...

OK, gehen wir anders ran: Pack mal ein Shape auf das Formular, irgendeins, irgendwo. Das nennst du dann "TestShape" oder so (ist egal, nur nicht "Shape1"). Jetzt sollte sich automatisch die uses-Klausel oben im Projekt verändert haben, richtig? :les: Und jetzt sollte auch der Button-Code laufen bzw. sich das Ding überhaupt kompilieren lassen? :suspect:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Nini Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 170
Erhaltene Danke: 12



BeitragVerfasst: Mo 23.03.15 22:00 
ich verwende Lazarus IDE v1.2.6

wenn ich das Shape reinmache, dann kommt zu uses noch ExtCtrls dazu aber dann bleiben die 49 fehlermeldungen, wenn ich das aber rauslösche und das shape drinnen lasse sind es immerhin nur noch 3 Fehlermeldungen:
Identifier not found "TShape"
Error in type definition
Symbol can't be published, can be only a class
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 23.03.15 22:04 
Moin!

user profile iconNini hat folgendes geschrieben Zum zitierten Posting springen:
ich verwende Lazarus IDE v1.2.6
OK, danke.

user profile iconNini hat folgendes geschrieben Zum zitierten Posting springen:
wenn ich das Shape reinmache, dann kommt zu uses noch ExtCtrls dazu
Wie jetzt "kommt dazu", das hatte ich doch ein paar Posts weiter oben schon erwähnt, hattest du das noch nicht mit drin? :gruebel:

user profile iconNini hat folgendes geschrieben Zum zitierten Posting springen:
aber dann bleiben die 49 fehlermeldungen, wenn ich das aber rauslösche und das shape drinnen lasse sind es immerhin nur noch 3 Fehlermeldungen:
Zeig mal eben den kompletten Projekt-Quelltext. :les:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Nini Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 170
Erhaltene Danke: 12



BeitragVerfasst: Mo 23.03.15 22:07 
ich bin überfordert :P

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:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
unit Unit1;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
  ExtCtrls;

type

  { TForm1 }

    TForm1 = class(TForm)
    btnTest: TButton;
    testShape: TShape;
    procedure btnTestClick(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.lfm}

{ TForm1 }

  procedure TForm1.btnTestClick(Sender: TObject);
  var
    Shape: TShape;
begin
  Shape := TShape.Create(Self); // Shape-Objekt erzeugen, als Eigentümer das Formular (=Self) angeben
  Shape.Parent := Self; // das neue Shape soll auf dem Formular (=Self) angezeigt werden
  Shape.Name := 'Shape1'// Name der Komponente
  Shape.Left := 8// 8 Pixel vom linken Rand
  Shape.Top := 8// 8 Pixel vom oberen Rand
  Shape.Width := 25// 25 Pixel breit
  Shape.Height := 25// 25 Pixel hoch
// Shape.OnMouseDown := Shape1MouseDown; // haben wir hier nicht, aber so weist man eine Methode zu
end;
end.
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 23.03.15 23:25 
Moin!

Ich krieg jetzt auf die Schnelle keine Lazarus-Install gemacht... :? Aber an deinem Code ist auch nix komisches, wenn ich das mit dem hier vergleiche, dann geht das in Lazarus genau so wie in Delphi. :lupe: :nixweiss: Das muss also irgendwas anderes sein... :gruebel:

Gut, fangen wir nochmal langsam an:
  • Du erstellst nochmal ein komplett neues Projekt in einem eigenen Ordner
  • Theoretisch sollte ein neues Lazarus-Projekt sich (genauso wie in Delphi) direkt starten lassen: du hast dann eben nur ein leeres Formular und wenn du das zu machst, bist du wieder in der IDE
  • Einen Button und ein Shape auf das Formular legen, Programm starten, wieder schließen
  • Doppelklick auf dem Button machen (Handler wird angelegt), starten, schließen
  • Im Button-Handler die Variablendeklaration einfügen:
    ausblenden Delphi-Quelltext
    1:
    2:
    var
      Shape: TShape;
    , starten, schließen
  • Den restlichen Code im Button einfügen (wie oben), starten, schließen
  • Programm starten, auf den Button klicken

Bei welchem Schritt fangen die Probleme an? :suspect:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.