SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftMask/OCX 7.0 - Masked Edit Control
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftPrintPreview/DLL 2.0 - Print Preview Control (discontinued)
SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftDirectory 3.5 - File/Folder Control (discontinued)
SftMask/OCX 7.0 - Masked Edit Control
SftOptions 1.0 - Registry/INI Control (discontinued)
SftPrintPreview/OCX 1.0 - Print Preview Control (discontinued)
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftTabs/NET 6.0 - Tab Control (discontinued)
SftTree/NET 2.0 - Tree Control
The following code has been created using the SftTabs/DLL Wizard application:
static const SFTTABS_CONTROL CtlInit = { SFTTABSSTYLE_MODERN_I, /* tab style */ 1, /* number of rows */ 0, /* number of tabs per row (if fFixed) */ 0, /* width of left margin */ 0, /* width of right margin */ FALSE, /* same width for all tabs */ TRUE, /* Client area wanted */ FALSE, /* allow multiline label text */ TRUE, /* use with dialog */ FALSE, /* use specified background color only for text */ FALSE, /* scrollable tabs */ FALSE, /* hide scroll buttons */ FALSE, /* bold font for active tab wanted */ FALSE, /* fill rows completely */ NULL, /* scroll button bitmap */ NULL, /* Dialog data associated with active tab */ NULL, /* Dialog window handle associated with active tab */ NULL, /* Frame, used as client area */ TRUE, /* Tooltips wanted */ FALSE, /* drop text if it doesn't fit */ FALSE, /* conditional scroll buttons */ BMBUTTONSTYLE_THEME_SCROLL2, /* scroll button style */ TRUE, /* display ... if truncated */ TRUE, /* Flyby highlighting */ TRUE, /* use client area colors in partially obscured frames */ FALSE, /* scroll buttons on left side */ -1, /* row indentation */ FALSE, /* don't show truncated pattern for clipped tab */ FALSE, /* full size scroll buttons */ TRUE, /* use themes on Windows XP */ FALSE, /* use exact window region */ FALSE, /* always show prefix _ */ 0,0,0,0, /* animation values */ NULL, /* disabled button bitmap */ TRUE, /* focus rectangle if the control has i/p focus */ FALSE, /* TRUE if Close button wanted */ FALSE, /* TRUE if Close button disabled */ TRUE, /* TRUE if WM_CLOSE message wanted */ FALSE, /* TRUE if Minimize, Restore, Close buttons are full size */ SFTTABS_BUTTON_NEAR, /* scroll button alignment */ SFTTABS_BUTTON_NEAR, /* Minimize, Restore, Close button alignment */ FALSE, /* TRUE if Minimize button wanted */ FALSE, /* TRUE if Minimize button disabled */ FALSE, /* TRUE if Restore button wanted */ FALSE, /* TRUE if Restore button disabled */ NULL, /* Close, Minimize, Restore button bitmap */ NULL, /* Close, Minimize, Restore disabled button bitmap */ TEXT("Scroll Left/Up"), /* scroll left button tooltip */ TEXT("Scroll Right/Down"), /* scroll button tooltip */ TEXT("Close"), /* Close button tooltip */ TEXT("Minimize"), /* Minimize button tooltip */ TEXT("Restore"), /* Restore button tooltip */ 0, /* custom modifications */ 0, /* forced height/width depending on tab style - 0 to ignore */ FALSE, /* switch tabs on button release (or down if FALSE) */ FALSE, /* Rendering compatible with pre-6.0 */ FALSE, /* don't display clientarea border - select styles only */ }; static const SFTTABS_TAB Tab0 = { /*&One */ SFTTABS_NOCOLOR, SFTTABS_NOCOLOR, /* background, foreground color */ SFTTABS_NOCOLOR, SFTTABS_NOCOLOR, /* background, foreground color (when selected) */ { SFTTABS_GRAPH_NONE, 0 }, /* location */ TRUE, /* enabled/disabled */ 0, /* userdata */ (SFTTABS_DWORD_PTR) 0, /* Page_callback */ /* user supplied tab callback */ NULL, /* reserved */ SFTTABS_NOCOLOR, /* Flyby foreground color */ SFTTABS_NOCOLOR, /* Client area background color */ 0,0,0,0, /* animation values */ NULL, /* tab-specific ImageList handle*/ FALSE, /* hidden tab */ SFTTABS_NOCOLOR, /* gradient fill background color */ SFTTABS_NOCOLOR, SFTTABS_NOCOLOR, /* gradient fill background color, active tab */ SFTTABS_NOCOLOR, SFTTABS_NOCOLOR, /* gradient fill client area color */ SFTTABS_NOCOLOR, }; static const SFTTABS_TAB Tab1 = { /*&Two */ SFTTABS_NOCOLOR, SFTTABS_NOCOLOR, /* background, foreground color */ SFTTABS_NOCOLOR, SFTTABS_NOCOLOR, /* background, foreground color (when selected) */ { SFTTABS_GRAPH_NONE, 0 }, /* location */ TRUE, /* enabled/disabled */ 0, /* userdata */ (SFTTABS_DWORD_PTR) 0, /* Page_callback */ /* user supplied tab callback */ NULL, /* reserved */ SFTTABS_NOCOLOR, /* Flyby foreground color */ SFTTABS_NOCOLOR, /* Client area background color */ 0,0,0,0, /* animation values */ NULL, /* tab-specific ImageList handle*/ FALSE, /* hidden tab */ SFTTABS_NOCOLOR, /* gradient fill background color */ SFTTABS_NOCOLOR, SFTTABS_NOCOLOR, /* gradient fill background color, active tab */ SFTTABS_NOCOLOR, SFTTABS_NOCOLOR, /* gradient fill client area color */ SFTTABS_NOCOLOR, }; static const SFTTABS_TAB Tab2 = { /*T&hree */ SFTTABS_NOCOLOR, SFTTABS_NOCOLOR, /* background, foreground color */ SFTTABS_NOCOLOR, SFTTABS_NOCOLOR, /* background, foreground color (when selected) */ { SFTTABS_GRAPH_NONE, 0 }, /* location */ TRUE, /* enabled/disabled */ 0, /* userdata */ (SFTTABS_DWORD_PTR) 0, /* Page_callback */ /* user supplied tab callback */ NULL, /* reserved */ SFTTABS_NOCOLOR, /* Flyby foreground color */ SFTTABS_NOCOLOR, /* Client area background color */ 0,0,0,0, /* animation values */ NULL, /* tab-specific ImageList handle*/ FALSE, /* hidden tab */ SFTTABS_NOCOLOR, /* gradient fill background color */ SFTTABS_NOCOLOR, SFTTABS_NOCOLOR, /* gradient fill background color, active tab */ SFTTABS_NOCOLOR, SFTTABS_NOCOLOR, /* gradient fill client area color */ SFTTABS_NOCOLOR, }; static const SFTTABS_TAB Tab3 = { /*&Four */ SFTTABS_NOCOLOR, SFTTABS_NOCOLOR, /* background, foreground color */ SFTTABS_NOCOLOR, SFTTABS_NOCOLOR, /* background, foreground color (when selected) */ { SFTTABS_GRAPH_NONE, 0 }, /* location */ TRUE, /* enabled/disabled */ 0, /* userdata */ (SFTTABS_DWORD_PTR) 0, /* Page_callback */ /* user supplied tab callback */ NULL, /* reserved */ SFTTABS_NOCOLOR, /* Flyby foreground color */ SFTTABS_NOCOLOR, /* Client area background color */ 0,0,0,0, /* animation values */ NULL, /* tab-specific ImageList handle*/ FALSE, /* hidden tab */ SFTTABS_NOCOLOR, /* gradient fill background color */ SFTTABS_NOCOLOR, SFTTABS_NOCOLOR, /* gradient fill background color, active tab */ SFTTABS_NOCOLOR, SFTTABS_NOCOLOR, /* gradient fill client area color */ SFTTABS_NOCOLOR, }; static const SFTTABS_TAB Tab4 = { /*F&ive */ SFTTABS_NOCOLOR, SFTTABS_NOCOLOR, /* background, foreground color */ SFTTABS_NOCOLOR, SFTTABS_NOCOLOR, /* background, foreground color (when selected) */ { SFTTABS_GRAPH_NONE, 0 }, /* location */ TRUE, /* enabled/disabled */ 0, /* userdata */ (SFTTABS_DWORD_PTR) 0, /* Page_callback */ /* user supplied tab callback */ NULL, /* reserved */ SFTTABS_NOCOLOR, /* Flyby foreground color */ SFTTABS_NOCOLOR, /* Client area background color */ 0,0,0,0, /* animation values */ NULL, /* tab-specific ImageList handle*/ FALSE, /* hidden tab */ SFTTABS_NOCOLOR, /* gradient fill background color */ SFTTABS_NOCOLOR, SFTTABS_NOCOLOR, /* gradient fill background color, active tab */ SFTTABS_NOCOLOR, SFTTABS_NOCOLOR, /* gradient fill client area color */ SFTTABS_NOCOLOR, }; static const SFTTABS_TAB Tab5 = { /*&Six */ SFTTABS_NOCOLOR, SFTTABS_NOCOLOR, /* background, foreground color */ SFTTABS_NOCOLOR, SFTTABS_NOCOLOR, /* background, foreground color (when selected) */ { SFTTABS_GRAPH_NONE, 0 }, /* location */ TRUE, /* enabled/disabled */ 0, /* userdata */ (SFTTABS_DWORD_PTR) 0, /* Page_callback */ /* user supplied tab callback */ NULL, /* reserved */ SFTTABS_NOCOLOR, /* Flyby foreground color */ SFTTABS_NOCOLOR, /* Client area background color */ 0,0,0,0, /* animation values */ NULL, /* tab-specific ImageList handle*/ FALSE, /* hidden tab */ SFTTABS_NOCOLOR, /* gradient fill background color */ SFTTABS_NOCOLOR, SFTTABS_NOCOLOR, /* gradient fill background color, active tab */ SFTTABS_NOCOLOR, SFTTABS_NOCOLOR, /* gradient fill client area color */ SFTTABS_NOCOLOR, }; /* Replace "Page_callback" with the names of the actual */ /* callback routines once they have been implemented and */ /* remove the comment marks. */ /*- Initialize Tab Control -----------------------------------------------------*/ /* Usually added to the WM_INITDIALOG or WM_CREATE message handler of the tab */ /* control's parent window (i.e., the tabbed dialog) */ /*------------------------------------------------------------------------------*/ int index; HWND hwndTab; hwndTab = GetDlgItem(hwndParent, IDC_TAB); /* get the window handle */ /* Initialization is faster if we set redraw off */ SendMessage(hwndTab, WM_SETREDRAW, (WPARAM)FALSE, 0); /* Set the tab control font */ SendMessage(hwndTab, WM_SETFONT, (WPARAM)m_hFont, MAKELPARAM(TRUE, 0)); /* Tab control font */ /* We are using new features */ SftTabs_SetVersion(hwndTab, SFTTABS_6_5); index = SftTabs_AddTab(hwndTab, TEXT("&One")); SftTabs_SetTabInfo(hwndTab, index, &Tab0); index = SftTabs_AddTab(hwndTab, TEXT("&Two")); SftTabs_SetTabInfo(hwndTab, index, &Tab1); index = SftTabs_AddTab(hwndTab, TEXT("T&hree")); SftTabs_SetTabInfo(hwndTab, index, &Tab2); index = SftTabs_AddTab(hwndTab, TEXT("&Four")); SftTabs_SetTabInfo(hwndTab, index, &Tab3); index = SftTabs_AddTab(hwndTab, TEXT("F&ive")); SftTabs_SetTabInfo(hwndTab, index, &Tab4); index = SftTabs_AddTab(hwndTab, TEXT("&Six")); SftTabs_SetTabInfo(hwndTab, index, &Tab5); SftTabs_SetControlInfo(hwndTab, &CtlInit); SftTabs_SetCurrentTab(hwndTab, 0); /* Make the first tab the current tab */ // Make sure to turn redraw back on SendMessage(hwndTab, WM_SETREDRAW, (WPARAM)TRUE, 0); InvalidateRect(hwndTab, NULL, TRUE); // Activate current page. SftTabs_ActivatePage(hwndParent, hwndTab, NULL, TRUE); // Mark the window as a main, tabbed dialog (so accel. keys work) by registering it. // Register the dialog AFTER activating the current page SftTabs_RegisterDialog(hwndParent); return FALSE; // WM_INITDIALOG, input focus already set /*------------------------------------------------------------------------------*/ /* This sample code can be used for cleanup processing. */ /* This code is usually used in a WM_DESTROY message handler of the parent */ /* dialog or window. */ /*------------------------------------------------------------------------------*/ /* Delete the font used for the tab control. */ DeleteObject(m_hFont); /* Item font */ /* Unregister, or the window properties used won't be removed */ SftTabs_UnregisterDialog(hwndParent); /* destroy all pages */ SftTabs_Destroy(hwndParent, GetDlgItem(hwndParent, IDC_TAB)); /*------------------------------------------------------------------------------*/ /* This is sample code that responds to the tab switching notifications sent by */ /* the tab control to the parent window using a WM_COMMAND message. The */ /* appropriate SftTabs/DLL API is called to switch between pages. */ /* This code implements a suitable WM_COMMAND message handler. */ /*------------------------------------------------------------------------------*/ case WM_COMMAND: { HWND hwndCtl = (HWND) lParam; int id = LOWORD(wParam); int code = HIWORD(wParam); if (hwndCtl) { switch (id) { case IDC_TAB: switch (code) { case SFTTABSN_SWITCHING:// we're about to switch away from // the current page. If you need to know what the new // page will be, use SftTabs_GetNextTab(hwndCtl). if (!SftTabs_DeactivatePage(hwndParent, hwndCtl)) // couldn't deactivate current page, so don't switch SendMessage(hwndCtl, WM_CANCELMODE, 0, 0); break; case SFTTABSN_SWITCHED:// we switched to a new page SftTabs_ActivatePage(hwndParent, hwndCtl, NULL, FALSE); break; } break; case IDOK: case IDCANCEL: if (code == BN_CLICKED) SendMessage(hwndParent, WM_COMMAND, id, 0); break; } } else { switch (id) { case IDOK: // The currently active page will be called with a // WM_QUERYENDSESSION/SftTabs_GetEndPageMessage message to determine // whether it can be closed if (SftTabs_ClosePossible(hwndParent, GetDlgItem(hwndParent, IDC_TAB))) EndDialog(hwndParent, TRUE); break; case IDCANCEL: EndDialog(hwndParent, FALSE); break; // The above assumes that this is a modal dialog. If it is a modeless // don't use EndDialog, use DestroyWindow instead. } } break; } /*------------------------------------------------------------------------------*/ /* This sample code page callback routine can be used to create a page callback */ /* for each page attached to a tab. The SFTTABS_TAB structure of each tab */ /* points to a callback routine so the page can be created and destroyed by */ /* the application-provided callback. */ /*------------------------------------------------------------------------------*/ /* This first form of the callback routine destroys the page everytime the user */ /* switches away from the page. If you would like to preserve the page and */ /* just hide it instead, use the second form of the callback below. */ HWND CALLBACK Page_Callback(BOOL fCreate, HWND hwndOwner, HWND hwndPage, HWND hwndTab) { if (fCreate) { // creating a new page if (hwndPage) { // already created, we could do some initialization here. // this will be called every time the page becomes active // The WM_CREATE/WM_INITDIALOG/WM_DESTROY messages are also sent to // the page and could be used to determine activation/deactivation. // of the page. // optional, set the main window's title to the window title defined for this page SftTabs_CopyWindowTitle(hwndPage, hwndOwner); return NULL; } else { // Create the page. // You can create and initialize any type of window here, not just dialogs. // Use CreateWindow to create other windows. Don't specify WS_VISIBLE, but // make sure you use WS_TABSTOP. // When creating a non-dialog window, make sure to call SftTabs_SetPageActive // after the page has been created. HWND hwnd = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_your_dialog_ID), hwndOwner, (DLGPROC)Page_yourDialogProc, (LPARAM)(UINT_PTR)hwndTab);// pass tab control as data // optional, set the main window's title to the window title defined for this page SftTabs_CopyWindowTitle(hwnd, hwndOwner); return hwnd; } } else { // destroying page // We'll always destroy this page (to save resources) DestroyWindow(hwndPage); return NULL; } } /* This second form of the callback routine hides the page when the user */ /* switches away from the page. If you would like to destroy the page instead, */ /* use the first form of the callback above. */ HWND CALLBACK Page_Callback(BOOL fCreate, HWND hwndOwner, HWND hwndPage, HWND hwndTab) { if (fCreate) { // creating a new page if (hwndPage) { // already created, we could do some initialization here. // this will be called every time the page becomes active. // The WM_SHOWWINDOW message is also sent to the page and could // be used to determine activation/deactivation of the page. // optional, set the main window's title to the window title defined for this page SftTabs_CopyWindowTitle(hwndPage, hwndOwner); return NULL; // return NULL, ignored } else { // Create the page. // You can create and initialize any type of window here, not just dialogs. // Use CreateWindow to create other windows. Don't specify WS_VISIBLE, but // make sure you use WS_TABSTOP. // When creating a non-dialog window, make sure to call SftTabs_SetPageActive // after the page has been created. HWND hwnd = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_your_dialog_ID), hwndOwner, (DLGPROC)Page_yourDialogProc, (LPARAM)(UINT_PTR)hwndTab);// pass tab control as data // optional, set the main window's title to the window title defined for this page SftTabs_CopyWindowTitle(hwnd, hwndOwner); return hwnd; } } else { // destroying page if (hwndOwner) // - because we're switching away return hwndPage; // keep the window handle, don't destroy it else { // - because we're closing the main dialog DestroyWindow(hwndPage); return NULL; } } } /*------------------------------------------------------------------------------*/ /* Use the following sample code as the framework for your page. It is a */ /* standard dialog procedure with just minor modifications. */ /*------------------------------------------------------------------------------*/ BOOL CALLBACK Page_yourDialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { LRESULT lRes; switch (msg) { case WM_INITDIALOG: // ... your initialization code // Initialize page SftTabs_SetPageActive(hwndDlg, (HWND) lParam, NULL); // The following insures that the focus is set to the correct control. return !SftTabs_IsRegisteredDialog(GetParent(hwndDlg)); // case WM_other_messages: // ... your other messages go here break; } // Any message your dialog procedure doesn't handle, must come here if (SftTabs_HandleDialogMessage(hwndDlg, msg, wParam, lParam)) return TRUE; if (SftTabs_TransparentControls(hwndDlg, NULL, &msg, &wParam, &lParam, &lRes, 0, 0)) return (BOOL) lRes; return FALSE; // Message not handled by dialog proc } /*------------------------------------------------------------------------------*/ /* Add the following sample code at the end of your main window's or dialog's */ /* procedure to handle messages that may be of interest to SftTabs/DLL. */ /*------------------------------------------------------------------------------*/ // Call SftTabs/DLL to let it handle some messages (mostly for keyboard accel. keys) if (SftTabs_HandleDialogMessage(hwndDlg, msg, wParam, lParam)) return TRUE;