Autor Beitrag
aDm1n
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 37

Win XP
Turbo Delphi Explorer
BeitragVerfasst: Mi 12.04.06 14:46 
Tach, (ich mal wieder)
Kann mir eine(r) von euch verraten wieso das hier nicht klappt?

ausblenden Delphi-Quelltext
1:
2:
if user = 'administrator' then frm_administrator.showmodal;
if user <> 'administrator' then frm_user.Showmodal;


Ich möchte, dass sich das Fenster so öffnet, dass es erst geschlossen werden muss, bevor man wieder auf das Hauptfenster zugreifen kann. Eigentlich habe ich das schonmal verwendet wobei es funktioniert hat. Wenn ich mein Programm kompilieren will, meldet der Compiler: "Statement expected, but expression of type 'Integer' found"
Was mache ich falsch?

_________________
Gruß aDm1n
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5285
Erhaltene Danke: 29

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Mi 12.04.06 14:49 
erstmal machst du dat so:
ausblenden Delphi-Quelltext
1:
2:
3:
  if user = 'administrator' then 
    frm_administrator.showmodal else
      frm_user.showmodal;


sonst sollte alles stimmen :P
Horschdware
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 744
Erhaltene Danke: 54

Win XP Pro, Win 7 Pro x64
Delphi 7, Delphi XE, C++ Builder 5, SAP R/3
BeitragVerfasst: Mi 12.04.06 14:53 
Das sollte sollte eigentlich funktionieren... (sofern frm_administrator und frm_user TForms sind).

aber stell das doch etwas um:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
if (user = 'administrator') then 
  frm_administrator.showmodal 
else
  frm_user.showmodal;


edit: mist, zu spät

_________________
Delphi: XE - OS: Windows 7 Professional x64
aDm1n Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 37

Win XP
Turbo Delphi Explorer
BeitragVerfasst: Mi 12.04.06 14:58 
Hmmm...Was das aufschreiben angeht ist das schon besser so, aber das hat leider nichts geändert.

ausblenden Funktioniert immernoch nicht
1:
2:
3:
4:
if (user = 'administrator') then   
  frm_administrator.showmodal   
else  
  frm_user.showmodal;


edit: Wenn ich den show-befehl ohne "modal" benutze funktionierts... -_-

_________________
Gruß aDm1n


Zuletzt bearbeitet von aDm1n am Mi 12.04.06 14:59, insgesamt 1-mal bearbeitet
Horschdware
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 744
Erhaltene Danke: 54

Win XP Pro, Win 7 Pro x64
Delphi 7, Delphi XE, C++ Builder 5, SAP R/3
BeitragVerfasst: Mi 12.04.06 14:59 
sind die weiteren units im uses - teil eingetragen?

ausblenden Delphi-Quelltext
1:
uses ... Unit2, Unit3; //oder wie die bei dir heissen					


edit: ok, hat sich durch dein edit erledigt.

Ruf mal das Ganze so auf

frm_user.ShowModal();

nur so ne idee...

_________________
Delphi: XE - OS: Windows 7 Professional x64
aDm1n Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 37

Win XP
Turbo Delphi Explorer
BeitragVerfasst: Mi 12.04.06 15:01 
ja...

ausblenden Delphi-Quelltext
1:
uses u_administrator, u_user;					

_________________
Gruß aDm1n
aDm1n Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 37

Win XP
Turbo Delphi Explorer
BeitragVerfasst: Mi 12.04.06 15:03 
user profile iconHorschdware hat folgendes geschrieben:

Ruf mal das Ganze so auf

frm_user.ShowModal();

nur so ne idee...


Ändert leider nichts... -_-
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Mi 12.04.06 15:09 
Kannst du das gesamte Projekt mal hochladen?

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
aDm1n Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 37

Win XP
Turbo Delphi Explorer
BeitragVerfasst: Mi 12.04.06 15:21 
Meinetwegen...:)

Ich hab aber so langsam das Gefühl, dass ich nach Beenden dieses Threads nach dem "gegen-den-kopf-schlag"-smilie suchen werde -_-
Einloggen, um Attachments anzusehen!
_________________
Gruß aDm1n
Horschdware
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 744
Erhaltene Danke: 54

Win XP Pro, Win 7 Pro x64
Delphi 7, Delphi XE, C++ Builder 5, SAP R/3
BeitragVerfasst: Mi 12.04.06 15:25 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
if (user = 'administrator') then
begin
  frm_administrator.showmodal;
end
else
begin
  frm_user.showmodal;
end;


such mal den smilie ^^

_________________
Delphi: XE - OS: Windows 7 Professional x64
aDm1n Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 37

Win XP
Turbo Delphi Explorer
BeitragVerfasst: Mi 12.04.06 15:37 
Naja du hast Recht. *den gegen-den-kopf-schlag-smilie such* *ihn nicht find* *aufgeb* :)
Aber ist das denn generell so, dass man die Anweisungen wenn ein "show" darin vorkommt zwischen begin und end setzen muss?

_________________
Gruß aDm1n
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Mi 12.04.06 15:37 
user profile iconHorschdware hat folgendes geschrieben:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
if (user = 'administrator') then
begin
  frm_administrator.showmodal;
end
else
begin
  frm_user.showmodal;
end;


such mal den smilie ^^

Was ist denn da jetzt der Unterschied, nur dass da noch begin und end eingefügt wurden? :gruebel: :lupe:

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Horschdware
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 744
Erhaltene Danke: 54

Win XP Pro, Win 7 Pro x64
Delphi 7, Delphi XE, C++ Builder 5, SAP R/3
BeitragVerfasst: Mi 12.04.06 15:42 
ja, es sind wirklich nur begin und end dazugekommen.
finds auch merkwürdig.
in diesem fall besteht der seltsamerweise darauf.
normalerweise muss man das aber nicht so kapseln.

edit: hab mal schnell ein neues projekt aufgemacht und das geschreibselt:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
form2.showmodal;
form2.showmodal();
if 'A'='A' then form2.showmodal
  else form2.showmodal;


if 'A'='A' then 
begin
  form2.showmodal;
end
else
begin
  form2.showmodal;
end;


interessanterweise hat er mit keinem einzigen ein problem.
nur in deinem projekt. k.a. warum das so ist.
aber so wie ichs oben abgeändert hab sollte es gehn

nochnedit:
Was ist hier los?:

TForm.ShowModal ist anders als TForm.Show eine Funktion die einen Integer zurückgibt und keine Prozedur.
Eine Prozedur kann nur aufgerufen werden. Eine Funktion kann aufgerufen werden und es kann von ihr ein rückgabewert verlangt werden. Siehe:
ausblenden Delphi-Quelltext
1:
2:
StrToFloat(s);
fzahl := StrToFloat(s);

Normalerweise kann man eine funktion aufrufen und den rückgabewert ignorieren, d.h. nichts damit machen.
Interessanterweise kapiert der Compiler hier nicht, dass die funktion aufgerufen werden soll und sieht nur noch
den zurückgegebenen integer. und ein integer der einfach irgendwo so im quellcode steht stört den compiler bei der arbeit.
warum er die funktion aber nicht als funktion sieht ist mir schleierhaft...

_________________
Delphi: XE - OS: Windows 7 Professional x64
aDm1n Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 37

Win XP
Turbo Delphi Explorer
BeitragVerfasst: Mi 12.04.06 15:53 
Da bin ich aber erleichtert. Wenigstens wars net so ein typischer Dummheits-Fehler...

P.S. Vielleicht sollte ich zu X-Faktor gehen^^ :)

_________________
Gruß aDm1n
Horschdware
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 744
Erhaltene Danke: 54

Win XP Pro, Win 7 Pro x64
Delphi 7, Delphi XE, C++ Builder 5, SAP R/3
BeitragVerfasst: Mi 12.04.06 15:59 
och, da geh ich direkt mit *g*

oder zu Factor-X? (Fliegende Ausserirdische Clonen Tiere Ohnehin Recht seXy)

_________________
Delphi: XE - OS: Windows 7 Professional x64