![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
TabControl Pages
Jon © (2008-01-19 19:10:00)Is it possible to dynamically show / hide individual pages in Tab Control?
(2009-07-17 09:30:00) [1]Удалено модератором
(2009-07-17 09:30:00) [2]Удалено модератором
Jon (2009-05-18 19:55:00) [3]Ah, hooks! Thank you very much Dmitry, I really appreciate the help.
Дмитрий К (2009-05-18 18:22:00) [4]
program Project1;
uses
Windows, Messages, KOL;
type
PForm1 = ^TForm1;
TForm1 = object(TObj)
private
Form, TC: PControl;
function FormMessage(var Msg: TMsg; var Rslt: Integer): Boolean;
procedure SwitchTab(Down: Boolean);
end;
var
Form1: PForm1;
KBHook: HHook;
const
WM_SWITCHTAB = WM_USER + $400;
function NewForm1(AParent: PControl): PForm1;
var i: Integer;
begin
New(Result, Create);
with Result^ do
begin
Form := NewForm(AParent, 'Form1');
Form.Add2AutoFree(Result);
TC := NEwTabControl(Form, ['0','1','2','3','4'], [], nil, 0).SetAlign(caCLient);
for i := 0 to 4 do
begin
NewLabel(TC.TC_Pages[i], 'Label '+ int2str(i));
end;
Form.OnMessage := FormMessage;
end;
end;
function TForm1.FormMessage(var Msg: TMsg; var Rslt: Integer): Boolean;
begin
Result := False;
case Msg.message of
WM_SWITCHTAB: SwitchTab(Boolean(Msg.wParam));
end;
end;
procedure TForm1.SwitchTab(Down: Boolean);
begin
if Down then
begin
if TC.CurIndex = 0 then
TC.CurIndex := TC.Count - 1
else
TC.CurIndex := TC.CurIndex - 1
end
else
if TC.CurIndex = TC.Count - 1 then
TC.CurIndex := 0
else
TC.CurIndex := TC.CurIndex + 1
end;
function KeybProc(Code: Integer; wParam, lParam: Integer): Integer; stdcall;
begin
if Code >= 0 then
begin
if (wParam = VK_TAB) and (lParam and $80000000 = 0) then
begin
if GetKeyState(VK_CONTROL) and $8000 = $8000 then
Form1.Form.Perform(WM_SWITCHTAB, (GetKeyState(VK_SHIFT) and $8000) shr 15, 0);
end;
end;
Result := CallNextHookEx(KBHook, Code, wParam, lParam);
end;
begin
Form1 := NewForm1(nil);
Applet := Form1.Form;
KBHook := SetWindowsHookEx(WH_KEYBOARD, KeybProc, 0, GetCurrentThreadID);
if KBHook = 0 then
MsgOK(SysErrorMessage(GetLastError));
Run(Applet);
UnhookWindowsHookEx(KBHook);
end.
Jon (2009-05-18 16:52:00) [5]> How can I enable CTRL+TAB and SHIFT+CTRL+TAB to navigate tabs (just like VCL)?
Can anyone please provide any help? Multi-tabbed applications are common nowadays and I would love to have this feature added to KOL.
Jon (2008-11-08 16:08:00) [6]
> How can I enable CTRL+TAB and SHIFT+CTRL+TAB to navigate tabs (just like VCL)?
I am still looking for a solution if anyone has suggestions.
(2008-08-08 16:13:00) [7]Удалено модератором
Jon (2008-01-29 03:16:00) [8]Bug with TabControl:
> function TC_DisplayRect: TRect;
> {* |<#tabcontrol>
> Returns rectangle, occupied by a page rather then tab. }
Result.Top and Result.Bottom include height of tab too.
Jon (2008-01-27 22:10:00) [9]Modifying KOL.PAS did not help.
I am willing to try suggestions from this forum.
Jon (2008-01-24 04:19:00) [10]Now trying to modify Tabulate2Control in KOL.PAS
Problem is that I break standard tabulate functions
The TAB key cannot be processed with key preview enabled
My attempts at sub-classing TabControl also unsuccessful
Is the keyboard handling for this control a bug or by design?
Dimaxx (2008-01-23 21:58:00) [11]I have no idea... :(
Jon (2008-01-23 11:49:00) [12]No, neither of those work.
Any other suggestions?
Dimaxx (2008-01-23 10:06:00) [13]Maybe Tabulate or TabulateEx?
Jon (2008-01-22 14:56:00) [14]I have tried but it does not work.
Is there an option to enable it?
I have tried with KOL and KOL+MCK.
Dimaxx (2008-01-22 13:57:00) [15]By default use Ctrl+PgDn & Ctrl+PgUp to navigate tabs.
Jon (2008-01-22 02:13:00) [16]Ah, I found a solution:
Remove:RemovedPage := TabControl.TC_Remove(0);
Insert:TabControl.TC_InsertControl(0,'Tab',0,RemovedPage);
Now a question on keyboard use:
How can I enable CTRL+TAB and SHIFT+CTRL+TAB to navigate tabs (just like VCL)?
Or do I have to code my own routine?
I thought that Tabulate would support this.