Special

Clearance Sale!

We've been publishing for over five years now and it's time to clear out our inventory of back issues, so we're slashing prices!

RBD Magazines

Check out this amazing clearance sale of all our past issues. Missing some issues? This is a great time to complete your RBD collection. Save up to 40% off the regular price of our printed back issue packages. These prices are only good until the end of the year May 2008 and supplies are limited, so place your order today.

Article Preview


Buy Now

Print:
PDF:

Intel corner

Menu Glyphs

Icons for menu entries

Issue: 4.6 (July/August 2006)
Author: Christian Schmitz, cSchmitz-at-rbdeveloper.com
Article Description: No description available.
Article Length (in bytes): 6,221
Starting Page Number: 42
RBD Number: 4617
Resource File(s):

Download Icon 4617.sit Updated: Sunday, July 16, 2006 at 9:38 AM
Download Icon 4617.zip Updated: Sunday, July 16, 2006 at 9:38 AM

Related Link(s): None
Known Limitations: None

Excerpt of article text...

Recently a reader asked me how to get an icon onto the menubar for a menu entry on Windows. Sadly, there is no direct way in REALbasic to do this. Even plugins can't always help. So this article will show you how to do menu icons in REALbasic 5.5 to 2006r2.

Size of menu icons?

The first question to ask is how big the icons need to be. For Windows XP it should be 13 by 13 pixels. But instead of hard coding it, we want to ask the system for the required size. Different themes may use different sizes. The GetSystemMetrics function will do this. In the documentation for this function, we find the C declaration:

int GetSystemMetrics(int nIndex);

As this function only takes one integer in and one out, the REALbasic declare code is quite easy. From the documentation we know it is in the user32 dll so the declare looks like this:

Declare Function GetSystemMetrics Lib "user32" (what As Integer) As Integer

There is a long list of values you can use with this function, but the only two we need are SM_CXMENUCHECK with the value 71 and SM_CYMENUCHECK with the value 72. Those constants are defined in winuser.h in the Windows SDK. We call the function like this:

...End of Excerpt. Please purchase the magazine to read the full article.

Article copyrighted by REALbasic Developer magazine. All rights reserved.


 


|

 


Weblog Commenting and Trackback by HaloScan.com