Comments
Richard Davies wrote: The UK has a good crop of technology pioneers in cloud computing - for example ElasticHosts, FlexiScale, Flexiant, OnApp - and also some strong government initiatives such as G-Cloud. We will have to see whether this kind of technical leadership converts into swift mass-market adoption or not.
Cloud Computing
Conference & Expo
November 2-4, 2009 NYC
Register Today and SAVE !..
SYS-CON.TV
Today's Top SOA Links


Slick Tricks
Slick Tricks

Setting Column Attributes at Runtime
If you want your DataWindows to look consistent, you have two basic choices. The first one - always code the DataWindow expressions the same in all your DataWindows. However, there are drawbacks to this: you have to make sure your entire development team is aware of the standards, and you have to have methods to ensure their use and document the standards for future developers. In spite of such precautions, it's likely your DataWindows will stray from the standards you've set up. The second and better approach is to put the standards in your base DataWindow. Randy Howie of the American Skiing Company has done this with a function to set the protection and background mode on DataWindow columns at runtime. His function takes two arguments, as_columnName and as_expressions. The expression is the same kind you would use in the DataWindow column. For example, if you wanted to prevent users from modifying the last name of an employee in department 100, you would put the following expression on the emp_lname column for protection: if (dept_id = 100 , 0, 1). Since it's a good idea to give the user visual clues, you might also want to set the background.color to something like "silver" if the field isn't editable. You'd then need an additional statement for the color attribute such as: if (dept_id = 100, 12632256,rgb[255,255,255]) which would make the column silver or white.

The good thing about doing this in a function, of course, is that if you decide to change the color scheme later on, you have to change the code in only one place. Randy's code sets the protection of the column and the background.mode (transparency) property. The function (see Listing 1) first attempts to set the background mode. If it succeeds, it then proceeds to set the protection property. Clearly you can modify this function to set other properties to create a consistent "object-oriented" look to your DataWindows.

Listing 2 shows some sample calls to the function.

Randy Howie is a technical manager at American Skiing Company. He can be reached at rhowie@steamboat-ski.com

In order to post a comment you need to be registered and logged in.

Register | Sign-in

Reader Feedback: Page 1 of 1

Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021

SYS-CON Featured Whitepapers
ADS BY GOOGLE