Autor Beitrag
Dietmar1961
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18



BeitragVerfasst: Do 21.06.07 10:13 
Hallo Delphianer

habe folgendes Problem

ein Form wird aufgerufen

im FormShow werden bestimmte Bedingungen geprüft, z.Bsp. Datensatz vorhanden

wie kann ich das Form vor der Anzeige wieder schließen, wenn bestimmte Anfangsbedingungen nicht erfüllt sind und ModalResult mrCancel zurückgeben???

Danke schon mal für eure Hilfe
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Do 21.06.07 10:17 
ausblenden Delphi-Quelltext
1:
ModalResult := mrCancel;					


sollte reichen.
Dietmar1961 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18



BeitragVerfasst: Do 21.06.07 10:26 
Titel: reicht leider nicht aus
Habs gerade ausprobiert und dachte schon soooooo einfach.

Hat leider nicht geklappt. Das Form wird trotzdem angezeigt????
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Do 21.06.07 10:31 
Du willst ins Auto einsteigen und gleichzeitig wieder aussteigen. Kann das Funktionieren? Prüf doe Bedingungen vorher und mach davon das Anzeigen des Formulares abhängig.
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Do 21.06.07 10:32 
Ich würde das dann über eine weitere Prozedur lösen. Also in der aufrufenden Form sowas:
 if Form2.BedingungenSindInOrdnung then Form2.Show; Dabei ist BedingungenSindInOrdnung eine Funktion, die die Überprüfungen ausführt, die jetzt im Show drin sind und True oder False zurückliefert.

Edit: Ich tippe zu langsam :(

_________________
We are, we were and will not be.
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Do 21.06.07 10:38 
Titel: Re: reicht leider nicht aus
user profile iconDietmar1961 hat folgendes geschrieben:
Hat leider nicht geklappt. Das Form wird trotzdem angezeigt????

Ach stimmt. Im OnFormShow könnte es nicht funktionieren... hatte ich überlesen...
Dietmar1961 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18



BeitragVerfasst: Do 21.06.07 11:21 
Titel: Danke
Danke an alle für die Tipps, auf euch ist halt verlaß

Ich werde in Zukunft zuerst prüfen ob ich ins Auto einsteigen will bevor ichs dann wirklich tue

:D
arj
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 378

Win XP/Vista, Debian, (K)Ubuntu
Delphi 5 Prof, Delphi 7 Prof, C# (#Develop, VS 2005), Java (Eclipse), C++, QT, PHP, Python
BeitragVerfasst: Do 21.06.07 16:25 
... und falls das nicht möglich ist, einfach folgendes machen (in FormShow)

ausblenden Delphi-Quelltext
1:
---Zensiert---					


(Aber unten noch lesbar, also NICHT implementieren)


Zuletzt bearbeitet von arj am Do 21.06.07 17:04, insgesamt 1-mal bearbeitet
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Do 21.06.07 16:29 
user profile iconarj hat folgendes geschrieben:
... und falls das nicht möglich ist, einfach folgendes machen (in FormShow)

ausblenden Delphi-Quelltext
1:
2:
Form.Left = -5000
Hide;

Aua, das tut ja weh, wenn man so was sieht.
arj
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 378

Win XP/Vista, Debian, (K)Ubuntu
Delphi 5 Prof, Delphi 7 Prof, C# (#Develop, VS 2005), Java (Eclipse), C++, QT, PHP, Python
BeitragVerfasst: Do 21.06.07 16:40 
Ja, es tut weh. Ich schreib sowas auch nicht gerne, aber es ist eine Möglichkeit ;)

:oops: Schande über mich
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Do 21.06.07 16:51 
1. Hide geht in onShow nicht.
2. Theoretisch könnte man 5 Monitore haben, wobei der primäre monitor der ganz rechts wär, und schon würds ganz links angezeigt werden... (Ok, ok, 5 Monitore nebeneinander ist etwas hypothetisch^^)

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
arj
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 378

Win XP/Vista, Debian, (K)Ubuntu
Delphi 5 Prof, Delphi 7 Prof, C# (#Develop, VS 2005), Java (Eclipse), C++, QT, PHP, Python
BeitragVerfasst: Do 21.06.07 17:03 
okay okay. Ist ja gut meine Idee war *schxxxe*.
COMMANDER86
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 167

Win XP, Win Vista
D3 Prof., D7 Pers., Lazarus
BeitragVerfasst: Do 21.06.07 18:33 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
  if BEDINGUNG_HASSENICHGESEHEN = True
  then
  begin
    FormX.Show;
    Hide;
  end else begin
    //Wenn was angezeigt werden soll:
    ShowMessage ('Meldung');
    //Wenn Hauptformular geschlossen werden soll: Form1 = Hauptformular) evt. Editieren
    Form1.Close;
  end;


Natürlich ist auch eine Kombi aus Meldung und Programm kicken möglich (Erst nach Bestätigung der Meldung werden die folgenden Aktionen abgearbeitet):

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
{...}
    end else begin
      ShowMessage ('Ich mach das Programm dann mal wech...');
      Form1.Close;
    end;


Diese Bedingung da hin pflanzen, wo das Fenster aufgerufen wird. Die Abfragen reinmachen (geiles Wort) und gut is. ^^

Wie immer bei mir: Nicht elegant, aber funktioniert. ;)

_________________
Streichen Sie bitte sämtlichen Sarkasmus aus vorhergehender Nachricht. Dann wissen Sie, was ich sagen möchte. Meine Lösungen sind die vermutlich Umständlichsten, aber sie funktionieren (bei mir). ;)