Sunday, July 23, 2006

Fun 4 X

Also known as “Fun For All”.

I had reason to demonstrate my ability to switch languages (English, French, Spanish etc.) on the Control Tip Text on controls on a GUI form.

I decided to demonstrate by changing the established English-language tips to whimsical bumper stickers.

At the same time I was lecturing to classes in a sunny room, and students couldn’t see the GUI forms.

I decided to introduce random colour schemes.

Then I got carried away and decided that the fonts and mouse pointers could do with a touch-up.

The result is Fun4X.

To see how it works, introduce a new User Form and place four command controls on the form.

I haven’t bothered to rename or captioon them, for reasons which will appear below.

Set a refernce to UW.DOT.

Double-click on a command button and write the code for that button, close, double-click on the next, write, close and so on until all 4 command buttons have code and then write the userform initialization code, as set out below.

Private Sub CommandButton1_Click()
Call UW.cmdColoursClick(Me)
End Sub
Private Sub CommandButton2_Click()
Call UW.cmdFontsClick(Me)
End Sub
Private Sub CommandButton3_Click()
Call UW.cmdIconsClick(Me)
End Sub
Private Sub CommandButton4_Click()
Call UW.cmdCaptionsClick(Me)
End Sub
Private Sub UserForm_Initialize()
Call UW.UserFormInitialize(Me)
End Sub

Run the user form (F5 function key), and you’ll see this:

I had hooked the top-left control to “Colours”, and the bottom left control to “Captions”.

Click the Colours control repeatedly and watch the pretty random colours.

Click the Captions control once, then inspect your Control Tip Text.

If you have icon files (*.ICO) on your root drive C:, you can switch mouse pointers.

You can change font face and size, too.

Once I am sure the controls are working, I resize them to be 4-pixel square “rivets” in each corner of the GUI form.

That’s why I don’t need captions!


Post a Comment

<< Home