All posts by rzaunere

Update for 7.1

Latest update for 7.1 has just been made available. This build works around a problem Clarion developers found on Windows 7 when the Alt Key was pressed. The problem reported was an apparent conflict with Windows 7 “Live Mail” or Outlook 2007. Both of these apps default to hiding the main menu and activating it upon pressing the Alt Key. The problem wasn’t unique to Clarion 7, the same conflict happens under Windows 7 with version 6 Clarion apps (and most likely prior versions too). We are testing a backport of the workaround for C6.3.x.

In the prior release we implemented code completion within the regular Embed Editor. In this release we have optimized the process so when working within the Embed Editor code generation of the procedure only occurs when something has changed that requires it, and the generated code is reused in the same edit session if possible.

We also tweaked a few things to make working with App based solutions and various version control systems a lot smoother. These changes mainly deal with detecting read-only files (Apps and Projects), and then shifting into a mode such that no merging occurs from the App generation process. Speaking of version control, we introduced a nice feature several builds ago; “Binary File auto-export/import”. What’s that? Well if you open Tools-Options-General you’ll see a node aptly named “Binary File auto-export/import”. On that tab you can specify individual Apps and DCTs (or entire folders if you have multiple Apps or DCTs), and whenever you are working with the named Apps or DCTs, an automatic export/import to TXA or DCTX format is executed in the background. This means when you open the App (or DCT) for editing the system looks for the TXA or DCTX format file and automatically imports it, and when you save the App or DCT the system exports your latest changes. Pretty slick and very useful.

The other notable change in this release is a change in how deleted controls affect embedded code attached to those controls. In this release whether you delete a control from within the Designer, or even from within the text editor when working with the window or report structure as text, any attached embed code will become orphaned (leaving it up to you to delete or preserve).

There are also several other changes and fixes, to see the entire change log click here

LastChanceHook

Geoff Thomson from Capesoft asked me about an example on how to override the RTL’s internal exception handler.   I think this is a topic that is likely of interest to many Clarion developers and warrants an example, so here we go.

Overview

PROP:LastChanceHook is a write-only SYSTEM property, which allows you to specify your own function that will be invoked if an exception occurs. The hook function allows you to display information about the exception and choose one of the following actions:

  • Continue execution of the thread where the exception occurred (unless the exception is fatal)
  • Stop the thread (or the entire process if the exception occurred in the main process thread) without invoking the RTL’s internal exception handler
  • Invoke the RTL’s internal exception handler

    This allows you to catch an exception, and if it is non-fatal you can allow your end users to continue executing your program even when an exception has occurred in one of its threads.


    How It Works

    Your function, which you assign to the SYSTEM{PROP:LastChanceHook} property has to have a prototype of:

    HookProc (*ICWExceptionInfo),LONG

    The ICWExceptionInfo parameter is an interface declared in CWEXCPT.INT which you’ll find in your .Libsrc folder.

    The result returned by the hooked function is evaluated as follows:

    • If the result is equal to Zero, the RTL executes its own internal exception handler dialog to show information about the exception and subsequently perform the action chosen by the end user.
    • If a Positive number is returned, the RTL stops the thread (or the entire process if the exception occurred in the main process thread) without invoking the RTL exception handler.
    • If a Negative number is returned, the program will try to continue from the point of the exception. Note, if the exception is non-continuable, this result is ignored and treated as equal to Zero.

    So in our example we start with this code:


    PROGRAM

    INCLUDE(‘CWEXCPT.INT’),ONCE

    MAP
    Test (LONG,LONG)
    Hook (*ICWExceptionInfo),LONG
    HEX (LONG),STRING,PRIVATE
    MODULE(”)
    MessageBox (UNSIGNED, CONST *CSTRING, CONST *CSTRING, UNSIGNED),SIGNED,PROC,PASCAL,NAME(‘MessageBoxA’)
    END

    END

    MB_ICONHAND EQUATE(00000010h)

    CODE
    SYSTEM{PROP:LastChanceHook} = ADDRESS (Hook)
    Test (10, 0)  ! causes an exception
    RETURN

    In this example the Procedure named “Hook” is assigned as our exception handler. That’s the only Procedure we are concerned with, the others are just there to help make the example work by 1) causing an exception and 2) informing the user about the exception. Next we have:


    ! ------------------------------------------------------------------------------

    Hook PROCEDURE (*ICWExceptionInfo info)

    S CSTRING(1024)
    Caption CSTRING(256)

    CODE
    IF info &= NULL
    RETURN 0
    END

    Caption = ‘Exception ‘ & HEX (info.ExceptionCode()) & ‘ at ‘ & HEX (info.ExceptionAddress())
    S = ‘Registers’ & |
    ‘<13,10>EAX=’ & HEX (info.Register (i386_Register:Reg32_EAX)) & |
    ‘ EBX=’ & HEX (info.Register (i386_Register:Reg32_EBX)) & |
    ‘ ECX=’ & HEX (info.Register (i386_Register:Reg32_ECX)) & |
    ‘ EDX=’ & HEX (info.Register (i386_Register:Reg32_EDX)) & |
    ‘<13,10>ESI=’ & HEX (info.Register (i386_Register:Reg32_ESI)) & |
    ‘ EDI=’ & HEX (info.Register (i386_Register:Reg32_EDI)) & |
    ‘ ESP=’ & HEX (info.Register (i386_Register:Reg32_ESP)) & |
    ‘ EBP=’ & HEX (info.Register (i386_Register:Reg32_EBP)) & |
    ‘<13,10,13,10>Current thread is being terminated’

    MessageBox (0, S, Caption, MB_ICONHAND)
    RETURN 1      ! a positive value signals the RTL to kill the thread

    ! ——————————————————————————

    Test PROCEDURE (LONG a, LONG b)

    CODE
    a %= b

    ! ——————————————————————————

    HEX PROCEDURE (LONG A)

    i UNSIGNED,AUTO
    S STRING(8),AUTO
    DIGITS STRING(‘0123456789ABCDEF’),STATIC

    CODE
    i = SIZE(S)

    LOOP WHILE i <> 0
    S [i] = DIGITS [BAND (A, 0Fh) + 1]
    A = BSHIFT (A, -4)
    i -= 1
    END

    RETURN S

    ! ——————————————————————————



    These first two lines of code assign our exception handler function and then call the Test procedure that raises an exception:

    SYSTEM{PROP:LastChanceHook} = ADDRESS (Hook)
    Test (10, 0)  ! causes an exception

    The exception is trapped and we show the result in a MessageBox which looks like this:

    customexception

    our Hook PROCEDURE (*ICWExceptionInfo info) uses the methods in the interface to show the exception code, its address, and the values of the registers at the time of the exception. And remember we said that:

    “If a Positive number is returned, the RTL stops the thread (or the entire process if the exception occurred in the main process thread) without invoking the RTL exception handler.”

    in our example our Hook PROCEDURE does a “RETURN 1” and since we are running on the main thread then immediately after the MessageBox is displayed and the user presses the OK button the program itself is terminated.

    In a future article we’ll show you how to easily display the callstack so that your end-user can tell you exactly which procedure caused the exception. And we’ll be adding an option to the templates so that you can do the same with a couple of mouse clicks. You can download the source code for this example from this link

    Update for Clarion 7.1

    Emails are going out with download instructions for the latest update to 7.1 (build 6755). There are lots of good fixes and changes, and I already blogged on the significant new feature of Code Completion in the Embed editor. The only other new feature is the addition of the “Properties toolbar’ in the Report Designer. To activate it go to Tools-Options-Report Structure Designer and turn on the ‘Show Properties Toolbar’ option. To see the entire change log click here

    Code Completion in the Embed Editor

    There was much gnashing of teeth over the fact that the plain Embed Editor didn’t implement Code Completion – well now the next 7.1.x update implements Code Completion in the Embed Editor. We are also looking at adding the support for Code Folding, which as of today isn’t supported in the Embed Editor, and Clarion devs have asked that we also provide code folding for Control Statements such as IF, CASE, LOOP, etc. and we’re looking into this too.

    In case you haven’t found this yet, you can define your own “folding regions” anywhere you like with this syntax:

    !region SomeDescriptiveText
    …….source code
    !endregion

    Check the Help file index for this topic: “Regions – Source Code” or just give it a try with the above syntax.

    Product downloads and access to Internal builds

    We’ve received some requests via email that have prompted us to start a new project this week; a secured website membership component. We have two goals to accomplish; first we’ll provide the ability to log in to our website and download products that you own, retrieve serial numbers for same, and get the newest updates to the Help files, and second you’ll be able to log in and have access to pre-release internal builds. We’ll make internal builds available for both Clarion 7 (Win32) and Clarion# (.Net). We have started the work on an implementation of a website membership project to be built on top of ASP.NET’s SQLmembership Provider with the UI built with AJAX. We’ll be using it to control the access to the product downloads and to the internal builds, and we’ll also be shipping the secured website membership component as source code with Clarion.Net (and of course we’ll be using it with the .Net App generator).

    Access to internal builds will be open to anyone with a current subscription. Once the project is launched we’ll initially try to make internal builds available on a bi-weekly basis (weekly builds are also a possibility). You’ll have access to the change log, and if you see a fix or a feature become available that’s important to you – you’ll have the option to download the corresponding internal build. And by the way, if there happens to be a change to the RTL or compiler that would require your 3rd party tools be rebuilt (this is a fairly rare occurrence), it’ll be duly noted in the change log.

    We’ll also be increasing the frequency of publishing maintenance releases (this too was requested in several emails), and we expect to make a new 7.1.x release available at the end of this week.

    Update ready for Clarion 7.1

    Emails are going out with download instructions for the latest update to 7.1.  There are lots of good fixes and changes, as well as some nice new features. I’ll talk about a few of the highlights.

    On the “Features” side we have implemented:

    FEATURE: If you double click on a File, Field or a Key in the Data Pad while a Text Editor is open, the File/Field/Key label will be pasted into the text editor

    – this one was a  sorely missed feature present in the Clarion 6 IDE – that we didn’t know was so popular, but now its back

    FEATURE: Template support to create/read/write INI and Data FILEs in specified CSIDL locations (ABC and Clarion chains)

    – this lets you easily adapt your application to UAC compliance, and its backed up with a very easy to use Class so you can easily use it throughout your application

    here’s a few screen shots from the template interface:

    csidl_ini3

    csidl_dataaccess3

    as you can see it’s very simple to use, with just a few clicks of the mouse you can choose to store INI or your Data Files in any of the CSIDL locations presented by the template (these are the Microsoft recommended locations) .  You can also choose to store the INI and Data Files in different CSIDL locations – it’s your choice.  The template and the supporting Class also make it very easy to choose any other CSIDL location, or any other Network location if that’s what you need.

    FEATURE: Added template support for theme to change based upon the OS theme in use

    – this is a new Menu style that at runtime matches the OS theme

    CHANGE: Optimize writes to the App recovery log
    CHANGE: A value of 0 for the auto-save limit disables the App recovery log

    – these two relate to a problem that some users had whereby writes to the automatic App recovery log were taking too long, now its optimized and we don’t think you’ll even notice it happening, but if you do, then you can now turn it off

    All told there are about 120 fixes/changes and features in this release, you can view the complete list here

    Clarion.Net updates

    We just released an update for Clarion#, the release features our new  LINQToFileProvider along with a few examples that should get you going pretty well.  We’ll post some documentation on the LINQToFileProvider here within a few days, but the examples are a good way to start getting familiar with this powerful tool.

    Also if you haven’t already done so – be sure to look at the Class Diagrammer.  Open any Solution select the Project node in the Solution Explorer and right-click to create the Class Diagram. You can use the Class Diagramer to create new class files or work with existing classes. From the design surface you can add fields,properties,events and methods, and a dbl-click on any element in the class opens the appropriate source file and positions to that element.

    The Class Diagramer is a great tool for when you are creating custom user controls, and is especially useful for the Compact Framework. Our CF Form Designer can work with asmmeta files created in MS VS and vice versa MS VS CF form designer now can use CF user controls created in our IDE. We also added a new file template CFDesignerTimeAttributes that allows using our CF custom user controls in the MS.

    The basic steps are:

    – create a CF User Control project
    – design the control in the Form Designer
    – add a new item to the project using the Compact Framework Design Time Attribute File  template
    – use the Class Diagrammer to add all required information about the control’s properties and events attributes
    – compile the project
    – Genasm will be launched automatically and an appropriate asmmeta will be generated.

    We’ll have a thorough tutorial on all this in the next update for the Clarion# By Example course. In the mean time explore it and see what it can do for your development.

    Happy New Year to all in the Clarion community!

    7.1 release is out

    Email notifications with download links for the 7.1 release are on their way.  Here are the few changes made after the pre-release:

    FIX: FILETIME and WIN32_FIND_DATA declared in the WINSOCK.INC file were renamed to avoid duplicate symbol errors; new names are FILETIMEW and WIN32_FIND_DATAW
    FIX: Greenbar effect didn’t work in ABC chain
    FIX: wrong version of HTML help templates were released
    FIX: PE install was missing files required for the Window Previewer
    CHANGE: add Rtar_src.tpw to PE installation

    The 7.1 add-on drivers (IMDD, DFD, IPDS) have already been released – contact sales if you didn’t get yours yet.

    Another topic of interest, some users really like the theming capabilities of the C7 menus, while others want a menu with no owner drawn items. We are looking into the possibility of allowing to switch between owner-drawn menu items and standard menu items, we’ll keep you posted on that. We also already have a handful of additional changes in testing now for the next update to 7.1 and we expect to make the next update available in the beginning of January.

    We’ll be working hard to get an update out for Clarion.Net before the Christmas break.  If it doesn’t make it out, then it will be first priority right after the New Year begins.

    7.1 Pre-release on its way to you

    Small adjustment to the release plan; we targeted the 7.1 release for today 12/18, but yesterday we fixed two bugs in the window library and the QA team requires 2 full days to redo the regression test suite. We realize there are a lot of folks very eager to get their hands on the new release, and rather then make you wait until late Monday or possibly Tuesday, we’re making 7.1 available today to all subscription holders as a “pre-release”. If no regressions are found the pre-release will in fact become the official release.

    Another good reason for letting the release out today; all 3rd party blackbox products must be rebuilt with the 7.1 compiler, so this pre-release will give those vendors a headstart on doing so.

    In another post I received a comment about this item in the release notes; “CHANGE: FILEs declared within a Procedure are now Private data to that Procedure”, and I promised to provide some further details about that change.

    The linker has been improved in 7.1, whereas in every prior release going back to earliest Clarion compiler/linker, reporting of “duplicate symbol” by the linker was dependent upon the order of files in the link list. Meaning that the absence of “duplicate symbol” errors did not necessarily mean that all was OK. When this problem was exposed and fixed, it immediately uncovered two previously “hidden” problems in some of the libsrc code we ship, and exposed some problems in 3rd party products used in our regression testing, and we do expect that a few of you will find your own “hidden” problems when you rebuild with 7.1.

    How about an example of the type of problem the 7.1 linker will now catch? OK.  Assume that there are 2 very different procedures but with the exact same public name in 2 different Member modules. Nothing can be done by the linker to allow them both, but the old linker could miss that error dependent upon the order of source files and presence of resource files in the link list. The solution for this type of error is easy, one of the procedures can be renamed, or the PRIVATE attribute could be added to their prototypes. In general, it’s better to use the PRIVATE attribute for all procedures and data objects local to a member module, unless they are exported or used in other modules.  If you do run into an unexpected duplicate symbol error, don’t panic, its easy to fix and will make for a better product.

    We’ve taken your suggestions and your feature requests and delivered on them with 7.1; from the ultra-small things like changing toolbar icons, to the big things like the new functionality in the property grid, the new window previewer, automatic App saving and recovery functionality, Windows 7 manifest support in the linker/templates, a new Report Writer, ….. well its a very long list of improvements which I won’t repeat right now.

    7.1 is a fantastic update; more reliable, more stable, and more fully-featured then any other Clarion release, and we’re sure you’ll love it.

    Release update

    The day before Thanksgiving I posted about the upcoming release of 7.1 (and the next update for Clarion.Net), and I wrote that we expected to make it within 2 weeks.  In that same post I mentioned we’d be closed for a long (for us) 4 day break over the holiday.  Well it seems some people took that 2 weeks literally to mean 14 consecutive days, and not the next 2 working weeks. Ahem, even our developers take a day off now and then… 🙂

    We are in final closedown for the 7.1 release, we planned to have it ready by this Friday (and that would be within the 2 working weeks!), but there is a chance it’ll have to go out on the following week. Why?  Well there were a few “hot topics” brought to our attention last week and we decided to tackle 2 of them. So if you don’t get a notification of the 7.1 release this Friday, just relax over the weekend and look forward to getting 7.1 early next week. The same applies for the Clarion.Net release!

    Here is what we’ve been working on these last 2 weeks, and indeed some of these items did consume a bit of extra time (the first 2 items were the “hot topics” I was referring to)

    WORKAROUND: The OS could position some Menu items outside the screen boundary if there were sufficient number of items to cause a multi-column overflow
    FEATURE: You can now set if the Copy Referenced Dlls to Output Directory defaults to On or Off via the Tools/Options/Clarion/General tab
    FEATURE: The PRIVATE attribute is now allowed for TYPE declarations

    CHANGE:  Better error message when an included project cannot be found during a make
    CHANGE:  When you associate the C7 IDE with .app files, the .app files now get an appropriate icon displayed in Windows
    CHANGE: FILEs declared within a Procedure are now Private data to that Procedure
    CHANGE: Menu style now takes into account dimensions of particular item defined in MENU/MENUBAR declaration or set at run time (in latter case PROP:NoWidth and/or PROP:NoHeight must be set to FALSE)
    CHANGE: Post a warning if window/report parser changed some control definition because a variable used as a attribute’s parameter does not exist anymore
    CHANGE: Warning if PRIVATE and PROTECTED are used incorrectly
    CHANGE: private queue types in abfile.clw are now marked private to take advantage of the updated clw compiler and reduce the number of duplicate symbols possible
    CHANGE: renamed internal class used in the Query control QEIPManager to QueryQEIPManager because it was duplicated with the public method with the same name.

    FIX:  %ApplicationExternalLibrary was returning the wrong value if you edited the project properties of an app, but did not set the model (ie left it at the default value of dll)
    FIX:  An exception would be thrown by the data pad if you copied a field and then tried to paste it into an empty local data list
    FIX:  Not all compilers were registered if you created a new C6 version
    FIX:  The Data pad could throw an exception if you tried to add a Queue to local data
    FIX: Aboop.tpw: Incorrect declaration of a variable for the return value was generated if the procedure return type in the prototype was ? or *?
    FIX: Avoid auto-#RELEASE on emitting unconditional source lines
    FIX: Setting of PROP:NoHeight and PROP:NoWidth properties for menu items worked not as documented.
    FIX: Source Editor – Search/Replace would fail for various conditions
    FIX: The ISAM file imports would not work if you had a file with a . in the name.

    PTSS 32051: Suppress Windows internal repainting of the button upon changing its text
    PTSS 33701: Clarioncl would some times fail to register templates if multiple /tr switches where supplied on the command line
    PTSS 33804: Lookup table must be updated first before record validation
    PTSS 34190: GROUP and OPTION controls cannot be selected themselves but they provide defaults for selected text and background colors to nested controls
    PTSS 34226: Current build configuration was not being passed so the %ApplicationDebug symbol was not setup correctly
    PTSS 34563: Show warning if WINDOW with TOOLBOX/DOCK/DOCKED attributes has the MDI attribute too
    PTSS 34600: Changing of variable name in the Data Pad was not reflected in changes to attributes of WINDOW/REPORT controls using that variable as a parameter
    PTSS 34605: The window previewer would not work with ENTRY controls that had @P or @K pictures
    PTSS 34631: Designers might not be available in plain embed editor
    PTSS 34643: Implementation of drawing of themed borders for RTF controls