case statement & tabstrip

jie711

New Member
good day!
Again.. i just want to ask the code about the case statements that will determine where part of the tabstrip ocx are you in...
for example, i have 3 tabs in the tabstrip, so when i press the 2nd tab, the program must know that im in the 2nd tab..
i tried using the index, but won't work..
help me...
thank you all!
 
Are you using Microsoft Tabstrip 5.0? (comctl32.ocx).

If so, below is the code we use on the OCX.Click trigger for the ocx.
.
/*------------------------------------------------------------------------------
Purpose:
Parameters: None required for OCX.
Notes:
------------------------------------------------------------------------------*/


DEFINE VAR nTabToActivate AS INTEGER NO-UNDO.
DEF VAR v-Cancel AS LOG NO-UNDO.


ASSIGN nTabToActivate = chCtrlFrame:TabStrip:SelectedItem:INDEX.


RUN p-Change_Tab(INPUT nTabToActivate,
OUTPUT v-Cancel).


IF v-Cancel THEN
ASSIGN chCtrlFrame:TabStrip:SelectedItem = chCtrlFrame:TabStrip:Tabs:ITEM(v-Table_Choice).


END PROCEDURE.

Obviously if you assign a program variable where nTabToActivate is assigned, you can reference this elsewhere in your code.
 

Emma

Member
re:

try using the following code. I hope this helps.
Emma.

do on ocx.click of TS /* TS = tabstrip name */ :

def var ch-tab as com-handle.
def var c-caption as character.

assign ch-tab=chTS:TabStrip:selecteditem
c-caption=ch-tab:caption.

CASE c-caption:

when "Tab 1" then do:
frame fr_tab1:move-to-top().
end.
when "Tab 2" then do:
frame fr_tab2:move-to-top().
end.
when "Tab 3" then do:
frame fr_tab3:move-to-top().
end.

END CASE.

end.
 
To use Tab Captions is not always working (multilangual developments, or if the caption is changing you have to change your source also).

We are using something like this:

... to get current tab sequence:

DO iCurTabSeq = 1 TO COM-SELF:Tabs:Count:
IF COM-SELF:Tabs:Item(iCurTabSeq):Selected THEN LEAVE.
END.


... to select a tab

ch{&CtrFrame}:TabStrip:Tabs:Item(iCurTabSeq):Selected = 1.


Regards,
Istvan:awink:
 
Top