Autor Beitrag
Nano-Ware
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 394
Erhaltene Danke: 7



BeitragVerfasst: So 22.07.12 20:28 
EDIT ERLEDIGT FUNKTIONIERT DOCH SO HABE NUR "Hint" STATT "Balloonhint" benutzt -.-


Hey,

ich verstecke mein Hauptformular direkt nach dem Start mit diesen zwei Zeilen:

ausblenden Delphi-Quelltext
1:
2:
Application.ShowMainForm := False;
  Application.MainFormOnTaskbar := False;


Diese Form soll sozusagen aber der Kontroller sein. Ich habe allerdings ein Problem: Außer Create wird ja keines der Events ausgelöst und im CreateEvent der Main Form kann ich ja keine Subform starten, also habe ich getrickst:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
begin
  Application.Initialize;
  Application.ShowMainForm := False;
  Application.MainFormOnTaskbar := False;
  Application.CreateForm(Tmain, main);
  main.Started;
  Application.Run;
end.


Jetzt kann ich in der "Started" Prozedure die Subform "start" erstellen und starten, das funktioniert auch sehr gut. Dann wollte ich aber in der selbigen Prozedure noch ein TrayIcon erstellen (TTrayIcon) das anzeigen mit Visible := True funktioniert, aber wenn ich einen Balloontip anzeigen will klappt das nicht. Der Code der Prozedure Started geht so (wobei wohl nur der untere Teil interessant ist):

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:
procedure Tmain.Started;
var
  f: Textfile;
begin
  //Check if the program starts the first time
  //Remove afte testin:
  DeleteFile(roaming + '\validate.dat');
  if NOT FileExists(roaming + '\validate.dat'then
  begin
    firststart := true;
    if FileExists('start.cfg'then
    begin
      AssignFile(f,'start.cfg');
      Reset(f);
      ReadLn(f,language);
      CloseFile(f);
    end;
    Application.CreateForm(Tfrm_start,frm_start);
    frm_start.Show;
  end;
  //loading settings
  sett := TSettings.Create(roaming + '\config.cfg');
  language := sett.GetValue('language');
  //loading the language file
  lang := TTranslator.Create('main',language);
  //show Balloontip by starting the first time
  ti_main.Visible := True;
  if firststart then
  begin
    ti_main.BalloonTitle := lang.GetMessage(1);
    ti_main.Hint := lang.GetMessage(2);
    ti_main.ShowBalloonHint;
  end;

end;


Ich bin jedem für seine Hilfe dankbar, ich weiß nämlich echt nichtmehr weiter. Würde ich die Form normal starten und dann mit Hide() verstecken geht es soweit ich weiß.. Dann tritt aber wieder dieses hässliche Phänomen auf, dass sich das derzeit geöffnete Fenster deaktiviert.