Dev-Picayune

picayune: of little value or importance

Archive for January, 2004

Brandon’s Checkers Program

Well, after a little bit of aggrevation, mostly stupidy on my part, I got Brandon’s Checkers Program to run under Linux. Surprise, surprise, it looks absolutely identical (except for the window border and standard controls) to running it under Windows. It was fun running the same code from a different operating system without recompiling, even if I wasn’t the one who wrote it. I did manage to run my solution to the triangle peg game successfully but that just isn’t impressive since there is no GUI.

No comments

Knoppix

In my continuing search for an easy way to run Linux, I found Knoppix Linux which allows you to run a complete graphical and fully functioning version of Linux from a CD. This is a great way to get a feel for it without the commitment of actually installing it on a hard drive. Plus, if you like it, you can actually install it onto a hard drive. The only problem I am having is with the network card not working correctly. The sound, video, etc… all work great. It even has the latest Python version on it (although it lacks wxPython). There is also supposedly a way to store configuration files on a USB or floppy drive, although I haven’t figured that out completely.

No comments

CFCopy Begins

Major thumbs up again to wxWindows. I have started on a new temporary project to get some of my energy back. I need a utility to copy image files off of my compact flash cards via my high speed USB 2 reader. I can use explorer since it is just a drive letter in the system but I want it to do like the camera’s software does and have it put each file in a subdirectory named after the date the file was created on. So the utility needed to recurse through all subdirectories on the card, find all files and then based on the date of the file, put it in a subdirectory off of a root subdirectory that is supplied (creating the directory if necessary). So far so good, I have the first tab, it copies files, creates subdirectories, disables the selection options while copying, uses a timer event for copying machine friendly, updates the progress bars, shows the file names as they are being copied.

The big thumbs up goes for wxPython (wxWindows) in that nearly all controls are Windows XP themeable… which is something that is not even true for .NET unless you set all controls to FLAT mode SYSTEM and issue a special call at the beginning of the program. wxPython is themed appropriately out of the box. That is why you see the unusual window design… it is my current XP theme.

No comments

My New Idea - Port-a-blog

After seeing a reference to wxBlogger on the wxWindows home page, I had a new idea that combines several concepts. A blog maintaining program that is designed to be run and to fit on a small USB thumb/jump/whatever drive. So essentially on a tiny little memory device (that apparently due to personal experience is able to survive being run through a regular clothes washer cycle) you can have the full historical and current contents of your blog, the mechanism to edit it, and the mechanism to update it. Ideally, the software would be cross-platform as well in case it needed to be run on a Linux box. However, I suspect I will use wxPython which would imply that it would need to be installed as well. If I were truly daring, I would choose the default Tk based GUI for Python instead to make it more flexible in that regard. Another option would be to use Java or Jython or something like that for this project. We’ll see. If I get excited enough about it, I may have to set my floundering Nevada project on hold for awhile.

No comments

Opacity on Controls

Great now via an arcticle at AddressOf.com I can create some custom controls where I can control the opacity of each control. I did want to do that. However, I want to control the opacity of the background form separate from the controls. My theory is that if you really knew what you were doing you could do so freaky stuff with the paint event for the window to paint the background with opacity but not the controls. I’m obviously not 100% on that… but it seems like something like that should work.

No comments

A Link Back To Myself

You know you’re in trouble when you find your own question as one of the top hits in Google Search: opacity of just background c# for the question you are researching. So it literally feels like I am going in circles. Once again, as it turns out, the transparent form stuff is quite limited and as soon as start working with images you find that transaparency no longer works correctly… you end up with images with funky colored backgrounds in the middle of a transparent window. Not a useful or pleasing effect.

No comments

Variable Opacity and Alpha-Blending

Somewhat inspired and somewhat depressed looking at the previously mentioned MobyDock, I happened upon this article about the transparency key and background color. This actually appears to work under a 32-bit color environment unlike some other things I have tried. I’m not sure if it is the fact that the frame is still there or not… but it is rather amusing to look at. Of all the things about MobyDock that I like is the ability to set a semi-transparent background and completely solid icons. This seems to give a VERY pleasing effect that stays consistent with the background and color scheme selected. Currently my only thought for making this work though would be have two windows (separate threads) where the bottom window does very little except be alpha-blended at some level (50%) and the top window is completely transparent on its background and only has icons on it positioned exactly at the same spot as the bottom window. I fear the threading would be a nightmare though.

No comments

Mobydock Also Supports Skins

Crap… you can skin Mobydock and quite easily since it took all of 3 minutes to create my own. Basically all you provide a single background image, a separator image and two .ini files to indicate what is going on with each image. It then just stretches the images to suite its needs. You can also specify alpha blending levels for both the background and the icons separately. Thus, you can have essentially a completely transparent background but completely opaque icons. Very nice looking. Without going to directX for this stuff, I am not sure how much I can really do with the languages I know. Argh!

No comments

Modydock Sinks My Ship

Okay, I was feeling pretty good about the way things were going with the toolbar until I saw the following item: Mobydock. I reluctantly downloaded it. Now I am humbled. You have to have DirectX 9 to use the bar which tells you right away he’s doing some freaky cool stuff. I did go through a spell with it GPF’ing on me but overall it is amazing. The animation is great. I especially am amazed at the thumbnail preview of the web page when you have either IE or Firebird minimized. Even if you don’t launch a program via the bar it still knows you launched it anyway and marks the icon with an arrow (like the Mac OSX bar appears to do although I have never used it or seen it person). Overall I would have to say it is nothing short of extraordinary. Basically it kills my silly little enlarging icons and is about as big a discouragement as I could have gotten. The bright spots are: 1 - occassionally GPF’s because of the complex Direct X crap I suppose, 2 - no rotator to switch between multiple sets of icons, 3 - does not appear to be skinnable - at least as much as I can tell.

No comments

C# and Mouse Events

I had hoped to get onto more important tasks tonight. Instead I wasted hours of my time because of quirks in the way that C# or .NET handles mouse and other events. I only thought I was leaving those things behind me with Clarion.

Again, this all goes back to the fact that I am trying to essentially simulate a button without using a button (since buttons can become a selected or default control which is what we DON’T want on a toolbar) and because I want to be able to change the size of the image easily (scaling it up and down with mouse overs).

My original plan that seemed to be working so perfectly was to change the border of the PictureBox control on a MouseDown event to a type Fixed3D or FixedSingle to show that the control was being clicked on. This worked wonderfully, even allowing me to correctly detect the MouseLeave event if it occurred before the mouse up (so I could act accordingly). Unfortunately, there is slight flaw or some sort such that if you clicked on where the outer edge of the frame was going to appear, it would never notice the MouseUp or MouseLeave events and you end up with a stuck icon until you pass over it again with the mouse. I thought about not worrying about this slight defect… but I knew that it would bother me if I never fixed it or found a way around. 3 to 4 hours later I have a solution of sorts.

What didn’t work was making a panel first and then placing the picturebox in the panel. I could then effect changes on the panel’s border by referring to the picturebox’s .parent property. The effect was similar but then I lost my MouseLeave event until after getting the MouseUp event (as it turns out… if you don’t change the border on the MouseDown, it will always fire events out of order like this — holding the MouseLeave until after the MouseUp no matter what). The other problem was that then I had twice the controls to keep track of and deal with and there were some odd sizing issues where the panels would grow or overlap… a real mess. So I scrapped that. I also tried changing the client rectangle area property as I was changing the border to possibly avoid the side-effect but that didn’t work either — still would get stuck. I also tried dozens of other bizarre little tweaks trying to figure out a magic combination that would work around it.

What I have decided on for now is actually a little better for skinning. The PictureBox object supports both an Image property and a BackgroundImage property.

The flow, now is MouseEnter — we enlarge the icon to the full size of the PictureBox just like always. On a MouseDown we shrink down to a centered image but we also set the background image on the icon to a specified background (for my testing I created a shaded box the size of the PictureBox). This gives the effect that we a clicking on the button with a nice border around the icon (and it can look like anything we want since it will be an image file). On a MouseUp I just return back to normal (no background) and an enlarged Icon again (assuming we are still over the PictureBox).

Since I am no longer changing border styles, I fail to get a MouseLeave if the user clicks and holds and then moves the mouse off the control. This means I now have to capture all the MouseMove events. If I detect that the user is leaving the bounds of the control with the button down I call my MouseLeave event with my current parameters. Then I also detect a MouseMove coming back into the control with the button down — calling the MouseDown code again. It isn’t 100% right yet but it has way fewer side-effects than anything else so far.

No comments

Next Page »