VS:PopupGetChoices: Difference between revisions

From Vectorworks Developer
Jump to navigation Jump to search
No edit summary
No edit summary
 
Line 44: Line 44:
<remark>
<remark>
[[User:AHanson]], 2023.12.14:
[[User:AHanson]], 2023.12.14:
This appears to work on standard resource records only and not with parametric object records when tested in v2024. Returns 0 and None on every test attempt with both base field name and localized.
This appears to work on standard resource records only and not with parametric object records when tested in v2024. Returns 0 and None. Use VS:GetLocalizedPluginChoice instead for Plug In Objects.


</remark>
</remark>

Latest revision as of 19:46, 14 December 2023

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

Description

PROCEDURE PopupGetChoices(
recName :DYNARRAY[] of CHAR;
fieldName :DYNARRAY[] of CHAR;
VAR outNumValues :INTEGER;
VAR outPopUpValues :ARRAY);
def vs.PopupGetChoices(recName, fieldName):
    return (outNumValues, outPopUpValues)

Parameters

recName DYNARRAY[] of CHAR Name of record in which field is.
fieldName DYNARRAY[] of CHAR Name of field.
outNumValues INTEGER Return number of popup values.
outPopUpValues ARRAY Return popup values.

Remarks

User:AHanson, 2023.12.14:

This appears to work on standard resource records only and not with parametric object records when tested in v2024. Returns 0 and None. Use VS:GetLocalizedPluginChoice instead for Plug In Objects.

Example

PROCEDURE Example;

FUNCTION TestFunc(h :HANDLE) :BOOLEAN;
VAR
arrayText 		: ARRAY[1..3] OF STRING;
CurPopUpInfo 	: ARRAY[ 1..100 ] OF STRING;	
numPopUpValues 	: INTEGER;
i		: INTEGER;
BEGIN
	{create new record}
	NewField( 'Format-1', 'FieldNamePopUp', '22222', 17, 0 );

	arrayText[1] := '11111';
	arrayText[2] := '22222';
	arrayText[3] := '33333';
	
	{add new popup values to FieldNamePopUp}
	PopupSetChoices( 'Format-1', 'FieldNamePopUp', arrayText );

	{get popup values and print them}
	PopupGetChoices( 'Format-1', 'FieldNamePopUp', numPopUpValues, CurPopUpInfo );
	
	FOR i:=1 TO numPopUpValues DO
	BEGIN
		AlertInform ( CurPopUpInfo[ i ], '', FALSE );
	END;
	
	{clear popUp values}
	{NewField( 'Format-1', 'FieldNamePopUp', '22222', 17, 0 );}
END;

BEGIN
	ForEachObjectInLayer(TestFunc, 0, 0, 4);

END;
RUN(Example);

Version

Availability: from Vectorworks 2023