Solved

Graphic Popup Menu

Posted on 1998-08-10
8
270 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Machine not responding during CopyFile() 3 104
Mobile Keyboard covers the display of the TMemo 3 96
Delphi Yen format 3 45
Firemonkey webbrowser scrollbars ? 1 50
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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

828 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