Difference between revisions of "Template:ComplexDialogLayout3"

From Vectorworks Developer
Jump to: navigation, search
(VectorScript)
Line 24: Line 24:
 
BEGIN
 
BEGIN
 
dialog1 := CreateLayout('Tabs and Swaps', FALSE, 'OK', 'Cancel');
 
dialog1 := CreateLayout('Tabs and Swaps', FALSE, 'OK', 'Cancel');
CreateTabControl        (dialog1, kTabControl);
+
CreateSwapControl        (dialog1, kTabControl);
 
CreateGroupBox          (dialog1, kTabPane_1,      'Tab Pane 1', TRUE);
 
CreateGroupBox          (dialog1, kTabPane_1,      'Tab Pane 1', TRUE);
 
CreateGroupBox          (dialog1, kTabPane_2,      'Tab Pane 2', TRUE);
 
CreateGroupBox          (dialog1, kTabPane_2,      'Tab Pane 2', TRUE);
Line 64: Line 64:
 
RUN(dialog1_Main);
 
RUN(dialog1_Main);
 
</code>
 
</code>
 +
 
==== Python ====
 
==== Python ====
 
<code lang="py">
 
<code lang="py">

Revision as of 20:58, 14 September 2018

VectorScript

PROCEDURE dialog1_Main;
CONST
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;
VAR
dialog1          :INTEGER;

PROCEDURE dialog1_Setup;
BEGIN
dialog1 := CreateLayout('Tabs and Swaps', FALSE, 'OK', 'Cancel');
CreateSwapControl        (dialog1, kTabControl);
CreateGroupBox           (dialog1, kTabPane_1,      'Tab Pane 1', TRUE);
CreateGroupBox           (dialog1, kTabPane_2,      'Tab Pane 2', TRUE);
CreateSwapControl        (dialog1, kSwapControl_1);
CreateSwapControl        (dialog1, kSwapControl_2);
CreateGroupBox           (dialog1, kSwapPane_11,    '', TRUE);
CreateGroupBox           (dialog1, kSwapPane_21,    '', TRUE);
CreateGroupBox           (dialog1, kSwapPane_12,    '', TRUE);
CreateGroupBox           (dialog1, kSwapPane_22,    '', TRUE);
CreatePushButton         (dialog1, kButton_11,      'Button 1');
CreatePushButton         (dialog1, kButton_21,      'Button 3');
CreatePushButton         (dialog1, kButton_12,      'Button 2');
CreatePushButton         (dialog1, kButton_22,      'Button 4');

SetFirstLayoutItem(dialog1, kTabControl);
CreateTabPane     (dialog1, kTabControl,     kTabPane_1);
SetFirstGroupItem (dialog1, kTabPane_1,      kSwapControl_1);
CreateSwapPane    (dialog1, kSwapControl_1,  kSwapPane_11);
SetFirstGroupItem (dialog1, kSwapPane_11,    kButton_11);
CreateSwapPane    (dialog1, kSwapControl_1,  kSwapPane_12);
SetFirstGroupItem (dialog1, kSwapPane_12,    kButton_12);
CreateTabPane     (dialog1, kTabControl,     kTabPane_2);
SetFirstGroupItem (dialog1, kTabPane_2,      kSwapControl_2);
CreateSwapPane    (dialog1, kSwapControl_2,  kSwapPane_21);
SetFirstGroupItem (dialog1, kSwapPane_21,    kButton_21);
CreateSwapPane    (dialog1, kSwapControl_2,  kSwapPane_22);
SetFirstGroupItem (dialog1, kSwapPane_22,    kButton_22);
END;

PROCEDURE dialog1_Handler(VAR item :LONGINT; data :LONGINT);
BEGIN
END;

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

Python

def dialog1_Handler( item , data ):
	pass

def dialog1_Setup():
	
	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')
	vs.CreateTabControl         (dialog1, kTabControl)
	vs.CreateGroupBox           (dialog1, kTabPane_1,      'Tab Pane 1', True)
	vs.CreateGroupBox           (dialog1, kTabPane_2,      'Tab Pane 2', True)
	vs.CreateSwapControl        (dialog1, kSwapControl_1)
	vs.CreateSwapControl        (dialog1, kSwapControl_2)
	vs.CreateGroupBox           (dialog1, kSwapPane_11,    '', True)
	vs.CreateGroupBox           (dialog1, kSwapPane_21,    '', True)
	vs.CreateGroupBox           (dialog1, kSwapPane_12,    '', True)
	vs.CreateGroupBox           (dialog1, kSwapPane_22,    '', True)
	vs.CreatePushButton         (dialog1, kButton_11,      'Button 1')
	vs.CreatePushButton         (dialog1, kButton_21,      'Button 3')
	vs.CreatePushButton         (dialog1, kButton_12,      'Button 2')
	vs.CreatePushButton         (dialog1, kButton_22,      'Button 4')

	vs.SetFirstLayoutItem(dialog1, kTabControl)
	vs.CreateTabPane     (dialog1, kTabControl,     kTabPane_1)
	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_Main():	
	global dialog1
	dialog1 = dialog1_Setup()
	if vs.RunLayoutDialog(dialog1, dialog1_Handler) == 1:
		pass
dialog1 = 0		
dialog1_Main()
Personal tools
NamespacesFFFF

Variants
Actions
Advanced Search
See Also
Navigation
Toolbox