DYNAINPUT - v14


dynainput                    mode=<i>, w1<i>,w2=<i>,bcol=(r,g,b),fcol=(r,g,b),

Function

Essential to the use of the Dynamic Input functionality in the POLLING command. DYNAINPUT sets the input mode and other characteristics of Dynamic Input functionality and is used in conjunction with the POLLING command and a user defined DLL to obtain the final result.

 

NOTE : Eagle 12.3.0 build 07 onward requires a different version of the PLNGHOOK.DLL to that originally released.  This is included both as a DLL and a VisualStudio project.

Parameters

MODE

0 (default) means no dynamic input
1
means “one” edit control in the dynamic input panel
2
means “two” edit controls in the dynamic input panel
 

W1 <value>

The value is the width in pixels for the first edit control.
 

W1 <value>

The value is the width in pixels for the second edit control
 

BCOL (r,g,b)

(red,green,blue) values for the background colour of the hint message
 

FCOL (r,g,b)

(red,green,blue) values for the foreground colour of the hint message.

 

Notes

Events on usage

The dynamic panel is displayed when the mode value is 1 or 2 and the result is similar to the one in following figure:

 

The POLLING hint text is displayed in a blue panel (in the figure) attached to the cursor, followed by two edit controls where values are present. Suppose that the POLLING command has been executed specifying OS=<string variable> then the values displayed in the two edit controls are encoded with a “|” separator(*) and returned in the OS-string.

(*) the separator is hard-coded in the actual version of Eagle (12.2.0).

The POLLING exits as in standard mode (MODE=0).

 

An extra event occurance is the TAB key that allows moving of the keyboard focus into the edit controls in a closed sequence (edit1, edit2, edit1, …). When the focus is set into one of the edit controls, the user can type a value and TAB to the other edit control or type <Enter> to exit from POLLING confirming the specified values. If the user moves the cursor then POLLING is not terminated and the dynamic values are displayed in the two edit controls.

 

This works exactly in the same way when there is just one edit control (MODE=1) but naturally tabbing will have no effect.

 

The focus remains on the Dynainput control until either <enter> (confirm) or <escape> (cancel) is initiated. (Update v12.3.3)

 

Displaying Specific User Values

Since the user application needs to display values in a specific format, or even computed values, inside the edit control/s, Eagle includes a DLL called PLNGHOOK.DLL (in source format), with which users can develop their own function. The plnghook function is called by Eagle passing the following data:

x,y,z coordinates of the point specified by the actual position of the cursor in 3D World Coordinates;

distance, that is the distance between the previous point and the actual position of the cursor;

angle, that is the angle in radians between the previous point and the actual position of the cursor;

 

Users can develop any type of conversion, translation, in fact any function of x,y,z,distance and angle, defining the required format, and return two strings which are then displayed by Eagle into the two edit controls. A sample for this function is given below:

 

PLNGHOOK_API int PlngHook( double x, double y, double z,
double distance, double angle,
char *sField1, char *sField2)
{
sprintf(sField1,"COORD: %6.2f,%6.2f",x,y);
sprintf(sField2,"D=%6.2f,A=%6.2f",distance,angle);

return 1;
}

 

Note: the PLNGHOOK.DLL is supplied as a MS Visual Studio 6.0 project.

 

The dimension of the hint box and the edit controls can be any, like in the following example:

 

 

Decoding the POLLING return string

How to decode the returning string from the POLLING when containing the two values specified in the two controls of the dynamic input.

 

The two values are encoded in S1 (output string of the POLLING command), separated by the | (vertical bar) character.

NUMERICS x,y
STRINGS s10,11
x=cpos(s1,’|’)
s10=s1[1\x-1]
s11=s1[x+1\y]

 

If the string s11 now contains more values separated with a comma, such as coordinates, the DECODE command can be used:

 

DECODE s10:x,y,z

 

Where s10 contains for instance “100,200,0” and the resulting x=100, y=200 and z=0.

Snapshots

Dynamic input with one edit control.


Tab gives focus to the edit control, so the user can change the value.
 

Two edit controls and different background and foreground colour for the hint message.

NOTE : The colours for the edit controls respect the current Windows scheme window’s background and foreground colours, like the edit controls (button type 6) in Eagle panels and toolbars.

 

HOOK to transform values or format

The HOOK command (12.5.4 onward) represents the last parameter passed to the hook function "sense", which can be used to change the way to transform the values or to format the output string.  

For instance developers can use the value to use a different transformation depending to the view type and/or the type of model in memory. This depreciates the use of COORDINATE command to manage this functionality.

 

Additional Configuration  Options

The look of the text displayed in the dynamic panel can be specified by using the configuration INI/Registry settings

DYNAINPUT_FONT=Arial

DYNAINPUT_FONT_SIZE=20

These settings control the font family and size used.  These settings are set dynamically.  

 

When the Dynainput is active by default it should technically not display the POLLING hint in the status bar. In the interest of compatibility and usability, there is a setting in the INI file called POLLING_HINT_IN_STATUSBAR, which is "yes" by default.  If set to "no" then the hint of the POLLING command is not shown in the status bar.  (V12.3.3)

 

When using FOC=0,1 in POLLING it is possible to set a tolerance to decide at what point he mouse movement removes the focus from the dynamic input edit field. A new variable in the INI/Registry file called DYNAINPUT_TOLERANCE can be set to the tolerance value which is expressed in pixels. The default is 0, suggested values are in the range [10,20].  (V12.4.5)

 

See also

polling, coordinate, Customizing Eagle GUI and graphics