In our Payroll design work I have tried a new solution inspired by the Role Tailored Client. I want to be able to collapse and expand the tab control to give more space for the subform.

I put a button with an up arrow and another with a down arrow on the form.  I also put a menu item in the Functions menu button to toggle between collapse and expand with a shortcut key Alt-F6, the same key that is used in RTC.

The buttons
[code]{ 57;CommandButton;15400;880;550;550;Name=DownBtn;
HorzGlue=Right;
Focusable=No;
ParentControl=<TabControlID>;
InPage=0;
ShowCaption=No;
Bitmap=1863;
OnPush=BEGIN
UpdateTabs(NOT TabExpanded);
END;
}
{ 58;CommandButton;15400;880;550;550;Name=UpBtn;
HorzGlue=Right;
Focusable=No;
ParentControl=<TabControlID>;
InPage=0;
ShowCaption=No;
Bitmap=1862;
OnPush=BEGIN
UpdateTabs(NOT TabExpanded);
END;
}[/code]
The function
[code]PROCEDURE UpdateTabs@51(Expanded@1 : Boolean);
BEGIN
TabExpanded := Expanded;
IF Expanded THEN BEGIN
CurrForm.HeadTab.HEIGHT := 6160;
CurrForm.BatchPanel.HEIGHT := 6160;
CurrForm.WageEarnerLines.YPOS := 6490;
CurrForm.WageEarnerLines.HEIGHT := CurrForm.HEIGHT – 7370;
CurrForm.DownBtn.VISIBLE := FALSE;
CurrForm.UpBtn.VISIBLE := TRUE;
END ELSE BEGIN
CurrForm.HeadTab.HEIGHT := 1320;
CurrForm.BatchPanel.HEIGHT := 1320;
CurrForm.WageEarnerLines.YPOS := 1650;
CurrForm.WageEarnerLines.HEIGHT := CurrForm.HEIGHT – 2530;
CurrForm.DownBtn.VISIBLE := TRUE;
CurrForm.UpBtn.VISIBLE := FALSE;
END;
END;[/code]
Where 7370 is the space on the form needed for other objects when the tab control is expanded and 2530 when the tab control is collapsed.

And in OnOpenForm trigger
[code]OnOpenForm=BEGIN
UpdateTabs(TRUE);
END;[/code]
And finnally the Global Variable
[code]TabExpanded@53 : Boolean;[/code]

Leave a Reply

%d bloggers like this: