You are very welcome!
Regards,
Jules

'----------------------------------------------------------------------------- ' Bold selected Tab ' Code based from Peter Lameijn, disabled tab example from this forum. ' '----------------------------------------------------------------------------- #Compile Exe #Include "win32api.inc" #Include "commctrl.inc" %MAXTABS = 8 %IDC_TAB = 101 %IDC_LBL = 102 Global hDlg As Long, lTCI As TC_ITEM, lZStr As Asciiz * 64, hTab() As Long, lRect As RECT, TabId() As String '---------------------------------------------------------------------------- ' ' '---------------------------------------------------------------------------- CallBack Function CbMain () Local lPnmh As NMHDR Ptr, lRet As Long, lDBU As Long, lTCI As TC_ITEM, lDISPtr As DRAWITEMSTRUCT Ptr Static PrevSel As Long Local hFont As Long Select Case CbMsg Case %WM_DRAWITEM lDisPtr = CbLparam lZStr = TabID$( @lDisPtr.ItemId+1 ) Call TabCtrl_GetItemRect( hTab(0), @lDisPtr.ItemId, lRect ) IF @lDisPtr.ItemState = %ODS_SELECTED THEN LOCAL rc AS RECT : rc = lRect : rc.nBottom = rc.nBottom + 4 Call FillRect( @lDisPtr.hDC,rc,GetStockObject(%LTGRAY_BRUSH) ) '*Use a bold font if selected hFont = CreateFont(-8,0,0,0,%FW_BOLD,0,0,0,0,0,0,0,0,"MS Sans Serif") ELSE '*Or a normal one if not selected hFont = CreateFont(-8,0,0,0,%FW_NORMAL,0,0,0,0,0,0,0,0,"MS Sans Serif") END IF hFont = SelectObject(@lDisPtr.hDC,hFont) Call SetTextColor( @lDisPtr.hDc, Rgb(@lDisPtr.ItemId*35,0,[email protected]*35) ) Call TextOut( @lDisptr.hDc, lRect.nLeft + 5, lRect.nTop + 3, lZStr, Len (lZStr) ) Call DeleteObject(SelectObject(@lDisPtr.hDC,hFont)) Case %WM_NOTIFY lPnMh = CbLparam Select Case @lPnMh.Code Case %TCN_SELCHANGE lRet = TabCtrl_GetCursel (hTab(0)) Call ShowWindow( hTab(PrevSel+1), %SW_HIDE ) Call ShowWindow( hTab(lRet+1), %SW_SHOW ) PrevSel = lRet End Select End Select End Function '----------------------------------------------------------------------------- ' ' '----------------------------------------------------------------------------- Function PbMain() As Long Dim hTab(10), TabID(10), lCnt As Long Call InitCommonControls() Dialog New 0, "Test Tab",,,300,200, %WS_VISIBLE Or %WS_SYSMENU To hDlg Control Add "SysTabControl32", hDlg, %IDC_TAB, "",5,5,290,160,%WS_CHILD Or %WS_VISIBLE Or _ %TCS_MULTILINE Or %TCS_RIGHTJUSTIFY Or %TCS_OWNERDRAWFIXED OR %TCS_TABS Control Handle hDlg, %IDC_TAB To hTab(0) For lCnt = 1 To %MAXTABS TabID$(lCnt) = "Tab #" + Trim$(Str$(lCnt)) Dialog New hTab(0), TabID$(lCnt),10,10,280,160, %WS_VISIBLE Or %WS_CHILD To hTab(lCnt) Control Add Label, hTab(lCnt), -1, "This is "+TabId$(lCnt),5,5,100,15 lZStr = TabID$(lCnt) lTCI.mask = %TCIF_TEXT lTCI.pszText = VarPtr (lzStr) Call TabCtrl_InsertItem( hTab(0), lCnt -1, lTCI ) Call GetClientRect( hTab(0), lRect ) Call InflateRect( lRect, -10 , -56 ) Call OffsetRect( lRect, -4 , -5 ) Call MoveWindow( hTab(lCnt),lRect.nLeft,lRect.nTop,lRect.nRight,lRect.nBottom, %True ) Next Call ShowWindow( hTab(1), %SW_SHOW ) Dialog Show Modal hDlg, Call CbMain End Function
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Leave a comment: