Solved

Graphic Popup Menu

Posted on 1998-08-10
8
274 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 
LVL 8

Expert Comment

by:ZifNab
ID: 1361872
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
ID: 1361873
Hi Zif, rather unusual answer ;)
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1361874
jeurk, yes I know, ..., but I think with the full source in Rx-Lib, people can easier understand. Zif.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Expert Comment

by:jeurk
ID: 1361875
;) 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
 
LVL 8

Expert Comment

by:ZifNab
ID: 1361876
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
ID: 1361877
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
ID: 1361878
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
ID: 1361879
jeurk, I'm always interested in talks and information, and knowings, and .... Zif.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

733 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