in a TAB every PAGE can have a own ICON.
i want to change these ICON when PAGE is "active" ... how

Moderator: Rathinagiri
Code: Select all
_HMG_SYSDATA [ 9 ] [k] := 0 // hImageList
Code: Select all
If ImageFlag == .T.
_HMG_SYSDATA [ 9 ] [ k ] := AddtabBitMap ( ControlHandle , Images , NoTrans )
EndIf
Code: Select all
FUNCTION _SetStatusIcon( ControlName, ParentForm, nItem, cIcon, hIcon )
LOCAL i := GetControlIndex( ControlName, ParentForm )
SetStatusItemIcon( _HMG_SYSDATA[ 3 ] [ i ], nItem - 1, cIcon, hIcon )
RETURN Nil
Code: Select all
HB_FUNC ( SETSTATUSITEMICON )
Code: Select all
METHOD DXE_TabCtl:SetIcon(nRes,nIndex )
oIcon := DXE_Icon() :new() :create()
nIcoHandle := oIcon:load( ::cDLL, nRes )
nRet := @comctl32:ImageList_ReplaceIcon( ;
::hImgLstSmall, ; // A handle to the image list.
- 1, ; // The index of the image to replace. If i is -1, the function appends the image to the end of the list.
nIcoHandle ) // The handle to the icon or cursor that contains the bitmap and mask for the new image.
@ user32:DestroyIcon( nIcoHandle )
oItem := TCITEM() :NEW()
oItem:mask := nOr( TCIF_IMAGE )
oItem:iImage := nRet
@ USER32:SendMessageA( ::hTabCtl, TCM_SETITEM, nIndex - 1, oItem )
Hi Jimmy,
thx for Answer
Code: Select all
oWindow1.Tab1.Image( 1 ) := 'save.ico'
Code: Select all
oWindow1.Tab1.Image( 1 ) := 'MY.ico'
Code: Select all
oItem := TCITEM() :NEW() // Structure TCITEM
oItem:mask := nOr( TCIF_IMAGE )
oItem:iImage := nRet // new Position in Imagelist
SendMessage( ::hTabCtl, TCM_SETITEM, nIndex - 1, oItem )
Please take a look for the sample at
nice Sample of color Tabpagegfilatov wrote: ↑Mon Aug 09, 2021 10:40 am Please take a look for the sample at
viewtopic.php?f=24&t=4994&p=47798&hilit ... tab#p47798
for example![]()
Code: Select all
LABEL WIDTH 0 HEIGHT 0
Code: Select all
DEFINE TAB Tab_1 ;
ON CHANGE Tab_Change(ThisWindow.Name, This.Name )
Code: Select all
PROCEDURE Tab_Change(ParentForm, ControlName)
LOCAL ControlHandle
LOCAL nTab, Images, NoTrans := .T.
nTab := GetProperty(ParentForm ,ControlName, "Value")
DO CASE
CASE nTab = 1 ; Images := {"GRUENPUNKT","UNCHECK","UNCHECK"}
CASE nTab = 2 ; Images := {"UNCHECK","GRUENPUNKT","UNCHECK"}
CASE nTab = 3 ; Images := {"UNCHECK","UNCHECK","GRUENPUNKT"}
ENDCASE
ControlHandle := GetControlHandle( ControlName, ParentForm )
// not sure need to Destroy "old" Imagelist before
IMAGELIST_DESTROY(ControlHandle)
// will create own Imagelist and set TCM_SETIMAGELIST
ADDTABBITMAP( ControlHandle, Images, NoTrans )
RETURN