Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Commands that are shipped by default also show up the default user input mask that may not suit well into the host applications surface. The CFxARESInstance allows to disable the predefined controls using the method switchStandardUserInputSetUIConfiguration(). Once this is done it is necessary to create a custom input that cooperates with commands. Whenever a command requires an user action the custom input should request for corresponding values. This can be accomplished with the CFxUserInputDelegate.  The CFxUserInputDelegate informs the host application when an user interaction starts interactionStarted() or ends interactionEnded(). The DWG Expert controls a class UserInput.java that takes over the job of the delegate and the user interface. The class must be instantiated and registered as main CFxUserInputDelegate. Depending on the started interaction type the custom user input has to accept the command value or exit the command procedure. The DWG Expert relies on point input and demonstrates the use of acceptWithCoordinates() and cancel().


UIConfiguration
The default value is 7. Get the current value with GetUIConfiguration() from CFxARESInstance.

Flag

Value

Description

eCustomUserInput

0

This flag overrides and disables the default user input

eStandardUserInput

1

The standard user input for commands, all features enabled

eStandardUserInputHelpButton

2

This flag can be removed to hide the help button

eStandardUserInputPanButton

4

This flag can be removed to hide the Pan/Orbit button

The method interactionStarted( final String prompt, String[] keywords, int inputType ) basically provides the following kind of data:

Type

Description

prompt

The current command prompt that can be displayed

keywords

The current command keywords that can be displayed or executed with CFxARESInstance.instance().userInput().acceptWithStringResult()

inputType

The type of the current command prompt. The active type should be addressed accordingly in the custom user interface. Some types like GetPoint or GetDistance do not require user input fields when the host application only wants to allow picking a point or specifying a distance on the graphics area. Types likes GetKeyword or GetString can not be processed on the graphics area and require corresponding and suitable input fields.


The command prompt input types are:

Code Block
public static final int GetPoint = 1;
public static final int GetAngle = 2;
public static final int GetDistance = 3;
public static final int GetOrient = 4;
public static final int GetCorner = 5;
public static final int GetScale = 6;
public static final int GetKeyword = 7;
public static final int GetColor = 8;
public static final int GetInt = 9;
public static final int GetDouble = 10;
public static final int GetString = 11;
public static final int GetSelection = 12;


Note: It is highly important to always provide to the user a control that allows him to cancel the current command routine. The current command routine can be canceled using method cancel(). The final call will look like: CFxARESInstance.instance().userInput().cancel()
Some command prompts have default values. These default values can be processed with the method accept(). The final call will look like: CFxARESInstance.instance().userInput().accept()

...