Creates an editable text field control for REAL values.
CreateEditReal is intended specifically for entry of numeric values; the control returns values in a numeric format, and supports calculations within the control field.
Table - Field Types for EditReal Fields
| Index | Field Value |
|---|---|
| 1 | REAL value |
| 2 | Angular value |
| 3 | Dimension |
| 4 | X coordinate |
| 5 | Y coordinate |
PROCEDURE CreateEditReal(
dialogID : LONGINT;
itemID : LONGINT;
editRealType : LONGINT;
defaultValue : REAL;
widthInCharacters : LONGINT);def vs.CreateEditReal(dialogID, itemID, editRealType, defaultValue, widthInCharacters):
return None| Name | Type | Description |
|---|---|---|
| dialogID | LONGINT | The index of the dialog layout containing the control. |
| itemID | LONGINT | The index that will identify the control item. |
| editRealType | LONGINT | The type of REAL value being accepted. |
| defaultValue | REAL | Default value for the field. |
| widthInCharacters | LONGINT | Width of the field in characters. |
Edits reals, does math, get and set values with get and set real calls.
There are 5 edit real types: *1 - Real, regular old real type; *2 - Angle, vs input and output is always in degrees but the user can use what ever they want; *3 - Dimension, usually an offset this a distance that is not tied to the origin; *4 - CoordinateX, this is an exact x location on the drawing; *5 - CoordinateY, this is an exact y location on the drawing. There are separate x and y controls to account for changes the user may make to the origin. I think Z coordinates should use the offset mode, but I need to check with mark on this one.
The default value parameter isn't worth much -- it plops the value into the edit box OK -- but it does not assign the value to the control. GetEditReal will return 0 for the control, unless the user clicks in the control. Use SetEditReal in your SetupDialogC event instead of using a default value for this control.
Accepts '3 1/4' and '3000000' but not '3,000,000'.
PROCEDURE Example;
VAR
dialog1 :INTEGER;
result :INTEGER;
PROCEDURE Dialog_Handler(VAR item :LONGINT; data :LONGINT);
BEGIN
END;
BEGIN
dialog1 := CreateLayout('Example Dialog', FALSE, 'OK', 'Cancel');
CreateEditReal(dialog1, 4, 3, 123, 16);
SetFirstLayoutItem(dialog1, 4);
result := RunLayoutDialog(dialog1, Dialog_Handler);
END;
RUN(Example);def Dialog_Handler( item , data ):
pass
def Example():
dialog1 = vs.CreateLayout('Example Dialog', False, 'OK', 'Cancel')
vs.CreateEditReal(dialog1, 4, 3, 123, 16)
vs.SetFirstLayoutItem(dialog1, 4)
result = vs.RunLayoutDialog(dialog1, Dialog_Handler)
Example()CreateStaticText(dialogID,6,GetPlugInString(3005),-1);
CreateStaticText(dialogID,7,GetPlugInString(3006),-1);
CreateEditInteger(dialogID,8,0,6);
CreateEditInteger(dialogID,9,0,6);
CreateEditReal(dialogID,10,3,0.0,6);
{ select the result type controls. }
CreateStaticText(dialogID, kSelResTypeStaticTxt, GetPlugInString(3018), -1);
CreateRadioButton(dialogID, k3DLocusRadioBtn, GetPlugInString(3019));
CreateRadioButton(dialogID, kStakeRadioBtn, GetPlugInString(3020));
CreateCheckBox (IDLabelDialog, kIDAutoInc, GetPlugInString(6005)); {'Auto-Increment ID Label'}
CreateCheckBox (IDLabelDialog, kUseMarker, GetStr(kUseMarkerTxt));
CreateMarkerPopup (IDLabelDialog, kLeaderStyle);
CreateStaticText (IDLabelDialog,kBubbleSizeTxt, GetStr(kBubbleSizeTxt),18);
CreateEditReal (IDLabelDialog,kBubbleSize, 3,0,16);
CreateStaticText (IDLabelDialog,kBubbleLSTxt, GetStr(kBubbleLSTxt),18);
CreateLineAttributePopup (IDLabelDialog, kBubbleLS);
CreateGroupBox (IDLabelDialog, kDataGrpBx, GetStr(kDataGrpBx), FALSE);
CreateGroupBox (IDLabelDialog, kLBSpaceGrpBx, GetStr(kLBSpaceGrpBx), FALSE);
{create controls}
CreateGroupBox( dlgId, kSettingsPanel,'', False );{kSettingsPanel}
CreateStaticText( dlgId, kHeightLabel, GetPluginString(3019), -1 );{kHeightLabel}
CreateEditReal( dlgId, kHeightEdit, 1, 0.0, 20 );
CreateStaticText( dlgId, kFloorCountLabel, GetPluginString(3020), -1 );
CreateEditInteger( dlgId, kFloorCountEdit, 0, 20 );
CreateCheckBox( dlgId, kAllowIndividualCheck, GetPluginString(3021) );
CreateCheckBox( dlgId, kSetSlabCheck, GetPluginString(3022) );import vs
# Creates an editable text field control for REAL values.
dialogID = 1
itemID = 2
editRealType = 0
defaultValue = 1.0
widthInCharacters = 3
vs.CreateEditReal(dialogID, itemID, editRealType, defaultValue, widthInCharacters)
newObj = vs.LNewObj() # handle to the newly created objectAvailability: from VectorWorks 9.0