BtServer:SetStruct()
<< Click to Display Table of Contents >>
BtServer:SetStruct()
|
|
Purpose
Activate alternative structure for open table
Prototype
METHOD SetStruct ( symname ) CLASS BtServer
Argument(s)
<symName> SYMBOL Name of structure to activate. #Default is the name of the
structure that was specified when opening the file.
Return
LOGIC TRUE when new requested structure is selected, FALSE when the name was not found
Description
With this method you can activate an alternative layout of the file.
After activating the alternative layout new datafield objects are generated for the server. If you have changed some of the datafields by calling SetDataField, you should repeat that after you have selected another structure.
NOTE
You should be VERY CAREFUL when using this if you have used the server in combination with VO's DataWindow and/or Databrowser classes.
The DataWindow and Databrowser classes store information about the server they are connected to internally, and they may get confused by the new structure, especially if they are linked to a field that is not available anymore in the new structure.
If you have to switch to another layout for a server that is in use by a window or a browser, you better disable notification before you do so and until you are finished
Example(s)
oSrvr := BtDDFServer.....
aFlds := Bt_ReadDDFieldInfo(....)
oSrv:AddStruct(#Alternative,aFlds)
oDw:Use(oSrv)
oDw:ViewTable()
oDw:Show()
// now operate on the alternative layout
// to be safe we disable notifications
oSrv:SuspendNotification()
oSrv:SetStruct(#Alternative)
..
..
// Switch back to the default layout
// and enable notifications
oSrv:SetStruct(#Default)
oSrv:ResetNotification()
See Also
BtServer, BtServer:AddStruct(), BtServer:CurrStruct