Carlos Roque Code Hints, Examples and more

25Jul/112

Making WPF CheckBox and RadioButton display correctly in Windows classic theme

When developing a wpf app for work I ran into a display problem for the CheckBox and RadioButton. Most of our office computers still use windows XP with the classic theme and even the new Windows 7 computers are set to use the classic theme as well.

Originally,  I wrote my RadioButton and CheckBox like so

<RadioButton Style="{StaticResource myRadio}" 
Name="radioButton1" GroupName="someGroup" Content="Option 1" />

As you can see the "Content"  part is what determined my label for the defined RadioButton, and here is where the problem is. I am not sure why but the Classic theme in windows can't render this properly causing the entire control to be inaccessible.

To fix this problem we need to remove "content" and link a label to the control. This is quite simple to do as you can see as follows:


<RadioButton Style="{StaticResource myRadio}" GroupName="someGroup" Name="radioButton1">
<Label>Option 1</Label>
</RadioButton>

I would like to know more why this is a problem on the classic theme but right now this workaround works great across all OS's and themes

Filed under: C#, WPF 2 Comments
22Jul/110

cmds files in DP2 – creating a simple order

If you want to get your feet wet with KPL, cmds files are the easiest way to get started. Cmds stands for commands, there are many uses for these files but the most important in my opinion is the import of photo orders from other applications. To be able to use cmds files we first  we need to enable a hot folder in DP2, the steps are as follows:

  1. On the User Tasks Menu Click on categories under you see the menu option Import
  2. Click Import and look for Commands
  3. Click Commands
  4. A new window opens, select a directory (preferably one that is easy accessible for your application)
  5. click Start
22Jul/116

What is KPL and how it relates to DP2?

KPL (Kodak Professional Language) is the underlying language that drives the DP2 Photo Lab production software. It is based on the C programming language family and it allows developers access to a lot of C methods and windows API's. The language has been greatly expanded from it's C roots to include features that are tailored to the photo production world.

The best way to understand this is to imagine DP2 as being a Runtime Environment in which KPL is Executed. The entire DP2 User interface and Underpinnings are implemented using KPL. Since KPL is an interpreted language, changes to DP2 do not require recompiling and can be done pretty much live.  Even thought documentation is limited, the fact that you can see all the code that is used to do everything in DP2, makes it easy to learn what does what. DP2 has a very powerful Programmer's Assistant tool and Debugger. There is also integration with Notepad++ for syntax highlighting also integration with the plugging snippets plus adds snippets and auto completion.

DP2 is a database driven application so naturally KPL has amazing tools for reading and writing data to the database. For what I have seen KPL is an Object Oriented Language, there is a long list of classes but most of the scripting that a user will be doing is based on the use of functions.

There is a great number of built-in functions for managing orders, images, packages and other production related work. Also, since Version 14 there is a very powerful Hooks system to alter the interface without having to change core DP2 files, this is a great way to avoid having your code being wiped out when a new version is installed.

There is a lot more to be said about KPL and DP2, you can create UIs using Html, JS and CSS, there is a built in Web server for receiving commands and there is also way to insert KPL scripts from other applications through the use of a hotfolder. There is robust printer integration, great queue management and print job organization. I will be talking more about this things on future articles as I work and discover more on the matter.

It is also important to note that the programming team at Kodak is filled with great, helpful people that will answer most of your questions almost immediately over email. And most of the changes in DP2 are driven by customer feedback.