News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

How to adding icons to tab controls?

Started by Mikl__, June 08, 2019, 03:23:49 PM

Previous topic - Next topic

Mikl__

May show a small example for 2-3 tabs? Thank you...

Biterider

Hi Mikl__
Maybe this can help.
After creating the control
invoke CreateWindowEx, dExStyle, $OfsCStr("SysTabControl32"), pTitle, \
                         dStyle, sdPosX, sdPosY, dWidth, dHeight, \
                         hParent, CtlID, hInstance, 0


add an imagelist using
invoke SendMessage, hWnd, TCM_SETIMAGELIST, 0, hImageList

For each tab you want to add, use

local TCI:TC_ITEM

mov TCI.mask_, TCIF_PARAM or TCIF_TEXT or TCIF_IMAGE
mrm TCI.pszText, pText, xax
mrm TCI.iImage, dImageIndex, eax
mrm TCI.lParam, hWnd, xax
invoke SendMessage, hWnd, TCM_INSERTITEM, dIndex, addr TCI


and you are done.

Note: if the Tab control is to be placed in a dialog, don't forget to use the MapDialogRect to convert from dialog box units to pixels.

Biterider

six_L

Say you, Say me, Say the codes together for ever.

Mikl__

Hi, Biterider, six_L!
Thank you very much for the help!