Forum > Other

TfpgSystemTrayIcon in Fpgui

(1/1)

benohb:
Google does not help much
How use TfpgSystemTrayIcon in Fpgui
Any examples? I use Linux   %)

Graeme:
Sorry for the late reply. I've already added an example to the documentation, but the current online docs is equivalent to the "master" branch (last stable released branch), and not the more up-to-date "maint" or "develop" branches.

Anyway, add the following code to your main form's AfterCreate() method.


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---  pmTray := TfpgPopupMenu.Create(self);  with pmTray do  begin    Name := 'pmTray';    SetPosition(256, 128, 120, 20);    AddMenuItem('Start Timer...', '', nil);    AddMenuItem('Stop Timer...', '', nil);    AddMenuItem('-', '', nil);    AddMenuItem('Show Form', '', @miShowFormClicked);    AddMenuItem('-', '', nil);    AddMenuItem('Quit', '', @miFileQuitClicked);  end;   TrayIcon := TfpgSystemTrayIcon.Create(self);  with TrayIcon do  begin    Name := 'TrayIcon';    SetPosition(256, 240, 20, 20);    PopupMenu := pmTray;    ImageName := 'stdimg.folderhome';  end; 
You define a popup menu, which in turn you will assign to the PopupMenu property of the systemtray component. There are a couple of properties you can adjust to configure the systemtray appearance.

Navigation

[0] Message Index

Go to full version