Autor Beitrag
chrisdrury
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 184

WinXP
D5 Prof
BeitragVerfasst: Mo 12.12.05 10:06 
Hallo,
ich habe da ein Problem mit dem Wechseln von TabSheets innerhalb eines PageControls per Tastendruck.
Versucht habe ich es bisher damit:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TEditForm.FormKeyDown(Sender: TObject; var Key: Word; 
  Shift: TShiftState); 
begin 
  ... 
  if Key = VK_F11 then 
  begin 
    with PageControl1 do 
         FindNextPage(ActivePage, true, true); 
    Key := 0; 
  end; 
end;


Leider funktioniert es nicht! :(
Eine andere Möglichkeit gibt es offensichtlich nicht, da TPageControl ja kein OnKeyDown-Ereignis hat.
Ach ja, bei TEditForm ist KeyPreview := True;
Hat jemand da vielleicht eine andere Lösung gefunden?
petergensfeld
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 46

Windows Vista 32-Bit
Delphi XE Professional
BeitragVerfasst: Mo 12.12.05 10:20 
Wird das Ereignis nicht ausgelöst oder funktioniert die Umschaltung auf eine andere Page nicht?
chrisdrury Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 184

WinXP
D5 Prof
BeitragVerfasst: Mo 12.12.05 10:23 
Die Umschaltung auf eine andere Page funktioniert nicht.
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Mo 12.12.05 10:25 
Hallo,

würde sagen, da fehlt was:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TEditForm.FormKeyDown(Sender: TObject; var Key: Word;   
  Shift: TShiftState);   
begin   
  ...   
  if Key = VK_F11 then   
  begin   
    with PageControl1 do   
      ActivePage := FindNextPage(ActivePage, true, true);   
    Key := 0;   
  end;   
end;

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
chrisdrury Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 184

WinXP
D5 Prof
BeitragVerfasst: Mo 12.12.05 10:30 
Habe ich auch schon versucht, funktioniert nicht.
Laut Delphi-Hilfe ist ActivePage auch nur zum Lesen geeignet, eine Zuweisung klappt also nicht.
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: Mo 12.12.05 10:36 
Das sollte mit PageControl1.ActivePageIndex := PageControl1.ActivePageIndex + 1; gehen. Natürlich muss man noch ne Bereichsüberprüfung mit einbauen ;-)

_________________
We are, we were and will not be.
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Mo 12.12.05 10:37 
Hallo,

ich zitiere mal:
user profile iconDelphi-Hilfe hat folgendes geschrieben:
Eine Zuweisung an Active Page bringt eine Registerkarte in den Vordergrund.

Nehme an das die Taste nicht bei der Form ankommt.
Wenn du mal ein Tab von Hand aktivierst und dann [F11] betätigst, funktioniert es.

//Edit: alternativ >
ausblenden Delphi-Quelltext
1:
SelectNextPage(true);					

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
chrisdrury Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 184

WinXP
D5 Prof
BeitragVerfasst: Mo 12.12.05 11:12 
Alles ausprobiert, tut sich nichts.
Ich glaube inzwischen auch, daß das OnkeyDown-Ereignis gar nicht am PageControl oder den TabSheets ankommt.
Aber wie soll's sonst klappen?

Edit:
Hat's vielleicht damit zu tun, daß EditForm ein MDI-Child ist?
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Mo 12.12.05 11:45 
Hallo,

kann es sein das Du die Tabs ausgeblendet hast :?:
Dann änder mal die Zeile:
ausblenden Delphi-Quelltext
1:
ActivePage :=  FindNextPage(ActivePage, true, False);					

noch mal ein zitat:
user profile iconDelphi-Hilfe hat folgendes geschrieben:
Wenn CheckTabVisible True ist, gibt FindNextPage die nächste Registerkarte zurück, deren Eigenschaft TabVisible auf True gesetzt ist.

Also findet er kein nächstes Tabsheet :wink:

Ps.: SelectNextPage kann bei ausgeblendeten Tabs nicht genutzt werden.
user profile iconDelphi-Hilfe hat folgendes geschrieben:
SelectNextPage berücksichtigt nur Registerkarten, deren Eigenschaft TabVisible den Wert True hat..

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
petergensfeld
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 46

Windows Vista 32-Bit
Delphi XE Professional
BeitragVerfasst: Mo 12.12.05 12:06 
Wie wär's, wenn Du erst mal einen Breakpoint in Deine KeyDown-Routine setzt, um zu sehen, ob sie überhaupt ausgeführt wird. Das grenzt schon mal die Fehlersuche ein.


// edit:

In meinem D5 Prof. funktioniert folgender Code einwandfrei:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if Key=vk_F11 then
    PageControl1.SelectNextPage(true);
end;
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Mo 12.12.05 12:16 
Hallo,

wenn die Tabs auf TabVisible := False; gesetzt sind,
nicht mehr, oder ist das bei D5 anders?

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
chrisdrury Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 184

WinXP
D5 Prof
BeitragVerfasst: Mo 12.12.05 14:13 
So, das Problem ist gelöst!
Ich Idiot hatte die F11-Taste bereits für eine andere Funktion belegt!:oops: :cry:
Jetzt läuft es!
Nochmal Danke für eure Tipps!
petergensfeld
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 46

Windows Vista 32-Bit
Delphi XE Professional
BeitragVerfasst: Mo 12.12.05 15:16 
user profile iconLannes hat folgendes geschrieben:
wenn die Tabs auf TabVisible := False; gesetzt sind, nicht mehr, oder ist das bei D5 anders?

Nein, natürlich nicht. Aber da man TabVisible schon explizit auf false setzen muss, bin ich einfach mal davon ausgegangen, dass das hier nicht das Problem ist.