Friday, December 23, 2011

parameter handling and better code generation (Build 432)

GuineuIDE now correctly converts some of the built-in properties. Visual FoxPro uses lower case properties for all user-defined properties (ignoring _MemberData for the moment). Sometimes, however, those properties are stored in all upper-case. Guineu correctly identifies those as user-defined properties now.

Constants defined in the VCX or SCX include file are evaluated at compile time now. When you rebuild an existing project make sure to select Guineu > Clean up project name from the menu to force Guineu to rebuild all project files.

PRIVATE variables can be defined and are created in a truly private fashion. Undeclared variables are now PRIVATE, just like in Visual FoxPro. Missing variables raise an error message except when being assigned to. PARAMETERS creates private variables whereas LPARAMETERS is responsible for creating local variables.

Parameters can now be passed by value or by reference. Call the PARAMETERS() function to determine the number of parameters.

Some commands in Visual FoxPro are not relevant during program execution. EXTERNAL is a good example and is now supported by Guineu. Just like in the Visual FoxPro runtime this command does absolutely nothing. Previously, though, having the command in the code would raise a compiler error in Guineu due to an unknown token.

Code lines containing macro substitutions (& command) do not cause an error anymore. Currently, they are skipped at runtime since there's no tokenizer being part of Guineu.

Thursday, December 15, 2011

Changing the color of grid headers (Build 428)

Guineu Mobile implements BackColor and ForeColor for Header objects. Due to the (severe) limitations of the DataGrid control in the Compact Framework all headers must have the same settings for these properties. Guineu uses the setting in the last column to define the appearance of all headers.

There are also minor bugfixes in the STREXTRACT() function and the Listbox control.

Monday, December 12, 2011

.NET objects now First-class citizens in Guineu (build 426)

The most wanted features in Guineu were frequently ones that don't even exist in Visual FoxPro, such as making HTTP request, transferring files via FTP, placing phone calls, having a signature control, and so forth. Many of these made it into Guineu in form of a SYS(8xxx) function or a new base class that can be enabled.

Some of these features are still lacking such as accessing a bluetooth or serial printer, retrieving GPS information, obtaining phone book entries and text messages, and much more. Quite often there's sample code for C# or VB.NET for the Microsoft Compact Framework. Yet, often it's only few who request a particular feature. That makes it particular difficult to implement a solution that covers not only those developers particular needs, but also the needs of others in future scenarios.

This release is a major step forward!

We now support .NET objects in the same manner as native objects. The philosophy behind Guineu has always been to keep the look and feel of Visual FoxPro. Therefore you use .NET objects exactly like you would use native objects in Guineu or ActiveX controls in Visual FoxPro. There are no new commands or functions as the next sample demonstrates:

Local loForm, loButton
If Os(6) == "3"  && Windows CE
Set Classlib To \Windows\GAC_System.Windows.Forms_v2_0_0_0_cneutral_1.dll
Else             && Windows 9x, Windows NT
Set Classlib To C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll
EndIf
loForm = CreateObject("System.Windows.Forms.Form")
loForm.Text = "Hello"
loButton = CreateObject("System.Windows.Forms.Button")
loButton.Text = "World"
loForm.Controls.Add (m.loButton)
loForm.ShowDialog()

The SET CLASSLIB command now works for VCX, PRG and DLL files. CREATEOBJECT() searches .NET classes at the same time as searching for Guineu classes. You can access properties and call methods on .NET objects as you can do in Guineu objects. 

To load a DLL you need to pass the path to the DLL unless it is in the Windows search path. Please note that SET PATH TO is ignored, because Windows is in charge of loading the DLL. As with FLL libraries in Visual FoxPro you cannot embed these DLLs into the application.

On Windows Mobile it's a bit difficult to determine the actual location of the DLL file. By default, File Explorer hides any DLL and loading the Windows directory on a device can take some time. To find the file you can use the ADIR() function using a little Guineu program to list all installed GAC*.DLL files.

Limitations

This is version one. There are naturally a number of things that don't yet work, some easy to fix, some more difficult.

NEWOBJECT() cannot load .NET objects yet. Adding a .NET control to an existing control also doesn't work. Guineu will always use the parameterless default constructor. Binding to events is not yet possible.

Guineu performs an automatic type cast based on the values you pass in. If there are multiple competing overloads of a method, you might not get the correct one. Similar, return values might be casted to objects when you expect them to be simple data types. This is especially an issue with Enumerations. CAST() does not support any of the native types. In fact, CAST() isn't even in the product yet.

Only public instance members are available. Static methods and private properties are not accessible. GETINTERFACE() doesn't work yet, nor does FOR EACH pick up the IEnumerable interface.

New features


The OS() function implements values 1-6 now. OS(6) returns the platform. This is 1 for Windows 9x, 2 for any Windows NT based system (NT, 2000, XP and later), and 3 for Windows mobile.


Bugfixes


Repeatedly executing CREATE CURSOR would open a further cursor with the same alias.

ADIR() returned the wrong number of entries and wouldn't indicate directories.

SYS(2015) would not return a new value every call.

Builds 415-425

Since build 414 we made a number of changes, but I haven't been able to keep updating the blog. In this post I'll collect all those changes we made since January last year. Check back regularly, as I'll keep updating this post.

New features

STRCONV() is implemented with two new encodings. Values 17 and 18 provide a conversion between regular strings and URL encoded values ("A B" becomes "A%20B"). You need this with SYS(8009) to post back HTML forms to a web server.

SYS(8004) supports the "mssql" engine. Activating this engine switches to the regular SQL server client on mobile devices for SQLSTRINGCONNECT(). With this engine you can connect to a regular SQL server from any mobile devices. For data intensive processes this is a better solution than accessing DBF files across a WiFi.

GuineuIDE detects parameters to the Init event of an SCX form and produces the code to receive those in the generated PRG file and pass them on. This feature is a little fragile right now and only works for simply LPARAMETERS statements. Please report any code that doesn't pick up the parameter line. You might have to manually delete the *.scx.prg/fxp files to force GuineuIDE to regenerate the file.

APPEND supports the IN and BLANK clauses now.

MKDIR is now supported on the desktop and on the mobile platform.

Added support for Date, DateTime and Boolean fields to CREATE CURSOR.

Changes

We changed a number of file names to cope with a number of new supported platforms. Guineu.exe is now Guineu.Desktop.EXE, Guineu.runtime.dll has become Guineu.Runtime.Desktop.dll. Guineu.compact.runtime.dll is Guineu.Runtime.Mobile.dll. We dropped guineu.compact.exe completely, since it caused confusion about the proper way of creating a mobile application.

To use the new runtime version you have to rebuild your EXE using GuineuIDE.

Guineu detects when it's running in an emulator. When features aren't supported in the emulator, Guineu does not attempt to call them. This applies mainly to non-standard hardware.

Bug fixes

Sometimes Guineu would raise an error message referring to the record source being NULL.

Index files were kept open even when the table was closed. This made it impossible to delete the CDX file unless the application was closed.

Fixed crash when a class in a separate VCX or a procedure file was instantiated.

When a function or method returned a NULL string Guineu would sometimes crash when the result would be used in conjunction with the = or == operator.

Umlauts in procedure names no longer cause a crash.

Downloading binary files with SYS(8009) caused data corruption, mainly with DBF and CDX files. This has been corrected.

Added support for NULL values in cursors other than character fields.

COPY FILE handles subdirectories correctly now.

Known issues

Should you encounter an error message when launching the EXE on the device, please create a text file in the same directory as your application with the addition ".config". If your application is "myapp.exe", the file needs to be "myapp.exe.config". Put the following code into the config file:
<?xml version="1.0"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="OpenNETCF" publicKeyToken="E60DBEA84BB431B7" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.3.0.39" newVersion="2.3.0.39"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

This was necessary due to an updated DLL. We are working on this issue. In future builds you do not have to create this config file.

Tuesday, January 26, 2010

Build 414

I just noticed that the past releases contained an older version of GuineuIDE.EXE without the fixes for the DO FORM problem some of you encountered. The new build contains the correct version. To benefit from the fixed generated code, you either have to modify the form (just changing the time stamp is sufficient) or delete the *.SCX.PRG files. Otherwise GuineuIDE won't regenerate the files.

Monday, November 30, 2009

Builds 390 - 412

I'll update this blog entry to collect all changes that have been implemented within the past few months. The past month's activity on the release blog doesn't do justice to the development of Guineu. There have been a number of changes.

Build 412 introduces the SelStart and SelLength properties for the Editbox control.

Build 405 adds the SET PROCEDURE TO and SET CLASSLIB TO command. This makes it easier to create more complex applications. Additionally, GuineuIDE handles controls correctly that are stored in a class library. With this release you might have to delete the generated .SCX.PRG files in order to regenerate those using the latest version of GuineuIDE. Starting with build 405 you can create your own VCX class libraries and use those classes on different forms.

Build 403 includes the Timer control. Available properties are Enabled and Interval. Timers raise the Init and Timer events.

SYS(8015) is new in build 402. This function adds SMTP capabilities to Guineu. To send an e-mail from the device you can use the following one liner:

Sys(8015, ;
"from@server.com", ;
"to@server.com", ;
"smtp.server.com","username","password", ;
"Subject", ;"Body" ;
)

You need internet connectivity on the device in order to send mails. Sending mails can be an alternative to printing a receipt.

Devices behave differently when you press the Enter key while the focus is on a button. Some devices trigger the Click event, some don't. Build 400 adds SYS(8014) to control this behavior. To explicitly call the Click event when Enter is pressed, use the following option:

SYS(8014,"ButtonClickOnEnter",1)

You revert to the device's default behavior by using this line:

SYS(8014,"ButtonClickOnEnter",0)

Build 395 adds the LOOP command. It works on all three supported loop types: FOR, DO WHILE and SCAN. SCATTER and GATHER have been extended in the same build. In addition to the NAME clause, they now support the MEMVAR and MEMO keywords.

Saturday, July 25, 2009

Build 389


SYS(8012) for controlling the Software-based Input Panel has been in the product for the past few weeks, but not been documented at all. The latest build mainly brings the documentation on par with the product, at least as far as the SIP is concerned. You find a detailed description of SYS(8012) on http://guineu.net/help/index.html?sys8012___software_based_input_panel.htm.