Solved

Graphic Popup Menu

Posted on 1998-08-10
8
256 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
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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

863 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

25 Experts available now in Live!

Get 1:1 Help Now