Recent

Author Topic: (Solved)popup menu question  (Read 1315 times)

JLWest

  • Hero Member
  • *****
  • Posts: 1293
(Solved)popup menu question
« on: December 16, 2020, 10:51:44 pm »
Trying to implement a popup menu. I'm following the tutorial at:

https://wiki.freepascal.org/TPopupMenu#Creating_a_PopupMenu

This seems to out of date. Is there a better example or tutorial?

Thanks
« Last Edit: December 30, 2020, 10:08:40 am by JLWest »
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

wp

  • Hero Member
  • *****
  • Posts: 11923
Re: popup menu question
« Reply #1 on: December 16, 2020, 11:06:07 pm »
Did you ever create a TMainMenu? Creating a popup menu is exactly the same.

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: popup menu question
« Reply #2 on: December 16, 2020, 11:45:43 pm »
Well to be honest, No I never created a TMainMenu.
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

jamie

  • Hero Member
  • *****
  • Posts: 6131
Re: popup menu question
« Reply #3 on: December 17, 2020, 12:16:31 am »
Simply drop one on the form and right click it. You should get an option at the top of the list that gets you in the menu editor..

there you add items to the popup list..

each item will has an onclick event that you assign to execute your code.

you can either directly force it to show somewhere in code   MyPopUp.PopUp

or assign it to the Popup property of the control if it has one..
The only true wisdom is knowing you know nothing

Handoko

  • Hero Member
  • *****
  • Posts: 5158
  • My goal: build my own game engine using Lazarus
Re: popup menu question
« Reply #4 on: December 17, 2020, 09:03:41 am »
I created an animated gif tutorial, hope it can help.

https://ibb.co/BsBw9my

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: popup menu question
« Reply #5 on: December 17, 2020, 07:13:00 pm »
Thanks
Now that I know how to make a popup menu I realize that 's not what I need. On the program there is a help button, It displays help to the form on a memo. However to get help on the New button you have to scroll down to the New section of the memo.

I'm thinking now the New button tag property should be unique. And somehow when you right click on the New button a window comes up with the New help information. I tried to use Hints but that isn't very good.

Have no idea how to do that. Is that possible?

 

FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

jamie

  • Hero Member
  • *****
  • Posts: 6131
Re: popup menu question
« Reply #6 on: December 18, 2020, 01:42:34 am »
have you thought about using a HTML help system ?

 If you know how to use HTML editor you can create your helps..

  There is a Sample program in the Examples  "HtmlHelp" I believe. It uses the web browser as the viewer so it allows you to have pages locally or even remotely...

 ---

If not that, you could use the RichMemo to give you color

Or just load Text files from disk using the Memo.LoadfromFile(''');
The only true wisdom is knowing you know nothing

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: popup menu question
« Reply #7 on: December 18, 2020, 04:55:51 am »
@jamie

Thanks. Probably rule out the HTML help route. However, the Memo.LoadfromFile('''); is really interesting. I do a lot of that now in the program but I load the text file into a listbox then assign the TStringlist to a memo then display the memo.

The program looks good I think and works well, no bugs really. But I'm probably doing a lot of things the hard way or wrong. Just making it work with code.
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

 

TinyPortal © 2005-2018