PermaLink Changing Icons programatically-SNTT07/20/2006 04:19 PM
I've been feeling a little guilty not sharing for the SNTT (Show 'n Tell Thursdays),  because I know that I have plenty to share, but, I have not wanted to take the time to make the presentation perfect so,  I have shared nothing.  Im going to share this anyway, even though its not polished.

Back in the R4 and R5 days I was on several projects that required me to dive deap into the Lotus Notes API to accomplish things that really were not possible or at least very difficult to do without Lotus Notes API.

Initially I build EXE's then as my experience grew I created LotusScript declares for each of the API Calls.   Initially I built custom agents for each function that I needed and things were fine.   Over time however, I used the same functions over and over again, so I moved some stuff to script libraries.   Over more time, I updated the script libraries, then I started to get regression bugs, or untested functions.

As the result I came up with the technique that I use here.   Whever I am "done" with a scriptlibrary, I save the LSS out to the file system and create a unque name for it.  Then use an "Include" inside my lotusscript instead of a "use"   This allows me to track the last version that successfully ran, while still adding new features.   Each time I make a revision, I created a new LSS file and increment the number within the file name and all old code that might not be compatible with the New lss will still run uneffecected.  When IBM included the function "Implode" into lotusscript in R6, I had to upgrade my libaries because I had a function called "implode" already.  The way that I addressed this issue was to create my own function called ImplodeSTR, instead of implode,  which will still work on older version of notes as well as newer versions.  But, I didn't want to force the upgrade of all my old R5 code immediately, I would upgrade each piece of code when I came around to it next.  (The code just would not run in R6 until the code upgrade).  Some of the code that was using my scripts were installed at clients that did not have maintenance contracts, so I didn't even have access to fix the version compatibilty issue if I wanted to, but, I expected them to be calling for upgrades when they wanted to use the R5 code in an R6 environment.

So in the file common06.lss there is a function called implode and in the file common07.lss it was renamed to implodeSTR and inside common08.lss, I have a comment at the bottom.

'**** 06/16/04 13:36
'Renamed Implode to ImplodeSTR for R6 compatabiltiy
'**** 06/16/04 13:36

OK, so enough history, here is the show n tell

I had a project that had somewhere in the neighborhood of 10 databases associated with it, each database had a template (10 more icons, totalling 20 per set)  each set had production, development and test and in the group that I was participating in, we had labels on the icons to indicate which database we were in, so there was a "T" in some icons to indicate template, All icons had either "PROD", "DEV" or "TEST" on the icon, someone on the team decided it was nessicary to change the icon (which meant 60 icon changes, don't ask me why)

I already had libraries able to grab a the ICON note out of the database and parse a binary object, change and update it, so I put together a class call the "APIICON" class,  What that class does it read in an icon note, parse throught them memory object where the bitmap is stored and place that into a 2 dimentional array for both the color and the transparency of the icon.

As the result, a programmer can set a property like:

Icon.Color(RowCount,ColCount) = Color

and

Icon.Transparent(RowCount,ColCount) =1

then follow up with        

Call icon.save()

I've not cleaned this up very much, but, I've included each of my LSS files in a zip file below.



Much of what is in the code was built for R4 & R5, so, a lot of it is no-longer needed in R7, but, its still in there because there was no driving force to remove it.

If you are intersted in seeing the code, here are all of my LSS files, my system is setup to have all of my LSS files in a directory call c:\dwightlss   There are many, many functions not being used within this example "RemoveIconColor02.lss" is the start point.

dwightlss.zip

If you are just interested in seeing it work, download the NSF, it has all of the LSS files imported into a single agent, it's hard to read the code and most of it won't make sense to read the code, but, it will run without the build hassle.

RemoveIconColor.zip        

Comments :v
No comments.
Add Manual Trackback
Please enter the details of the trackback post. Your trackback will not appear on the site until it has been verified. This won't be immediate, as trackbacks are validated on a scheduled basis. Be patient.











Powered By :

BlogSphere

Join The WebLog Revolution at BlogSphere.net

Dwight Pic
Hot Links
These are my heavy hitters
MSDN DHTML Objects
MSDN JScript

Contact Me
Left Block 3
Monthly Archive
Todays Referrers
No Referrals
RSS News Feed RSS Comments Feed Geo URL Blog Admin OpenNTF BlogSphere