TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Doug Swenson
from: Patrick Haller
date: 1995-10-28 17:03:48
subject: Notebook Problem

Hi Doug!

[Notebook Control]
 DS> However, I am not able to increase the size of the major tabs.  

Here we go: (this is only a snippet - you should be able to exctract the
important details yourself :)

/**********************************************************************/
/*-------------------------- SetTabDimensions ------------------------*/
/*                                                                    */
/*  SET THE DIMENSIONS OF THE NOTEBOOK TABS.                          */
/*                                                                    */
/*  INPUT: window handle of notebook control                          */
/*                                                                    */
/*  1.                                                                */
/*                                                                    */
/*  OUTPUT: TRUE or FALSE if successful or not                        */
/*                                                                    */
/*--------------------------------------------------------------------*/
/**********************************************************************/
BOOL NBSetTabDimensions( HWND hwndNB, const PNBPAGE pPage, const ULONG ulPages)
{
    BOOL         fSuccess = TRUE;
    HPS          hps      = WinGetPS( hwndNB );
    FONTMETRICS  fm;
    INT          i, iSize, iLongestMajText = 0, iLongestMinText = 0;
    PNBPAGE      pP;

    INFONL("NBSetTabDimensions");           /* Modul idenfitifizieren */


    if( !hps )
    {
 ErrorMsg( "SetTabDimensions WinGetPS RC(%X)", HWNDERR( hwndNB ) );

 return FALSE;
    }

    (void) memset( &fm, 0, sizeof( FONTMETRICS ) );

    // Calculate the height of a tab as the height of an average font character
    // plus a margin value.

    if( GpiQueryFontMetrics( hps, sizeof( FONTMETRICS ), &fm ) )
 fm.lMaxBaselineExt += (TAB_HEIGHT_MARGIN * 2);
    else
    {
 fm.lMaxBaselineExt = DEFAULT_NB_TAB_HEIGHT + (TAB_HEIGHT_MARGIN * 2);

 ErrorMsg( "SetTabDimensions GpiQueryFontMetrics RC(%X)",
HWNDERR( hwndNB ) );
    }

    // Calculate the longest tab text for both the MAJOR and MINOR pages

    for( i = 0, pP = pPage;
  i < ulPages;
  i++, pP++)
    {
 iSize = WinGetStringSize( hps, pP->szTabText );

 if( pP->usTabType == BKA_MAJOR )
 {
     if( iSize > iLongestMajText )
  iLongestMajText = iSize;
 }
 else  /* BKA_MINOR */
 {
     if( iSize > iLongestMinText )
  iLongestMinText = iSize;
 }
    }

    WinReleasePS( hps );

    // Add a margin amount to the longest tab text

    if( iLongestMajText )
 iLongestMajText += TAB_WIDTH_MARGIN;

    if( iLongestMinText )
 iLongestMinText += TAB_WIDTH_MARGIN;

    // Set the tab dimensions for the MAJOR and MINOR pages. Note that the
    // docs as of this writing say to use BKA_MAJOR and BKA_MINOR in mp2 but
    // you really need BKA_MAJORTAB and BKA_MINORTAB.

    if( iLongestMajText )
    {
 fSuccess = (BOOL) WinSendMsg( hwndNB, BKM_SETDIMENSIONS,
      MPFROM2SHORT( iLongestMajText, (SHORT)fm.lMaxBaselineExt ),
      MPFROMSHORT( BKA_MAJORTAB ) );

 if( !fSuccess )
     ErrorMsg( "BKM_SETDIMENSIONS(MAJOR) RC(%X)", HWNDERR( hwndNB ) );
    }

    if( fSuccess && iLongestMinText )
    {
 fSuccess = (BOOL) WinSendMsg( hwndNB, BKM_SETDIMENSIONS,
      MPFROM2SHORT( iLongestMinText, (SHORT)fm.lMaxBaselineExt ),
      MPFROMSHORT( BKA_MINORTAB ) );

 if( !fSuccess )
     ErrorMsg( "BKM_SETDIMENSIONS(MINOR) RC(%X)", HWNDERR( hwndNB ) );
    }

    return fSuccess;
}

     __
     |_)
cu/2 |atrick
[Team  OS/2]

---
* Origin: OS/2 Bodensee ! (2:246/2315.18)
SEEN-BY: 270/101 620/243 711/401 409 410 413 430 807 808 809 934 955 712/407
SEEN-BY: 712/515 628 704 713/888 800/1 7877/2809
@PATH: 246/2315 2300 2340 24/901 240/5500 24/24 396/1 270/101 712/515
@PATH: 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.