Please enable JavaScript to view this site.

KOL/MCK - User Guide

tabcontrol

 

This visual control, encapsulated in the TControl type, also applies to list visual objects (its "items" are bookmarks, along with the corresponding pages). The main purpose of this object is to provide the presence of several "pages", or panels, with their own set of child visual objects located in each of them, and a set of bookmarks for switching between these pages. There is also a particular task: to ensure the presence of programmatically switchable pages, without giving the user the opportunity to independently navigate to any of these pages. This goal is also not difficult to achieve using this kind of window object (by hiding tabs).

 

Constructors:

 

NewTabControl(Parent, tabs, options, imglist, imgidx1)- creates a multi-page object, immediately adding to it a number of bookmarks, specified by the composition of the lines in the tabs array, and assigning these lines to these bookmarks as the text of the bookmarks. The presence of the imgidx1 parameter allows you to combine the use of one list of images for some purposes: the indexes of icons to be displayed in bookmarks are assigned starting from the value of this parameter. Of course, image lists are optional, so it is okay to pass nil as the imglist parameter.

 

function NewTabEmpty( Parent, options, imglist)

Creates new empty tab control for using metods TC_Insert (to create Pages as Panel), or TC_InsertControl (if you want using your custom Pages).

 

The following options are defined for tabbed panels:

tcoButtons - bookmarks look like buttons;

tcoFixedWidth - fixed (the same for all) bookmark width;

tcoFocusTabs - draw a frame in a bookmark;

tcoIconLeft - display the icon in the tab on the left, and the text on the right;

tcoLabelLeft - display the icon on the right, and the text on the left;

tcoMultiline - bookmarks are placed on several lines;

tcoMultiselect - multiple selection of bookmarks;

tcoFitRows -

tcoScrollOpposite -

tcoBottom - bookmarks are located at the bottom;

tcoVertical - bookmarks are located on the left (if the tcoBottom option is present, on the right);

tcoFlat - "flat" bookmarks;

tcoHotTrack - "hot" highlighting of the bookmark under the mouse cursor;

tcoBorder - border around the entire window;

tcoOwnerDrawFixed - the OnDrawItem event handler is called to draw the contents of the bookmarks.

 

 

Properties, methods, events:

 

CurIndex - index of the current bookmark;

IndexOf(s) or TC_IndexOf (s) - returns the index of the page with the specified text in the bookmark;

SearchFor(s, i, partial) or TC_SearchFor (s, i, partial) - similar to IndexOf, but additionally allows you to specify the index after which to start the search, and set the way to compare the text of the element with the pattern (partial comparison of the first characters);

OnChange - this event is triggered when another bookmark becomes current (programmatically or as a result of user actions);

ImageListNormal - access to an object that provides images of icons for display in bookmarks;

SetUnicode(b) - allows you to switch the object window to the mode of working with Unicode strings (it is required to include the UNICODE_CTRLS conditional compilation symbol in the project options);

 

 

Special properties characteristic of this particular type of object:

 

Pages[i] or TC_Pages [i] - access to object panels. For example, to create a label on the panel with index 0, you should call:

NewLabel (Tabcontrol1.Pages [0], 'text');

TC_Insert(i, s, ii) - inserts one more bookmark (together with the panel);

TC_Delete(i) - deletes the bookmark with the specified index;

TC_Items[i] - access to the text of the i-th bookmark;

TC_Images[i] - managing the index of the icon in the bookmark;

TC_ItemRect[i] - the rectangle occupied by the bookmark in the window of the whole object;

TC_SetPadding(cx, cy) - sets the indent from the edge of the bookmark to the text in it;

TC_TabAtPos(X, Y) - returns the index of the bookmark located in the object window at the specified coordinates (or -1 if there are no bookmarks in this position);

TC_DisplayRect - the rectangle occupied by the client part of the current page in the object window (in fact, for all pages this rectangle is the same, because when another page becomes the current one, it is simply shown "in front" of all the others, obscuring them from view user). It is this rectangle that is convenient to use in order to "crop" the edges of the object along with the tabs at runtime, making them invisible and inaccessible to the user. For example, like this:

 

var Rgn: HRgn; 
...
Rgn: = CreateRectRgnIndirect (Tabcontrol1.TC_DisplayRect);
SetWindowRgn (Tabcontrol1.Handle, Rgn, true);
DeleteObject (Rgn);

 

If at the same time. for example, place bookmarks at the bottom (tcoBottom option), then after trimming the bookmarks, the object looks almost the same as if it were a regular panel (without a convex or indented border). The remaining space at the bottom can be used to place (on the other parent) some buttons. When designing in MCK, such border cropping, of course, does not change the appearance of the object, and it is still possible to switch between bookmarks (by double-clicking on the bookmark).

 

The Mirror Classes Kit has a mirror component TKOLTabControl for the bookmarked pages object. Many beginners to work with MCK, having dropped it on the form, do not know what to do with it (how to add bookmarks, delete or move them). I think the information below will come in handy.

 

To set the initial number of bookmarks during development, or to increase this number, you need to change the value of the Count property - in the Object Inspector. For example, enter the number 3 to create initially three bookmarks. In order to select a certain bookmark as the current one during the configuration of the form (design time), double-click on it (just on the bookmark). In order to delete a bookmark, you need to make it current, select its panel, and press the <Delete> key on the keyboard. Finally, to change the order in which the tabs are displayed, use the TabOrder property of the panel. For the changes to take effect, you can, for example, make a double click on the object window, in the area free of both tabs and panels.

 

KOL / MCK User Guide - Created by Carl Peeraer - Diamant Soft, based on the work of Vladimir Kladov - Artwerp.be

  

Keyboard Navigation

F7 for caret browsing
Hold ALT and press letter

This Info: ALT+q
Nav Header: ALT+n
Page Header: ALT+h
Topic Header: ALT+t
Topic Body: ALT+b
Exit Menu/Up: ESC