VS:CreateSwapPane

From Vectorworks Developer
Revision as of 21:00, 14 September 2018 by Root (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix

Description

Creates a swap pane within the specified swap control. Within a swap control, only one swap pane is visible at a time.
PROCEDURE CreateSwapPane(
dialogID  :LONGINT;
swapControlID  :LONGINT;
newGroupID  :LONGINT);
def vs.CreateSwapPane(dialogID, swapControlID, newGroupID):
    return None

Parameters

dialogID LONGINT the ID of the dialog
swapControlID LONGINT the ID of the swap control
newGroupID LONGINT the ID of the group to be inserted into swap control as a swap pane.

Remarks

The function is analogous to CreateTabPane.

Example

VectorScript example:
PROCEDURE dialog1_Main;
CONST
  kOK            = 1;
  kCancel        = 2;
  kSwapControl   = 4;
  kSwapPane_1    = 5;
  kSwapPane_2    = 6;
  kButton_1      = 13;
  kButton_2      = 15;
VAR
  dialog1          :INTEGER;

PROCEDURE dialog1_Setup;
BEGIN
  dialog1 := CreateLayout('Swap control', FALSE, 'OK', 'Cancel');
  CreateSwapControl        (dialog1, kSwapControl);
  CreateGroupBox           (dialog1, kSwapPane_1,    'Swap Pane 1', TRUE);
  CreateGroupBox           (dialog1, kSwapPane_2,    'Swap Pane 2', TRUE);
  CreatePushButton         (dialog1, kButton_1,      'Go to second pane...');
  CreatePushButton         (dialog1, kButton_2,      '... go to first pane');
  
  SetFirstLayoutItem(dialog1, kSwapControl);
  
  CreateSwapPane    (dialog1, kSwapControl,    kSwapPane_1);
  SetFirstGroupItem (dialog1, kSwapPane_1,     kButton_1);

  CreateTabPane     (dialog1, kSwapControl,    kSwapPane_2);
  SetFirstGroupItem (dialog1, kSwapPane_2,     kButton_2);
END;

PROCEDURE dialog1_Handler(VAR item :LONGINT; data :LONGINT);
BEGIN
  CASE item OF
  kButton_1: BEGIN
      DisplaySwapPane(dialog1, kSwapControl, 2);
    END;
  kButton_2: BEGIN
      DisplaySwapPane(dialog1, kSwapControl, 1);
    END;
  END;
END;

BEGIN
  dialog1_Setup;
  IF RunLayoutDialog(dialog1, dialog1_Handler) = 1 THEN BEGIN
    END;
END;
RUN(dialog1_Main);

Python example:

kOK            = 1
kCancel        = 2
kSwapControl   = 4
kSwapPane_1    = 5
kSwapPane_2    = 6
kButton_1      = 13
kButton_2      = 15

dialog1 = 0

def dialog1_Setup():
  global dialog1
  dialog1 = vs.CreateLayout('Swap control', False, 'OK', 'Cancel')
  vs.CreateSwapControl        (dialog1, kSwapControl)
  vs.CreateGroupBox           (dialog1, kSwapPane_1,    'Swap Pane 1', True)
  vs.CreateGroupBox           (dialog1, kSwapPane_2,    'Swap Pane 2', True)
  vs.CreatePushButton         (dialog1, kButton_1,      'Go to second pane...')
  vs.CreatePushButton         (dialog1, kButton_2,      '... go to first pane')
  
  vs.SetFirstLayoutItem(dialog1, kSwapControl)
  
  vs.CreateSwapPane    (dialog1, kSwapControl,    kSwapPane_1)
  vs.SetFirstGroupItem (dialog1, kSwapPane_1,     kButton_1)

  vs.CreateTabPane     (dialog1, kSwapControl,    kSwapPane_2)
  vs.SetFirstGroupItem (dialog1, kSwapPane_2,     kButton_2)

def dialog1_Handler(item,data):
  if item == kButton_1:
      vs.DisplaySwapPane(dialog1, kSwapControl, 2)
  elif item == kButton_2:
      vs.DisplaySwapPane(dialog1, kSwapControl, 1)

dialog1_Setup()
if vs.RunLayoutDialog(dialog1, dialog1_Handler) == 1:
    pass

Version

Availability: from VectorWorks11.5

See Also

VS Functions:

VS:CreateSwapControl | VS:DisplaySwapPane

VS Functions:

[[VS:CreateSwapControl]]

| [[VS:DisplaySwapPane]]
Personal tools
NamespacesFFFF

Variants
Actions
Advanced Search
See Also
Navigation
Toolbox