-
Is it possible to dynamically show / hide individual pages in Tab Control?
-
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.
-
By default use Ctrl+PgDn & Ctrl+PgUp to navigate tabs.
-
I have tried but it does not work. Is there an option to enable it? I have tried with KOL and KOL+MCK.
-
Maybe Tabulate or TabulateEx?
-
No, neither of those work. Any other suggestions?
-
I have no idea... :(
-
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?
-
Modifying KOL.PAS did not help. I am willing to try suggestions from this forum.
-
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.
-
Удалено модератором
-
> 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.
-
> 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.
-
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.
-
Ah, hooks! Thank you very much Dmitry, I really appreciate the help.
-
Удалено модератором
-
Удалено модератором
|