Cosmos

Technical Notes 7.2, 7.2.1 and 7.2.2

NEW UTILITY INCLUDED FROM VERSION 7.2

CosSignFile. The CosSignFile dll (cossigfile.dll) allows to digitally sign files in PDF, XML and binary format, as well as the signature of XML electronic invoice files in FacturaE format versions 3.2.1 and 3.2.2. (PDF version)

Bug fixes of version 7.2.2

Runtime

Development

When the source code of the Cosmos editor was modified and a breakpoint added, it did not appear on the line where it had been added. When debugging, it stopped at the indicated place.

Implementations, improvements and bug fixes of version 7.2.1Ir al principio de la página

Implementations and improvements

JSON Class

The possibility of handling data of decimal type has been implemented.

Bug fixes

Runtime

Implementations and improvements of version 7.2Top

Array class

The maximum number of elements of an Array has been increased, which can now be 2,147,483,647 elements.

The data type of the parameters in the Resize method of the Array class and the Size method of the Container class changes from Smallint to Integer.

This modification means that programs compiled with previous versions can not be executed with this version. It is necessary to recompile the applications.

Char class

The limit of 32,767 bytes has been eliminated in objects of the Char class, now being set to 2,147,483,647 bytes. To do this, some of the functions of the Char class have been modified in order to be able to handle character strings with a length greater than 32,767 bytes.

Operators modified from this version:

Methods modified from this version:

NOTE: The definition of the initial size of a Char object will remain a maximum of 32,767 bytes. The size of the Char object can be modified at run time with the assignment and concatenation operators.

This change in the parameter data type or return of the functions supposes that the binaries are incompatible.
In addition, you should check the type of return variables, function’s parameters and methods redefinitions (see below methods).

FormTable class

The queries have been optimized for the case of the tables of a FormTable associated with a Grid control. For this, the environment variable LOOKUPOUTERJOIN has been implemented.

If the environment variable is defined, instead of creating a cursor for each Lookup, a single phrase is created with Outer Joins to the Lookup tables.

Json class

The algorithm of the SaveToFile method and that of the Converter to Char has been optimized.

Controls

Band Group

The possibility of changing the size of the child controls of the bands of a running Band Group control before adding the band has been implemented.

NOTE: If you enlarge the size of some child control of any of the bands (Box control), you should also enlarge the band size if the width of the band is smaller, since it does not expand automatically.

Bitmap

The Auto Fit property has been implemented in the Bitmap controls so that the image associated with the control is not deformed when the size of the running control is changed.

This property has been implemented for controls of the Form class and controls for the Page class.

Drop Edit and Edit Field

It has been implemented the possibility that Cosmos remembers the position of the cursor in the editing controls so that, when accessing the control again, the cursor is placed in the same position (EDITFIELDNOMARKONGETFOCUS). When returning the focus to the control the text of the field will not be selected.

Grid

From this version it is possible to copy the text of the Drop List and Check type controls (ALLOWCOPYCONTROLDATA). In the case of Check type controls, the values that will be copied will be 0 or 1 (0 if the check is not checked and 1 if it is checked).

It has been implemented the possibility that the On Click event, in the Grid controls, will not be launched when clicking on the header of the Grid. For this, the environment variable NOSENDCLICKONGRIDCLICKHEADER must be defined.

The AlternateBackColor method of the SimpleControl class can be invoked from the Grid type controls, in addition to the controls of type List Box.

We have optimized the queries that are made from Cosmos when a Grid control has a table associated with it and some of the fields in the Formtable are of type Lookup (LOOKUPOUTERJOIN).

List Box

It will be possible to define the height in pixels of the rows of a list. The defined size will be applied to all the rows in that list. For this, the SetListAllRowsHeight method of the SimpleControl class must be executed.

It has been implemented the possibility of moving in the list controls from left to right with the mouse wheel. To do this, hold down the [Ctrl] + mouse wheel.

If a cell in a list has a style assigned, its background color will be the one defined in the style, regardless of whether the row it belongs to has the focus.

From this version it is allowed to totalize by columns of type DATE and DATETIME.

Tab Control

The RClickHeader event has been implemented.

NOTE. If the event is being used as a generic event, it must be taken into account that, from this version, the code will also be executed when the right mouse button is clicked on the Tab Control tab.

Cosmos WebServer

The environment variable CWSIGNOREMAIN has been implemented to control whether or not to execute the main function of the module that implements the REST service that is being executed.

The IsRunningInCosmosWebServer method of the Module class has been implemented to check if the Cosmos application is running from Cosmos WebServer.

By default, whenever an error occurs and no HTTP code has been activated with the SetExecStatus method of the Module class, Cosmos will trigger HTTP error 500.

Log file

The output of the errors generated by the Cosmos WebServer runtime during the processes can be dumped into a file if a file with the name CWSLog.log is created in the temporary directory.

Cosmos WebServer a service
If an error occurs during the execution of a Cosmos service and the ErrorLevel is greater than 0, the information about the error will be stored in the log file, as well as the method and module where the error occurred, and the call stack of the application.

If an error occurs during execution and the ErrorLevel equals 0, the error information will not be written to the log file.

If the Trace method is executed in the source code of the Cosmos service, the text associated with that method will be written to the log file.

Cosmos WebServer as application
If an error occurs during the execution of a Cosmos service and the ErrorLevel is greater than 0, information about the error will be stored in the log file, as well as the method and module where the error occurred, and the call stack from the application. This same information will be displayed on the screen through a MessageBox.

If an error occurs during execution and the ErrorLevel equals 0, the error information will not be written to the log file and will not be displayed on the screen.

If the Trace method is executed in the source code of the Cosmos service, a MessageBox with the text associated with the Trace method will be displayed on the screen and the text will not be written to the log file.

Cosmos 7 Visual Style

From this version you can change the visual style of a Cosmos application at runtime. The changes that can be made are the following:

It will not be necessary to define the [Custom Colors] section in the configuration files used by Cosmos as it was in version 7.0. In this way you can have several color schemes for the same Cosmos application.

For either of the two changes to be effective, the new Refresh method of the SimpleControl class must be called (this method has been implemented in this version).

Events

Form

Its has been implemented The ChangeSize event of the Form class, which allows to know when the size of a window has been changed at run time.

Drag & Drop

The GetDragColumn and GetDropColumn methods have been implemented, which allow to know, respectively, in the List Box controls, the columns from which  has been dragged (drag) and an the column where has been dropped (drop).

RClickHeader

The RClickHeader event has been implemented for controls of type Tab. This event will be launched when the user clicks with the right mouse button on a tab of the Tab control.

Export to Excel

In addition to the XML 2003 spreadsheet format that Cosmos supports when exporting to Excel, from this version it is possible to export to Excel in XLSX format.

To be generated with this new format, the name of the files that are created from any of the methods or utilities of Cosmos must have the extension XLSX.

In the cases of the methods that receive the name of the file as a parameter they should be modified. These methods are the following:

If the Save As option is available when the file is generated, it will be necessary to choose Excel File Type (*.xlsx). These cases are:

  1. Sql-Interactive.
  2. Preview of the listings (Preview method). If the Save As option is selected as Excel File type (* .xlsx), in addition to exporting the data to Excel in the new format, it will automatically export them in simple mode without displaying the following dialog element:

Diálogo Tipo de exportación

From the output window of the Cosmos development environment it is possible to automatically export the errores.xlsx (Build) and findinfiles.xlsx (Find in Files) files.

Icons

Possibility of using icons with transparencies (alpha channel) in Cosmos. It has been implemented for ICO and PNG files.

It is necessary to define the variable USEALPHACHANNELICONS with value YES or TRUE.

Editable Lists

In addition to using the [Return or Enter] key to accept the modifications made in a cell, from this version you can also use the cursor movement keys (environment variable LISTEDITACCEPTVALUEONARROWKEYS) or simply remove the focus from the List Box control or from the edited cell (environment variable LISTEDITACCEPTVALUEONLOSINGFOCUS).

Automatic editing mode

From this version it is possible to add new records if the Allow Add property is checked.

Digital signature

The CosSignFile dll (cossigfile.dll) allows to digitally sign files in PDF, XML and binary format, as well as the signature of XML electronic invoice files in FacturaE format versions 3.2.1 and 3.2.2.

For more information, see the technical notes of the CosSignFile dll.

Preview in reports

Export to Excel in XLSX format.

The ability to save the zoom values used in a preview has been implemented, for which the environment variable REMEMBERPREVIEWZOOM and the methods GetLastPreviewZoom of the classes PrnDocument and Module, and SetLastPreviewZoom of the Module class have been defined.

Improvements

New methodsTop

Char class

LoadFromFile

This method allows loading the contents of an ASCII file into a variable of type Char.

Module class

LoadCustomColors

It allows to load, from a file, a palette of colors to personalize the controls of the application of Cosmos with visual style Cosmos 7.

NOTE: To refresh/repaint the window it will be necessary to execute the Refresh method.

GetLastPreviewZoom

Returns the zoom percentage with which the user viewed the last report in the preview window (Preview and PreviewEx methods).

Regardless of the percentage of zoom that has been assigned with the SetLastPreviewZoom method, if the user modifies it in the Preview window, the value that will return this method from that moment will be the one indicated by the user when the window was closed.

This method does not require that the environment variable REMEMBERPREVIEWZOOM be defined.

GetSystemTimeUTC

Returns the UTC time.

IsRunningInCosmosWebServer

This method lets you know if the Cosmos application is running from Cosmos WebServer.

SetLastPreviewZoom

Assigns a zoom percentage to the Cosmos reports in the preview window (Preview or PreviewEx methods).

For the operation of this method to be correct, the environment variable REMEMBERPREVIEWZOOM must be defined and its value must be TRUE or YES.

NOTE: The joint use of the methods GetLastPreviewZoom and SetLastPreviewZoom and the environment variable REMEMBERPREVIEWZOOM allows, for example, to store the percentage of Preview in the user's configuration when the application finishes and recover it when it is executed again.

PrnDocument class

GetLastPreviewZoom

Returns the zoom percentage with which the user viewed the last report in the preview window (Preview and PreviewEx methods).

It is not necessary to define the environment variable REMEMBERPREVIEWZOOM.

SimpleControl class

GetDragColumn

In the drag & drop mechanism, this method allows to obtain the column of the List Box control from which the element was dragged.

NOTA: Esta información se puede obtener igualmente con el método GetCurrentItem.

GetDropColumn

In the drag & drop mechanism, this method allows obtaining the column of the List Box control over which the element was dropped.

Refresh

It allows to repaint the Form control.

For example, after calling the LoadCustomColors method or modifying the value of the COSMOSVISUALMODE variable it will be necessary to execute this method (Frame.Refresh).

SetListAllRowsHeight

It allows to define the height in pixels of the rows of a List Box control. The height will be the same for all rows.

New properties and eventsTop

Auto Fit property

In the Bitmap controls, the image fits to the size of the control without deforming.

If the Form has the Resizing property checked, the Bitmap control the Auto Fit property, and the user modifies the size of the running window, the image will not be deformed, but will be adapted to the size of the control.

It has also been implemented in the Page class and in the templates (* .pag files) that use the prnpag32 dll.

VarLength property

The VarLength property has been implemented for Variable controls in reports of the Page class and in reports with the prnpag32.dll dll.

  1. In Page class.
    When you execute the GetProperty method of the Control class on a control of type "variable" of Page, it returns the length with which the control has been defined.
    Returns the value on a variable of type Smallint.

  2. In prnpag32.dll
    When executing the getPropInt function of the prnpag32.dll, passing it as a parameter the identifier of a "variable" control of a PAG file, it returns the length with which the control has been defined.

ChangeSize event

Event of the Form class that is thrown when the size of the window of a Form in execution is modified.

Environment variablesTop

 

If the variable is defined, Cosmos will ignore the zoom parameter of the PreviewEx method of the PrnDocument class.

This variable can be defined in the project configuration file, in the Cosmos file or with the PutEnv method of the Module class. Its value can be modified during the execution of the application using the PutEnv method.

Its possible values are: TRUE or YES and FALSE or NO.

NOTE: To obtain the zoom percentage value, the GetLastPreviewZoom method of the PrnDocument class is used.

Bug fixes of version 7.2Top

In this version, we have performed corrections in the following components: