VS:CreateColorPopup

From Vectorworks Developer
Jump to: navigation, search

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

Description

Create a color popup dialog control that displays the 256 color palette associated with the active document.

The widthInCharacters argument specifies the width of the control. Pass -1 to request the default size, which will be consistent with other attribute controls (currently defaults to 14). This argument allows for special circumstances like a small popup for the Fore and Back color associated with the Pattern attribute control.

PROCEDURE CreateColorPopup(
dialogID  :LONGINT;
itemID  :LONGINT;
widthInCharacters  :LONGINT);
def vs.CreateColorPopup(dialogID, itemID, widthInCharacters):
    return None

Parameters

dialogID LONGINT
itemID LONGINT
widthInCharacters LONGINT

Example

VectorScript

PROCEDURE Example;
VAR
dialog1 :INTEGER;
result  :INTEGER;
PROCEDURE Dialog_Handler(VAR item :LONGINT; data :LONGINT);
BEGIN
CASE item OF
SetupDialogC:
BEGIN
SetColorChoice(dialog1, 4, 1242);
END;
1:
BEGIN
GetColorChoice(dialog1, 4, result);
AlrtDialog(Concat('color index: ', result));
END;
END;
END;
BEGIN
dialog1 := CreateLayout('Example Dialog', FALSE, 'OK', 'Cancel');
CreateColorPopup(dialog1, 4, 24);
SetFirstLayoutItem(dialog1, 4);
result := RunLayoutDialog(dialog1, Dialog_Handler);
END;
RUN(Example);

Python

def Dialog_Handler(item , data ):
	if item == SetupDialogC:
		vs.SetColorChoice(dialog1, 4, 1242)
	elif item == 1:
		result = vs.GetColorChoice(dialog1, 4)
		vs.AlrtDialog(vs.Concat('color index: ', result));

def Example():
	global dialog1
	dialog1 = vs.CreateLayout('Example Dialog', False, 'OK', 'Cancel')
	vs.CreateColorPopup(dialog1, 4, 24)
	vs.SetFirstLayoutItem(dialog1, 4)
	result = vs.RunLayoutDialog(dialog1, Dialog_Handler)

global SetupDialogC
SetupDialogC = 12255
dialog1 = 0
Example()

Version

Availability: from VectorWorks12.0
Personal tools
NamespacesFFFF

Variants
Actions
Advanced Search
See Also
Navigation
Toolbox