Autor Beitrag
Patriol
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 52


D3, D5, D7
BeitragVerfasst: Mo 16.01.06 14:38 
Hallo zusammen,

also mein prob is, dass ich auf meinen Form nich zwischen den Editfeldern per tabulator springen kann.

Es is folgende Situation bei mir:

ich habe ein form, was oben buttons hat mit denen man jeweils eine dll aufruft. im unteren teil dieses forms hab ich ein panel auf das ich ein zweites form lege (kommt aus der dll). wenn ich im zweiten form eine editkomponente selektiere und dann auf tab drücke, dann ändert sich der fokus immer auf dem ersten form (mit den buttons).

wie kann ich es realisieren, dass der fokus auf meinem zweiten form liegt. besser wäre noch, wenn ich alle komponenten (von beiden forms) in einer bestimmten reihefolge mit tab ansprechen kann.

thx for help
Tilo
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 1098
Erhaltene Danke: 13

Win7 geg. WInXP oder sogar Win98
Rad2007
BeitragVerfasst: Mo 16.01.06 14:47 
Die Reihenfolge beim Tab-Aufruf wird durch die Eigenschaft TabOrder regelt.
Ob ein Objekt in dieser "Reihe" ist wird durch seine Eigenschaft TabStop regelt.
Den Fokus an das 2.Form übergibst du mit
ausblenden Delphi-Quelltext
1:
 Form2.SetFocus;					


Hoffe das hilft
Patriol Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 52


D3, D5, D7
BeitragVerfasst: Mo 16.01.06 14:53 
Danke soweit erstmal, werds heute abend mal auspropieren...
Patriol Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 52


D3, D5, D7
BeitragVerfasst: Mo 16.01.06 20:10 
hab das gerad mal ausprobiert und irgendwie funzt das auch nich.

hier mal der code mit dem ich das zweite form aufrufe:

ausblenden 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:
procedure TfmMain.ShowMainWindow(AForm: TForm);
begin
  // Das aktuelle Form schließen
  if (FCurrMainForm <> nilthen
    FreeAndNil(FCurrMainForm);

  // das neue Form setzen
  FCurrMainForm := AForm;
  if (FCurrMainForm <> nilthen
  begin
    with FCurrMainForm do
    begin
      ParentWindow := pnlMain.Handle;
      BorderStyle  := bsNone;
      Top          := 0;
      Left         := 0;
      Width        := pnlMain.Width;
      Height       := pnlMain.Height;
      Show;
      SetFocus;
    end;
  end;
end;
Tilo
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 1098
Erhaltene Danke: 13

Win7 geg. WInXP oder sogar Win98
Rad2007
BeitragVerfasst: Di 17.01.06 15:37 
Was ist showmainWindow?
Danny87
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 688

Windows 10 Pro 64bit
Sprachen: HTML, PHP, JavaScript, Delphi || IDE: RAD Studio 10.1 Berlin Starter, WeBuilder
BeitragVerfasst: Di 17.01.06 15:48 
Ich würde sagen, eine von ihm selbst erstellte prozedur ?. :-)
Patriol Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 52


D3, D5, D7
BeitragVerfasst: Di 17.01.06 17:24 
Zitat:
Ich würde sagen, eine von ihm selbst erstellte prozedur ?.


Korrekt :wink:
noidic
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 851

Win 2000 Win XP Vista
D7 Ent, SharpDevelop 2.2
BeitragVerfasst: Di 17.01.06 17:39 
Ist KeyPreview vom ersten Form an? Vielleicht stört das *ins Blaue rat*

_________________
Bravery calls my name in the sound of the wind in the night...
Patriol Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 52


D3, D5, D7
BeitragVerfasst: Di 17.01.06 21:26 
Zitat:
Ist KeyPreview vom ersten Form an? Vielleicht stört das *ins Blaue rat*


Habs im FormCreate auf false gesetzt ... bringt aber auch nix :(
Tilo
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 1098
Erhaltene Danke: 13

Win7 geg. WInXP oder sogar Win98
Rad2007
BeitragVerfasst: Mi 18.01.06 10:30 
wie rufts Du(user profile iconPatriol denn ShowmainWindow auf?
ist das übergebene Tform schon initialisiert? Wenn nicht ist dies der Fehler.
Patriol Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 52


D3, D5, D7
BeitragVerfasst: Mi 18.01.06 13:36 
Das übergebene Form ist initialisiert! Das Form selber wird ja auch angezeigt und ich kann die enthaltenen funktionen nutzen. das problem ist nur, dass der fokus nicht auf dem zweiten form liegt und ich dadurch nicht per tab zwischen den editfeldern wechseln kann.
Tilo
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 1098
Erhaltene Danke: 13

Win7 geg. WInXP oder sogar Win98
Rad2007
BeitragVerfasst: Do 19.01.06 08:34 
versuch doch mal einen der folgenden Befehle in der OncreateRoutine des 2. Form:
ausblenden Delphi-Quelltext
1:
2:
FocusControl(self);
SetFocus;


Wie Du es schilderst wird OnCreate ausgeführt. So müsste das 2. Form eigentlich den Focus erhalten.
Patriol Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 52


D3, D5, D7
BeitragVerfasst: Do 19.01.06 20:16 
@Tilo
Also wenn ich deine beiden Befehle in das On-Create-Ereignis schreibe krieg ich immer ne fehlermeldung, dass der fokus nich aufn unsichtbares fenster gesetzt werden kann.
Hab dann die befehle hinter den show-aufruf gesetzt und da kam die selbe fehlermeldung.

hab mir mal n kleines testprog dazu geschrieben und hab festgestellt, dass wenn ich mir n form aus ner dll lade nur der effekt mit dem tab auftritt. wenn ich n form direkt aus der exe so aufrufe, dann kann ich auch zwischen den editfeldern mit der tab-taste wechseln :?

Hab jetzt echt keine ahnung was ich jetz noch falsch mache...

ich pack mal den source meines kleines testptrogramms hier hin ... vielleicht seht ihr was ich da falsch mache...

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:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
unit frmMain;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, frmSec, XPMan;

type
  TTab_DLL = function: TForm;

type
  TfmMain = class(TForm)
    pnlControl: TPanel;
    pnlmain: TPanel;
    cmLoadSecForm: TButton;
    cmClear: TButton;
    XPManifest1: TXPManifest;
    Button1: TButton;
    Button2: TButton;
    procedure FormCreate(Sender: TObject);
    procedure cmLoadSecFormClick(Sender: TObject);
    procedure cmClearClick(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
    FCurrMainForm: TForm;

    procedure ShowMainWindow(AForm: TForm);
  public
    { Public declarations }
  end;

var
  fmMain: TfmMain;

implementation

{$R *.dfm}

procedure TfmMain.FormCreate(Sender: TObject);
begin
  FCurrMainForm := nil;
end;

procedure TfmMain.ShowMainWindow(AForm: TForm);
begin
  // Das aktuelle Form schließen
  if (FCurrMainForm <> nilthen
    FreeAndNil(FCurrMainForm);

  // das neue Form setzen
  FCurrMainForm := AForm;
  if (FCurrMainForm <> nilthen
  begin
    with FCurrMainForm do
    begin
      ParentWindow := pnlMain.Handle;
      BorderStyle  := bsNone;
      Top          := 0;
      Left         := 0;
      Width        := pnlMain.Width;
      Height       := pnlMain.Height;
      Show;
    end;
  end;
end;

procedure TfmMain.cmLoadSecFormClick(Sender: TObject);
begin
  ShowMainWindow(TfmSec.Create(nil));
end;

procedure TfmMain.cmClearClick(Sender: TObject);
begin
  if (FCurrMainForm <> nilthen
    FreeAndNil(FCurrMainForm);
end;

procedure TfmMain.FormDestroy(Sender: TObject);
begin
  if (FCurrMainForm <> nilthen
    FreeAndNil(FCurrMainForm);
end;

procedure TfmMain.Button2Click(Sender: TObject);
var
  lDLLHandle  : THandle;
  lTab_DLL    : TTab_DLL;
begin
  lDLLHandle := LoadLibrary(PChar('Tab_DLL.dll'));
  if (lDLLHandle > 0then
  begin
    lTab_DLL:= GetProcAddress(FDLLHandle, 'GetForm');

    ShowMainWindow(lTab_DLL);
  end;
end;

end.


die funktion in der dll macht folgendes:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
function GetForm: TForm;
begin
  Result := TfmSec.Create(nil);
end;


im prinzip mach ich doch alles ananlog zueinander!? wieso kann ich dann, wenn ich das form aus der dll aufruf nich mit tab zwischen den editfeldern wechseln und wenn ichs aus der exe aufruf dann kann ichs???

wär cool wenn jmd n idee hat.
Tilo
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 1098
Erhaltene Danke: 13

Win7 geg. WInXP oder sogar Win98
Rad2007
BeitragVerfasst: Fr 20.01.06 15:47 
@user profile iconPatriol
Hast Du ben fokusCode schonmal in der Onshowroutine, OnActive oder Onpaint probiert?
Patriol Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 52


D3, D5, D7
BeitragVerfasst: Mo 23.01.06 18:58 
sorry das es etwas länger gedauert hat...

auch wenn ich den fokuscode in die benannten routinen packe bekomme ich die fehlermeldung bzw. eine access violation.

ich denke mal das problem mit dem fokus hat eher damit was zu tun das ich mir das form aus der dll hole. nur leider hab ich keine einzige idee warum das sone probs macht...