I know this must be painfully simple to do, but I cant seem to find any text that makes sense to me regarding how to actually do it.

Basically I have program "X".

Program X has the TTrayIcon component added to the MainForm. From what I have read, the need to have the PopupMenu has also been added to the MainForm.

so yes, the icon does appear in the systray without a hitch. But to have the popup menu to simply display a hide form, show form, and exit program has been quite the task. can someone here please tell me what I need to do as all of my efforts have failed to do anything more than show the program X icon in the systray and nothing else.

Another thing I have had trouble with is adding a jpeg(*.jpg) to the background of a form so that the form isnt so plain and has a better "look" about it. I cant imagine why these 2 things I have just described are so hard to do for me. Silly isnt it? :\

Thanks in advance for any help on this. :)

I didn't think anyone was still looking at this problem. I'll pack up my example code for you. (It isn't finished as far as syntax highlighting is concerned, but it does everything with the system tray that you are trying to do. I'll PM it a little later today.

For the background image, there are two ways I can think to do it.
1. Put your image component on the form, and before saving and compiling your project make sure it is at the bottom of the Z-order with all the other components on the form.

2. (More robust). Overwrite the Paint method of the form. The docs should have an example of this...

Hope this helps.

first comment.. ok thanks duoas... :)

1: uhmm.... I have no clue as to how I even begin this... (from the start of what you said to the finish of it.)

2: uhmm.... (what docs?, uhmm... overwrite?)

thanks for your help. I know you will come through for me broski. :)

Scratch the adding of an image to a form... I cannot believe how I didnt see this earlier. That problem is no longer a problem. sigh....

The other question on how to add commands to a systray icon popup is what I need some help on.

Thanks again Duoas for you timely help as you always do :)

I'll get it to you shortly. I was in the middle of dinking with some stuff in it when I left-off and left it a mess. Once I've cleaned it up better (I should be done by tomorrow) I'll send it to you.

I'm not doing anything more to the syntax highlighter for the moment, and I discourage you using it for any serious stuff (as it is currently broken and slow), but everything else should work fine. (System Tray icon stuff, pop up menus, non-rectangular windows and pop up balloons, application mutex, and a few super-useful utilities I wrote years ago and never stopped using.)

Give me a day...

commented: it wasnt mentioned here what was sent to me, thus the reputation point looks unwarranted, but I assure you it is! +1

welp, all I can say to what you sent me Duoas is WOW!

What a wonderful way to help me and anyone else that is beginning in programming! Thank you very much for your help kind sir.

I am going to mark this thread as solved. While I 'did' get an answer as to how to add a popup menu with ways to add options to the tray icon pop up list, I was hoping to do it using a component called Ttrayicon (and possibly the TPopupMenu if it is needed with it). Nevertheless, I am sure this alternative solution will work very well also. And with that I say thank you VERY much! You are a true asset to this forum sir! :)

OK, I've glanced through the TTrayIcon component's code.

Just drop a TPopupMenu on your form, populate it as desired, then when your form creates assign it to the PopupMenu property of the TTrayIcon.

Glad to be of help.

"when your (form creates), assign it to the PopupMenu property of the TTrayIcon."

this is where I am stuck... any chance you could help me? thanks again for all your help :)

procedure TForm1.FormCreate( Sender: TObject );
  begin
  TrayIcon1.PopupMenu := PopupMenu1
  end;

This presumes you dropped a popup menu on your form and populated it with the menu designer.

Thanks Duoas,

I got it to work perfectly... I had to add tell it what to do when each different command was clicked as well. I thought that was what that different population choices did automatically, but they didnt.

Oh well, I have it figured out. :)

Thanks again for all your help!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.