Update 19th March 2013 – New screenshot from George

JP from DMC posted some screenshots to the newsgroup over the weekend showing off his latest UI enhancements using the ClarionMetroWizard classes. Nice work JP, looking great!

Look what Brahn’s help can do for our apps ….

wow!!!

Wizard form with next and previous buttons …..

MERCI Brahn – excellent work you did there

DMC Settings Used without tab/sheet on message windows. Revamped Capesoft SendTo!

George has also kindly shared his initial experiment (with more on the way!):

Looking good George!

It is exciting to see some discussion going on about UI. I wanted to join the party with some of my own examples 🙂

My favourite skin/highlights combination. Getting a little creative now... Or just a wee bit funky :)

This is the "full" form connected to the wizard for comparison.

 

If you have anything to share let me know and I will update this post with more examples as they come in!

-brahn

A while back I posted a short video of the Booking Wizard I was working on for a client (follow the link for some of the original screenshots, twitter announcements, etc).

Finally there has been the time and the need to make this into a class. The code is up on GitHub and as soon as I post this article I have to start actually implementing the class into the real project so you probably wont see me for a few days 🙂

I would love to hear what you think and what you end up doing with the code. Feel free to fork the project and contribute back any changes you make too…

Design Time View Run time view!

Built in themesOther features

 

Go take a look at the ClarionMetroWizard GitHub Repo !

Oh, and for the impatient.. try the pre-compiled demo!

Something about LibMaker I forgot to mention.
The libmaker source that ships with Clarion has a couple of problems with “Unmanaged Exports” DLLs. It only works with short filenames and it prefixes the labels with a “\”. These can be easily fixed in the source of LibMaker but I have created a compiled fixed version that should do the job.
Alternatively use the LoadLibrary API to dynamically load the DLL http://www.clarionmag.com/search/find?searchTerm=author%3Asand+loadlib  (sub required).

What?

ClarionMag article –Mixing Clarion with .NET, Part 1

“To call any .NET procedure from Clarion, you have a few choices. You can expose any .NET class to COM, which makes it visible to any COM client. Once you’ve done that, you can either use Clarion’s OLE control or write some Clarion wrapper classes.” “You can also make a Managed C++ wrapper, which is stored inside your .NET assembly. You then call this wrapper the same way you would call an API function.”

Robert Giesecke – C# Project Template for Unmanaged ExportsVisual Studio C# Project Template to “export managed code to native applications without the need of COM registrations”

And finally, a similar technique using Clarion# – http://clarionsharp.com/blog/2011/05/clarion-net-update-2/

Why?

Using .net allows you to tap into the vast amount of examples and libraries available in the .net world to help you create solutions. There is significantly less need to try and take a C++ or C# example and translate it to clarion code and API calls when you can just wrap up the functionality you need in .net and call it from clarion.

Unless you need to embed .net user controls in a clarion window I cannot see any reason not to use the DLLExport technique. It has the advantage that you don’t need to register the .net assembly using regasm.exe and is likely much faster to execute.

Color picker example

This example uses the Zeta Color Editor from an article on The Code Project website. The same editor is used in my InsertClarionColor addin.

ColorPicker.zip – Clarion 8 and Visual studio C# solutions. (one day I will move it to GitHub!)

  1. Create a C# project using the Unmanaged Exports template in visual studio
  2. Export a method that can be called by clarion which handles the calling of the editor dialog
  3. Create a clarion friendly lib file from the .net dll
  4. Create a clarion project to use the dll!

I had been using the C# Project Template for Unmanaged Exports quite a lot and while upgrading a project to VS 2012 I noticed that it is now available as a nuget package. There is only one catch… make sure your project has a specific CPU target set. It took me a little while to work that one out, otherwise the nuget package works perfectly. Go get it and start integrating .NET with your Clarion projects now!! Smile

I was playing with this technique a lot over the past few weeks. There is a lot of work coming up to integrate clarion with .Net components and if there was a way to do so without having to register them using regasm before they could be used that would be really, really awesome.

See the thread “COM Gurus – Need some help & advice” on comp.lang.clarion newsgroup for some further discussion.

Long story short, I was able to get it partly working. With the right manifest you can use a COM object from clarion just fine without registration. Unfortunately this does not extend to placing user controls in a Clarion OLE control which is pretty much all I was after.

Clarion calling .Net COM reg-free!

 

All is not lost, I think there are still a few ways this could be achieved but for now I have had to shelve the project in deference to more financially immediate concerns… such as you know, paid work Smile

See the repo I created on GitHub for an example project, more information and some links to where I think it could go next – https://github.com/fushnisoft/ClarionRegFreeCOM

-brahn