Hi
I used Methods.odcl to show the problems with c:Methods_Main_TabControl_OnChanged and c:Methods_Main_TabControl_OnSelChanging in Tab Strip.
Did anybody already see this?
;;;**********************************************************************************************************************
(defun c:Methods_Main_TabControl_OnChanged (ItemIndex /
BottomFromBottom
RightFromRight TopFromBottom
LeftFromRight nLeft
nTop nWidth
nHeight
)
(if (= ItemIndex 1) ;_ Sliders Tab
(progn
;;;**********************************************************************************************************************
;;;My changes
(dcl_Control_SetCaption
Methods_Main_Label2
"I incapacitated Label with c:Methods_Main_TabControl_OnChanged"
)
(dcl_Control_SetEnabled Methods_Main_Label2 NIL)
;;;**********************************************************************************************************************
(dcl_Control_SetValue
Methods_Main_AngleSlider1
(atoi (dcl_Control_GetText Methods_Main_AngleBox))
)
(dcl_Control_SetValue
Methods_Main_ScrollBar1
(atoi (dcl_Control_GetText Methods_Main_VScrollLabel))
)
(dcl_Control_SetValue
Methods_Main_SliderBar1
(atoi (dcl_Control_GetText Methods_Main_VSliderLabel))
)
(dcl_Control_SetValue
Methods_Main_ScrollBar2
(atoi (dcl_Control_GetText Methods_Main_HScrollLabel))
)
(dcl_Control_SetValue
Methods_Main_SliderBar2
(atoi (dcl_Control_GetText Methods_Main_HSliderLabel))
)
(dcl_Control_SetText
Methods_Main_SpinnedBox
(itoa (dcl_Control_GetValue Methods_Main_SpinButton1))
)
)
) ;_ if
(if (= ItemIndex 2) ;_ Manipulation Tab
(PopulateManipulationTabFields)
) ;_ if
)
;;;**********************************************************************************************************************
;;;I ADDED THIS EVENT
(defun c:Methods_Main_TabControl_OnSelChanging (ItemIndex /)
(if (= ItemIndex 0) ;_ Sliders Tab
(progn
(dcl_Control_SetCaption
Methods_Main_Label2
"I incapacitated Label with c:Methods_Main_TabControl_OnSelChanging"
) ;_ end of dcl_Control_SetCaption
(dcl_Control_SetEnabled Methods_Main_Label2 NIL)
) ;_ end of progn
(progn ;_ Others
(dcl_Control_SetEnabled Methods_Main_Label2 T)
(dcl_Control_SetCaption
Methods_Main_Label2
"I enabled Label with c:Methods_Main_TabControl_OnSelChanging"
) ;_ end of dcl_Control_SetCaption
) ;_ end of progn
) ;_ end of if
) ;_ end of defun
;;;**********************************************************************************************************************
If OnSelChanging returns T, the change is cancelled. Anything else, the change is allowed.
Thank you Owen
I worked with dcl_TabStrip_SetCurSel to force the selection of a tab at the end of my changes.
Did this work well I can continue with this?
;;;I ADDED THIS EVENT
(defun c:Methods_Main_TabControl_OnSelChanging (ItemIndex /)
(if (= ItemIndex 0) ;_ Sliders Tab
(progn
(dcl_Control_SetCaption
Methods_Main_Label2
"I incapacitated Label with c:Methods_Main_TabControl_OnSelChanging"
) ;_ end of dcl_Control_SetCaption
(dcl_Control_SetEnabled Methods_Main_Label2 NIL)
(dcl_TabStrip_SetCurSel Methods_Main_TabControl 0)
) ;_ end of progn
) ;_ end of if
) ;_ end of defun
I'm not sure I understand the purpose of this. You can simply return NIL (or anything except T) and the change will be allowed.
Vela,
do not call Tab_SetCurSel within a SelChanging event handler. This will end up in an endless loop - just right from the logic.
I'm not sure if I've matched what you want because in your sample you've sent me by mail the tab control had no activated event.
Try the attched sample.
Fred