zlatkoAB
17-02-2011, 13:04
Hi people... I know how create Tab control and add tabs to control. So my problem now is how i can change tab text(title) ? For example - i have build simple editor with tabs and i must crete new tab on tab control- this work fine. So when i load file to editor i want that filename is visible in this new tab as tab text(title). is someone here have idea how do this ?
ErosOlmi
17-02-2011, 16:06
This is an example in PowerBasic using pure API SDK so it should work in any language:
' ========================================================================================
' Changes the name of the tab
' ========================================================================================
Sub MySetTabName (byval htabMDI as long, ByVal nTab As Long, ByVal strName As String)
Local ttc_item As TC_ITEM
ttc_item.mask = %TCIF_TEXT
ttc_item.pszText = StrPtr(strName)
ttc_item.cchTextMax = len(strName)
SendMessage hTabMdi, %TCM_SETITEM, nTab - 1&, ByVal VarPtr(ttc_item)
End SubMainly you need to correctly fill TC_ITEM structure and send message to your tab control handle.
TC_ITEM structure is documented here: http://msdn.microsoft.com/en-us/library/bb760554%28v=vs.85%29.aspx
Eros