Difference between revisions of "Template:ComplexDialogLayout3swap"

From Vectorworks Developer
Jump to: navigation, search
(VectorScript)
 
(3 intermediate revisions by one user not shown)
Line 1: Line 1:
 +
VectorScript example:
 +
<code lang="vs">
 
PROCEDURE dialog1_Main;
 
PROCEDURE dialog1_Main;
 
CONST
 
CONST
Line 47: Line 49:
 
END;
 
END;
 
RUN(dialog1_Main);
 
RUN(dialog1_Main);
 +
</code>
  
==== Python ====
+
Python example:
<code lang="py">
+
<code lang='py'>
def dialog1_Handler( item , data ):
+
kOK            = 1
pass
+
kCancel        = 2
 +
kSwapControl  = 4
 +
kSwapPane_1    = 5
 +
kSwapPane_2    = 6
 +
kButton_1      = 13
 +
kButton_2      = 15
  
def dialog1_Setup():
+
dialog1 = 0
+
kOK            = 1
+
kCancel        = 2
+
kTabControl    = 4
+
kTabPane_1    = 5
+
kTabPane_2    = 6
+
kSwapControl_1 = 7
+
kSwapControl_2 = 8
+
kSwapPane_11  = 9
+
kSwapPane_21  = 10
+
kSwapPane_12  = 11
+
kSwapPane_22  = 12
+
kButton_11    = 13
+
kButton_21    = 14
+
kButton_12    = 15
+
kButton_22    = 16
+
  
dialog1 = vs.CreateLayout('Tabs and Swaps', False, 'OK', 'Cancel')
+
def dialog1_Setup():
vs.CreateSwapControl        (dialog1, kTabControl)
+
  global dialog1
vs.CreateGroupBox          (dialog1, kTabPane_1,     'Tab Pane 1', True)
+
  dialog1 = vs.CreateLayout('Swap control', False, 'OK', 'Cancel')
vs.CreateGroupBox          (dialog1, kTabPane_2,     'Tab Pane 2', True)
+
  vs.CreateSwapControl        (dialog1, kSwapControl)
vs.CreateSwapControl        (dialog1, kSwapControl_1)
+
  vs.CreateGroupBox          (dialog1, kSwapPane_1,   'Swap Pane 1', True)
vs.CreateSwapControl        (dialog1, kSwapControl_2)
+
  vs.CreateGroupBox          (dialog1, kSwapPane_2,   'Swap Pane 2', True)
vs.CreateGroupBox          (dialog1, kSwapPane_11,    '', True)
+
  vs.CreatePushButton        (dialog1, kButton_1,     'Go to second pane...')
vs.CreateGroupBox          (dialog1, kSwapPane_21,    '', True)
+
  vs.CreatePushButton        (dialog1, kButton_2,      '... go to first pane')
vs.CreateGroupBox          (dialog1, kSwapPane_12,    '', True)
+
 
vs.CreateGroupBox          (dialog1, kSwapPane_22,    '', True)
+
  vs.SetFirstLayoutItem(dialog1, kSwapControl)
vs.CreatePushButton        (dialog1, kButton_11,      'Button 1')
+
 
vs.CreatePushButton        (dialog1, kButton_21,      'Button 3')
+
  vs.CreateSwapPane    (dialog1, kSwapControl,   kSwapPane_1)
vs.CreatePushButton        (dialog1, kButton_12,     'Button 2')
+
  vs.SetFirstGroupItem (dialog1, kSwapPane_1,     kButton_1)
vs.CreatePushButton        (dialog1, kButton_22,     'Button 4')
+
  
vs.SetFirstLayoutItem(dialog1, kTabControl)
+
  vs.CreateTabPane    (dialog1, kSwapControl,    kSwapPane_2)
vs.CreateTabPane    (dialog1, kTabControl,     kTabPane_1)
+
  vs.SetFirstGroupItem (dialog1, kSwapPane_2,    kButton_2)
vs.SetFirstGroupItem (dialog1, kTabPane_1,      kSwapControl_1)
+
vs.CreateSwapPane   (dialog1, kSwapControl_1,  kSwapPane_11)
+
vs.SetFirstGroupItem (dialog1, kSwapPane_11,   kButton_11)
+
vs.CreateSwapPane    (dialog1, kSwapControl_1,  kSwapPane_12)
+
vs.SetFirstGroupItem (dialog1, kSwapPane_12,    kButton_12)
+
vs.CreateTabPane     (dialog1, kTabControl,    kTabPane_2)
+
vs.SetFirstGroupItem (dialog1, kTabPane_2,      kSwapControl_2)
+
vs.CreateSwapPane    (dialog1, kSwapControl_2,  kSwapPane_21)
+
vs.SetFirstGroupItem (dialog1, kSwapPane_21,    kButton_21)
+
vs.CreateSwapPane    (dialog1, kSwapControl_2,  kSwapPane_22)
+
vs.SetFirstGroupItem (dialog1, kSwapPane_22,    kButton_22)
+
return dialog1
+
  
 +
def dialog1_Handler(item,data):
 +
  if item == kButton_1:
 +
      vs.DisplaySwapPane(dialog1, kSwapControl, 2)
 +
  elif item == kButton_2:
 +
      vs.DisplaySwapPane(dialog1, kSwapControl, 1)
  
def dialog1_Main():
+
dialog1_Setup()
global dialog1
+
if vs.RunLayoutDialog(dialog1, dialog1_Handler) == 1:
dialog1 = dialog1_Setup()
+
    pass
if vs.RunLayoutDialog(dialog1, dialog1_Handler) == 1:
+
pass
+
dialog1 = 0
+
dialog1_Main()
+
 
</code>
 
</code>

Latest revision as of 14:12, 17 September 2018

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
Personal tools
NamespacesFFFF

Variants
Actions
Advanced Search
See Also
Navigation
Toolbox