Tab – Giavapps Windows API

 

 

api_tab_create(ParentHandle, X, Y, W, H, Flags, ExFlags) This function creates a tab control.

ParentHandle: parent handle.
X: x coordinate.
Y: y coordinate.
W: width.
H: height.
Flags: Flags of the control. Flags must be separated with the symbol "|".
ExFlags: extended flags of the control. Flags must be separated with the symbol "|".

 

Flags

 

This control supports the Window Styles and you can specify any of the styles listed below:

 

TCS_BOTTOM Tabs appear at the bottom of the control. This value equals TCS_RIGHT.

TCS_BUTTONS Tabs appear as buttons, and no border is drawn around the display area.

TCS_FIXEDWIDTH All tabs are the same width. This style cannot be combined with the TCS_RIGHTJUSTIFY style.

TCS_FLATBUTTONS Selected tabs appear as being indented into the background while other tabs appear as being on the same plane as the background. This style only affects tab controls with the TCS_BUTTONS style.

TCS_FOCUSNEVER The tab control does not receive the input focus when clicked.

TCS_FOCUSONBUTTONDOWN The tab control receives the input focus when clicked.

TCS_FORCEICONLEFT Icons are aligned with the left edge of each fixed-width tab. This style can only be used with the TCS_FIXEDWIDTH style.

TCS_FORCELABELLEFT Labels are aligned with the left edge of each fixed-width tab; that is, the label is displayed immediately to the right of the icon instead of being centered. This style can only be used with the TCS_FIXEDWIDTH style, and it implies the TCS_FORCEICONLEFT style.

TCS_HOTTRACK Items under the pointer are automatically highlighted. You can check whether or not hot tracking is enabled by calling SystemParametersInfo.

TCS_MULTILINE Multiple rows of tabs are displayed, if necessary, so all tabs are visible at once.

TCS_MULTISELECT Multiple tabs can be selected by holding down the CTRL key when clicking. This style must be used with the TCS_BUTTONS style.

TCS_OWNERDRAWFIXED The parent window is responsible for drawing tabs.

TCS_RAGGEDRIGHT Rows of tabs will not be stretched to fill the entire width of the control. This style is the default.

TCS_RIGHT Tabs appear vertically on the right side of controls that use the TCS_VERTICAL style. This value equals TCS_BOTTOM.

TCS_RIGHTJUSTIFY The width of each tab is increased, if necessary, so that each row of tabs fills the entire width of the tab control. This window style is ignored unless the TCS_MULTILINE style is also specified.

TCS_SCROLLOPPOSITE Unneeded tabs scroll to the opposite side of the control when a tab is selected.

TCS_SINGLELINE Only one row of tabs is displayed. The user can scroll to see more tabs, if necessary. This style is the default.

TCS_TABS Tabs appear as tabs, and a border is drawn around the display area. This style is the default.

TCS_TOOLTIPS The tab control has a ToolTip control associated with it.

TCS_VERTICAL Tabs appear at the left side of the control, with tab text displayed vertically. This style is valid only when used with the TCS_MULTILINE style. To make tabs appear on the right side of the control, also use the TCS_RIGHT style.

 

Extended Flags

 

This control supports the Extended Window Styles.

 

Return Value

 

If the function succeeds, the return value is a handle to the new tab control.

If the function fails, the return value is false.

To get extended error information, call api_control_get_last_error().

 

Control Functions

 

api_tab_set_exstyle(TabHandle, TabExFlags) Sets the extended styles that the tab control will use.

TabHandle: it must be a TabHandle.
TabExFlags: value specifying the extended tab control styles.

TabExFlags argument can be a combination of the following flags:

TCS_EX_FLATSEPARATORS The tab control will draw separators between the tab items. This extended style only affects tab controls that have the TCS_BUTTONS and TCS_FLATBUTTONS styles. By default, creating the tab control with the TCS_FLATBUTTONS style sets this extended style. If you do not require separators, you should remove this extended style after creating the control.

TCS_EX_REGISTERDROP The tab control generates notification codes to request a drop target object when an object is dragged over the tab items in the control.

 

api_tab_get_exstyle(TabHandle) Returns the extended styles that are currently in use for the tab control.

TabHandle: it must be a TabHandle.

 

api_tab_add_item(TabHandle, ItemIndex, ImageIndex, ItemText) Inserts a new item in a tab control. This function returns the ItemIndex of the item added in the specified tab control if successful, or -1 otherwise.

TabHandle: it must be a TabHandle.
ItemIndex: zero-based index of the new item. You can set this argument to -1 to add the item to the end.
ImageIndex: index of an image in the tab control’s image list or -1 if there is no image for the tab.
ItemText: text of the item.

 

api_tab_set_item(TabHandle, ItemIndex, ImageIndex, ItemText) Sets an existing item in a tab control. This function returns true if successful, or false otherwise.

TabHandle: it must be a TabHandle.
ItemIndex: zero-based index of the item.
ImageIndex: index of an image in the tab control’s image list or -1 if there is no image for the tab.
ItemText: text of the item.

 

api_tab_set_item_text(TabHandle, ItemIndex, ItemText) Sets the item text for the specified item in a tab control. This function returns true if successful, or false otherwise.

TabHandle: it must be a TabHandle.
ItemIndex: zero-based index of the item.
ItemText: text of the item.

 

api_tab_get_item_text(TabHandle, ItemIndex) This function returns a string containing the item text of the specified item in a tab control. This feature is limited to a maximum of 256 characters.

TabHandle: it must be a TabHandle.
ItemIndex: zero-based index of the item.

 

api_tab_set_item_image_index(TabHandle, ItemIndex, ImageIndex) Sets the image index for the specified item in a tab control’s image list. This function returns true if successful, or false otherwise.

TabHandle: it must be a TabHandle.
ItemIndex: zero-based index of the item.
ImageIndex: index of an image in the tab control’s image list or -1 if there is no image for the tab.

 

api_tab_get_item_image_index(TabHandle, ItemIndex) This function returns the image index of the specified item in the tab control’s image list.

TabHandle: it must be a TabHandle.
ItemIndex: zero-based index of the item.

 

api_tab_set_item_selection(TabHandle, ItemIndex) Selects an item in a tab control. The function returns the index of the previously selected item if successful, or -1 otherwise.

TabHandle: it must be a TabHandle.
ItemIndex: zero-based index of the item.

 

api_tab_get_item_selection(TabHandle) Returns the ItemIndex of the selected item in the specified tab control if successful, or -1 if no item is selected.

TabHandle: it must be a TabHandle.

 

api_tab_get_item_multi_selection(TabHandle, ItemIndex) Returns true when the specified item in a multi selection tab control is selected or false otherwise.

TabHandle: it must be a TabHandle.
ItemIndex: zero-based index of the item.

 

api_tab_set_item_focus(TabHandle, ItemIndex) Sets the focus to a specified item in a tab control.

TabHandle: it must be a TabHandle.
ItemIndex: zero-based index of the item.

 

api_tab_get_item_focus(TabHandle) Returns the ItemIndex of the item that has the focus in a tab control.

TabHandle: it must be a TabHandle.

 

api_tab_set_item_highlighted(TabHandle, ItemIndex, Highlighted) Sets the highlight state of a tab item.

TabHandle: it must be a TabHandle.
ItemIndex: zero-based index of the item.
Highlighted: if this argument is true, the tab is highlighted, if false the tab is set to its default state.

 

api_tab_get_item_highlighted(TabHandle, ItemIndex) This function returns true if the specified item is highlighted or false otherwise.

TabHandle: it must be a TabHandle.
ItemIndex: zero-based index of the item.

 

api_tab_set_item_size(TabHandle, Width, Height) Sets the width and height of items in a tab control. This function works only with tab controls that have TCS_FIXEDWIDTH style.

TabHandle: it must be a TabHandle.
Width: width of the items (in pixels).
Height: height of the items (in pixels).

 

api_tab_get_item_width(TabHandle, ItemIndex) Returns the width of the specified item in a tab control.

TabHandle: it must be a TabHandle.
ItemIndex: zero-based index of the item.

 

api_tab_get_item_height(TabHandle, ItemIndex) Returns the height of the specified item in a tab control.

TabHandle: it must be a TabHandle.
ItemIndex: zero-based index of the item.

 

api_tab_get_item_rows(TabHandle) Returns the current number of rows of items in a tab control.

TabHandle: it must be a TabHandle.

 

api_tab_get_item_count(TabHandle) Returns the number of items in the tab control or zero otherwise.

TabHandle: it must be a TabHandle.

 

api_tab_delete_item(TabHandle, ItemIndex) Removes an item from a tab control. This function returns true if successful, or false otherwise.

TabHandle: it must be a TabHandle.
ItemIndex: zero-based index of the item.

 

api_tab_reset(TabHandle) Removes all items from a tab control. This function returns true if successful, or false otherwise.

TabHandle: it must be a TabHandle.

 

api_tab_set_imagelist(TabHandle, ImageListHandle) Assigns an image list to a tab control. This function returns the handle to the previous image list, or false if there is no previous image list.

TabHandle: it must be a TabHandle.
ImageListHandle: it must be an ImageListHandle.

 

api_tab_get_imagelist(TabHandle) Retrieves the image list associated with a tab control. This function returns the handle to the image list if successful, or false otherwise.

TabHandle: it must be a TabHandle.

 

api_tab_set_tooltip(TabHandle, TooltipHandle) Assigns a tooltip control to a tab control.

TabHandle: it must be a TabHandle.
TooltipHandle: it must be a TooltipHandle.

 

api_tab_get_tooltip(TabHandle) Retrieves the handle to the tooltip control associated with a tab control. This function returns the handle to the tooltip control if successful, or false otherwise.

TabHandle: it must be a TabHandle.

 

api_tab_set_control_linked(ParentHandle, TabHandle, ItemIndex, ControlHandle, LinkedOrUnlinked) This function links or unlinks the specified control with the given ItemIndex in the specified tab control. If you link a control with this feature Giavapps Windows API will automatically show the specified control only when the given ItemIndex in the specified tab control is selected. This feature helps you avoid a lot of work! Controls can be linked to one tab at time, so if you call this function multiple times for the same control you are just overwriting its settings.

ParentHandle: parent window of the tab control.
TabHandle: it must be a TabHandle.
ItemIndex: zero-based index of the item.
ControlHandle: it can be any control handle (WindowHandle, ButtonHandle, ComboBoxHandle, etc.).
LinkedOrUnlinked: unlinks (false) or links (true) the specified control.

 

api_tab_get_control_linked(ControlHandle) This function returns true if the specified control has been linked or false otherwise.

ControlHandle: it can be any control handle (WindowHandle, ButtonHandle, ComboBoxHandle, etc.).

 

Code Examples

 

Creating a Tab Control

 

tab = api_tab_create(window,10,10,200,200,WS_VISIBLE | WS_CHILD,0);

 

Adding Items

 

api_tab_add_item(tab,-1,-1,"Item 1");
api_tab_add_item(tab,-1,-1,"Item 2");
api_tab_add_item(tab,-1,-1,"Item 3");

 

Linking Controls to a Tab

 

api_tab_set_control_linked(window,tab,0,edit,1);//Edit Control linked to the first item in the specified Tab Control
api_tab_set_control_linked(window,tab,1,button,1);//Button Control linked to the second item in the specified Tab Control
api_tab_set_control_linked(window,tab,2,combobox,1);//Combo Box Control linked to the third item in the specified Tab Control

 

I am Luigi Piscopo, also known as DJ GiDeejay / Producer / Remixer in the music world. I am a Producer with a lot of experience in photo editing, video editing, audio editing, graphic design, web design, programming and promotion.

Leave a Reply

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *

*