Solved

Graphic Popup Menu

Posted on 1998-08-10
8
249 Views
Last Modified: 2010-04-04
How do I add an image to the left side of a popup menu, like the Windows 95 start menu?
thanks
0
Comment
Question by:spat
  • 5
  • 3
8 Comments
 
LVL 8

Expert Comment

by:ZifNab
Comment Utility
spat,

 look for this at newest version freeware RxLib

http://rx.demo.ru/files/index.html if you don't want to use this component, then look at the source and learn from it.

Zif.
0
 
LVL 4

Expert Comment

by:jeurk
Comment Utility
Hi Zif, rather unusual answer ;)
0
 
LVL 8

Expert Comment

by:ZifNab
Comment Utility
jeurk, yes I know, ..., but I think with the full source in Rx-Lib, people can easier understand. Zif.
0
 
LVL 4

Expert Comment

by:jeurk
Comment Utility
;) I'm just bugging you.
Jeurk.
Another thing, did you found a suitable language component ? The one I use is
tblang. And the author is working on a version with external flat files. And an extra
editor for it. But still beta and really buggy...
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 8

Expert Comment

by:ZifNab
Comment Utility
spat, comment? Need an example? OR just component?

jeurk, nope not yet. All the editors I'd found lack somewhere..
0
 
LVL 8

Accepted Solution

by:
ZifNab earned 100 total points
Comment Utility
Here it is, well explained (chami) :

 procedure AddBitmapToMenuItem(
                PopupMenu : TPopupMenu;
                nItemPos  : integer;
                Bitmap    : TBitmap );
     begin
      SetMenuItemBitmaps(PopupMenu.Handle,
                  nItemPos,
                  MF_BYPOSITION,
                  Bitmap.Handle,
                  Bitmap.Handle );
     end;



The Windows API function "SetMenuItemBitmaps()" is mostly used to set bitmaps for "checkable" menu items -- menu items with two bitmaps for checked and unchecked states. To keep the "AddBitmapToMenuItem()" function simple, we're not changing menu item's size according to the size of the bitmap. This means, you can only pass bitmaps that are small enough to fit in the default size of your menu items.

To keep the bitmaps for your menu items built into your application:

   Drop a "TImage" component on your form.
   Assign a bitmap of your choice to the "Picture" property of the newly created "TImage" component.
   Call "AddBitmapToMenuItem()" function as follows from your
   "FormCreate()" event (assuming that the pop-up menu that you're assigning the bitmap to is named "PopupMenu1," the image component you're using is named "Image1," and the position of the actual menu item you want to set the bitmap on is 0 -- 1st item = 0, 2nd item = 1, 3rd item =  2, etc.):

 AddBitmapToMenuItem(PopupMenu1,
                     0,
                     Image1.Picture.Bitmap );

 To load the menu item bitmaps at the run-time:

 procedure TForm1.FormCreate(Sender: TObject);
  var
     BMP : TBitmap;
 begin
  BMP := TBitmap.Create;
  BMP.LoadFromFile('MyBitmap.BMP' );
                   AddBitmapToMenuItem(
                   PopupMenu1, 0, BMP );
 end;

Regards, Zif.
0
 
LVL 4

Expert Comment

by:jeurk
Comment Utility
Zif : your answer is much better ;), about the translations component, I'll let you know
what it gives, if you are interesed.
0
 
LVL 8

Expert Comment

by:ZifNab
Comment Utility
jeurk, I'm always interested in talks and information, and knowings, and .... Zif.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now