PDA

View Full Version : Tab control style



zlatkoAB
18-10-2013, 17:34
hi
In thinBasic examples is tab control example, but from
code i cannot figured which style use this tab control?
I see that notification mesages are recived under WM_NOTIFY right?

so there is no TCN_SELCHANGE used at all or i am wrong.

i ask this question here becuse i dont get it why something similar don't work in
oxygen ?


thanks in advance

Aurel

ErosOlmi
18-10-2013, 22:07
Hi Aurel,

in many situations, all the hard work a programmer has to do with Windows Controls is done by thinBasicitself.
Here below internal thinBasic function (PowerBasic code) handling Tab changing active tab control window.

Hope this can help.

Ciao
Eros




'-----------------------------------------------------------------------
Function Exec_TabCtrl_OnNotify() As Ext
'-----------------------------------------------------------------------
Local eDlg As Ext
Local eCtrl As Ext
Local eLParam As Ext
Local pNMHDR As NMHDR Ptr
Local hTab As Long
Local tItem As TC_ITEM
Local PageNo As Long

thinBasic_Parse3Numbers(eDlg, eCtrl, eLParam)
If thinBasic_ErrorFree Then


Control Handle eDlg, eCtrl To hTab


pNMHDR = eLParam
'---Used to hide/show child windows based on current selected TAB
'---Now we check if the control handle firing the event is our TAB Control handle
'---Remember: control handle, not control ID. We can get control handle using CONTROL_GetHandle function
If @pNMHDR.hWndFrom = hTab Then
'---OK, our TAB has generated the notification event. We need to check what message has been sent
Select Case @pNMHDR.Code
Case %TCN_SELCHANGING
'---Fired just before changing
PageNo = TabCtrl_GetCurSel(hTab)


tItem.mask = %TCIF_PARAM
TabCtrl_GetItem (hTab, PageNo, tItem)

If tItem.lParam Then
Dialog Show State tItem.lParam, %SW_HIDE
End If

Case %TCN_SELCHANGE
'---Fired just after change
PageNo = TabCtrl_GetCurSel(hTab)


tItem.mask = %TCIF_PARAM
TabCtrl_GetItem (hTab, PageNo, tItem)


If tItem.lParam Then
Dialog Show State tItem.lParam, %SW_SHOW
End If
End Select
End If
End If


End Function