Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Greg Green
  Where is Greg Green?
 
 Georgia - United States
 Greg Green
 Tags
Subject: MDI Tab Class
Thread ID: 416438 Message ID: 416438 # Views: 114 # Ratings: 7
Version: Visual FoxPro 9 SP2 Category: Classes and Objects
Date: Monday, December 29, 2014 6:40:50 PM         
   


I was asked in another thread about the MDI Tab class that was being displayed in a screen shot and whether I would share it. Here is a link for the class:

https://www.foxite.com/uploads/08613ff8-f070-4c38-929f-ef1200eb7fd4.zip

This class should be bug-free as I have been using it for a while now. The appearance of the tabs can be changed by editing the BMPs that are included. There are two sets: the active tab and inactive tab. The PEMS are:

PROPERTIES

AddTabOnRight - True or False; indicates which side of the tab frame to add the new tab to.
CaptionMode - Mode to display caption; 0-Plain text, 1-Procedure, 2-Form, 3-Visual Class
CurrentTab - Currently selected tab
LastTabSelected - Object handle to last tab selected; initially NULL
PreviousTab - Previously selected tab; initially 1
TabCount - Count of the tabs; initially 1
TabOverlap - Amount of tab overlap between tabs; initially 25
Tabs[n, 2] - Array of the tabs; index 1 is the tab number, index 2 is the linked object (this property is not meant to be directly accessed)


METHODS

AddTab - adds a new tab and sets it as the current tab

Parameters:

tcCaption - caption of the new tab
toLinkedObject - handle to the form that the tab represents; i.e., pass the form's thisform.

Returns:

The new tab number



CloseTab - closes selected tab

Parameters:

tnTab - the number of the tab to close. The tabs are kept in an internal array and this is the index to the tab; see GetTab.

Returns:

None



CloseTabAll - closes all tabs and leaves one open as 'Untitled'

Parameters:

None

Returns:

None



FindTabLinkedObject

Parameters:

tcObject - the handle to the object. Uses the Name property to find the object.

Return:

Number of the tab; zero if not found


GetTab - gets the tab

Parameters:

tcTabCaption - caption of the tab to find; uses exact matching (UPPER() == UPPER())

Returns:

The number of the tab found; zero if not found.



GetTabCaption - Gets the tab's caption

Parameters:

tnTab - tab number to get the caption for

Returns:

the caption of the tab



GetTabLinkedObject - gets the handle to the tab's linked object

Parameters:

tnTab - tab number to get the linked object for

Returns:

The linked object handle



GetTabToolTipText - gets the tab's tooltiptext value

Parameters:

tnTab - tab number to get the tooltiptext for

Returns:

Tooltiptext value



SelectTab - selects the tab and activates the linked object (hides; i.e., Visible=False, the previous active linked object)

Parameters:

tnTab - tab number to select

Returns:

None



GetTabLinkedObject - sets the selected tab's linked object. Used for the first tab which is already present; can be used for any tab

Parameters:

tnTab - tab number to set the linked object to

Returns:

None



GetTabModifiedStatus - sets the tab's caption to have an asterisk displayed and sets the ModifiedStatus property of the tab

Parameters:

tnTab - tab number to set status for
tlStatus - tab status (True or False)

Returns:

None



RenameTab - Renames the tab's caption

Parameters:

tnTab - tab number to be renamed
tcCaption - the caption of the tab




ToggleTabModifiedStatus - inverts the tab's ModifiedStatus property; i.e., True becomes False or False becomes True

Parameters:

tnTab - tab number to toggle the status

Returns:

None



EVENTS

OnInit - User's code for Init event; called by Init()

Parameters:

None



OnTabAdd - Occurs when a tab is added; useful for setup of linked object

Parameters:

tnTab - number of tab added
tnLinkedObject - linked object's handle



OnTabClose - Occurs when a tab is closed

Parameters:

tnTab - number of the tab being closed
tlRemoved - indicates if the tab is removed (last tab is not removed)



OnTabCloseRequest - called before a tab is closed; return False to prevent the closure of the tab

Parameters:

tnTab - number of the tab being closed
tnLinkedObject - handle to the tab's linked object

Return:

True to allow tab closure; False to prevent tab closure



OnTabRightClick - called when a right-mouse click is performed on the tab; this is implemented by a user-defined custom method of the tabframe's parent.

Parameters:

tcTabName - name of the tab



OnTabSelection - Occurs when a tab is selected by the user; the tab and linked object is already activated

Parameters:

tnTab - tab number that is selected
tnLinkedObject - handle to the linked object

ENTIRE THREAD

MDI Tab Class Posted by Greg Green @ 12/29/2014 6:40:50 PM
RE: MDI Tab Class Posted by fedison72 fernando @ 12/29/2014 8:37:39 PM
RE: MDI Tab Class Posted by Greg Green @ 12/29/2014 10:10:47 PM
RE: MDI Tab Class Posted by fedison72 fernando @ 12/30/2014 12:13:11 AM
RE: MDI Tab Class Posted by Jun Tangunan @ 12/30/2014 2:36:24 AM
RE: MDI Tab Class Posted by Greg Green @ 12/30/2014 5:19:21 AM
RE: MDI Tab Class Posted by fedison72 fernando @ 1/6/2015 5:01:53 AM
RE: MDI Tab Class Posted by Greg Green @ 1/6/2015 3:31:40 PM
RE: MDI Tab Class Posted by Tariq Mehmood @ 12/30/2014 6:24:06 AM