Applying SP4 to V11 re-introduces correct tabsheet behaviour when the order of tabsheets is changed

Date:22 February 2008
Product/Release:Visual LANSA V11 SP4
Abstract:Applying SP4 to V11 re-introduces correct tabsheet behaviour when the order of tabsheets is changed
Submitted By:LANSA Technical Support

Description:

Prior to V11, changing the displayposition of a tab folders active tabsheet would ensure that the tabsheet was still the active tabsheet after the DisplayPosition change.

In V11 (pre-SP4), changing the displayposition of a tab folders active tabsheet would change the active tabsheet to whatever tabsheet took the place of the changing tabsheet.

V11 SP4 has re-introduced the correct behaviour. If you wish the tabsheet with DisplayPosition(1) to also be opened when you change the tabsheet order, then in V11 SP4, you will need to add extra code to do so using the Opened(true).

Using the following code as an example:

FUNCTION OPTIONS(*DIRECT)
BEGIN_COM ROLE(*EXTENDS #PRIM_FORM) CLIENTHEIGHT(313) CLIENTWIDTH(492) LEFT(466) TOP(172)
DEFINE_COM CLASS(#PRIM_TAB) NAME(#TAB_1) DISPLAYPOSITION(1) HEIGHT(209) LEFT(16) PARENT(#COM_OWNER) TABPOSITION(1) TOP(16) WIDTH(465)
Define_Com Class(#prim_tbsh) Name(#Sheet1) Parent(#TAB_1) Reference(*dynamic)
Define_Com Class(#prim_tbsh) Name(#Sheet2) Parent(#TAB_1) Reference(*dynamic)
Define_Com Class(#prim_tbsh) Name(#Sheet3) Parent(#TAB_1) Reference(*dynamic)
DEFINE_COM CLASS(#PRIM_PHBN) NAME(#PHBN_1) CAPTION('Change Tab Order') DISPLAYPOSITION(2) LEFT(376) PARENT(#COM_OWNER) TABPOSITION(2) TOP(248) WIDTH(104)

EVTROUTINE handling(#com_owner.Initialize)
SET #com_owner caption(*component_desc)

* Create tabs sheets
Set_Ref Com(#Sheet1) To(*create_as #Prim_Tbsh)
Set_Ref Com(#Sheet2) To(*create_as #Prim_Tbsh)
Set_Ref Com(#Sheet3) To(*create_as #Prim_Tbsh)

Set Com(#Sheet1) Caption('#Sheet1')
Set Com(#Sheet2) Caption('#Sheet2')
Set Com(#Sheet3) Caption('#Sheet3')

#Sheet1.Realize
#Sheet2.Realize
#Sheet3.Realize

ENDROUTINE

EVTROUTINE HANDLING(#PHBN_1.Click)

Set Com(#Sheet3) DisplayPosition(1)
Set Com(#Sheet1) DisplayPosition(2)
Set Com(#Sheet2) DisplayPosition(3)

ENDROUTINE
END_COM

Generates this screen before the pushbutton is clicked:

Screen before the pushbutton is clicked

In V11.3 after clicking the pushbutton (which changes the tabsheet order as above in the code), the tabsheet order looks as follows, with the tabsheet with DisplayPosition(1) also being opened:

Example of tabsheet order after clicking the pushbutton in V11.3

In V11 SP4, after clicking the pushbutton (which changes the tabsheet order as above in the code), the tabsheet order looks as follows but the original opened tabsheet is still opened:

Example of tabsheet order after clicking the pushbutton in V11.4

This means you will have to define the open tabsheet explicitly in your code:

EVTROUTINE HANDLING(#PHBN_1.Click)

Set Com(#Sheet3) DisplayPosition(1)
Set Com(#Sheet1) DisplayPosition(2)
Set Com(#Sheet2) DisplayPosition(3)

*ADD THIS LINE TO INDICATE WHICH TAB SHOULD BE OPENED FIRST
Set Com(#Sheet3) Opened(true)

This will produce the behaviour whereby the tabsheet with DisplayPosition(1) is also the opened tabsheet.