Solved

Graphic Popup Menu

Posted on 1998-08-10
8
282 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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

726 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