Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2005-10

Lazarus IDE Question

4 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

David Chandler

I am trying to create a menu bar using Lazarus. I drop the TMainMenu icon onto the form. Then I modify the Items in the Object Inspector and can get the first menu item, but that is all. I can't enter more menu headings or submenu items. I checked a Delphi reference and saw a similar mechanism, but it provides little dashed boxes to lay out the whole menu structure. The corresponding structure in Lazarus seems inert.

I then tried bypassing the IDE and duplicated the code on the form, changing the menu items to item1, item2, item3, etc. There must be other necessary code hidden somewhere else because this attempt failed to compile.

Is this one of the things that doesn't work in Lazarus? Am I doing something wrong? Any suggstions? Is there a Lazarus-specific forum to discuss questions like this?

--David Chandler

Micha Nelissen
to David Chandler
David Chandler wrote 6 lines
I am trying to create a menu bar using Lazarus. I drop the TMainMenu icon onto the form. Then I modify the Items in the Object Inspector and can get the first menu item, but that is all. I can't enter more menu headings or submenu items. I checked a Delphi reference and saw a similar mechanism, but it provides little dashed boxes to lay out the whole menu structure. The corresponding structure in Lazarus seems inert.

The trick is to right-click, then you get a menu, choose "insert item after" or something alike.

I then tried bypassing the IDE and duplicated the code on the form, changing the menu items to item1, item2, item3, etc. There must be other necessary code hidden somewhere else because this attempt failed to compile.

Did you create menuitems on the fly with Item1 := TMenuItem.Create and setting the relevant properties ? This should also work, but try first with the designer, I'd say.

Is this one of the things that doesn't work in Lazarus? Am I doing something wrong? Any suggstions? Is there a Lazarus-specific forum to discuss questions like this?

There is also a lazarus mailing list: Visit:

http://www.lazarus.freepascal.org/modules.php?op=modload&name=StaticPage&file=index&sURL=maill

for help regarding subscribing.

HTH,

Micha

David Chandler
to Micha Nelissen

Thank you Micha for your help so far. Your suggestion worked, at least in getting the menu structure created at design time. However it locks up at run time.

I created a bare-bones do-nothing test menu and double clicked each menu option to create an empty procedure in response to a mouse click. If I have no submenus, everything seems to work. But if I add submenus, the menu system locks up.

One of my questions is, do I need to create click-handling procedures for the menu items whose only function is to open a submenu? The system locks up whether I create these procedures or not, but I can't imagine what I would put in such a procedure if it were required. Is there some other property I need to set to get the menu system to work? Is there a tutorial or documentation (short of reading the source code) that leads me through this learning process? (I feel awkward having to rely on the mailing list for questions I would normally be able to answer for myself reading a book or online document. I have been using Mastering Delphi 6, by the way, on the assumption that the Lazarus IDE is roughly equivalent.)
--David Chandler

Micha Nelissen wrote 13 lines
David Chandler wrote: > I am trying to create a menu bar using Lazarus. I drop the TMainMenu > icon onto the form. Then I modify the Items in the Object Inspector > and can get the first menu item, but that is all. I can't enter more > menu headings or submenu items. I checked a Delphi reference and saw > a similar mechanism, but it provides little dashed boxes to lay out > the whole menu structure. The corresponding structure in Lazarus > seems inert. The trick is to right-click, then you get a menu, choose "insert item after" or something alike.
David Chandler
to David Chandler

I need to follow up on my own question, having done some more experimenting. I discovered that although the menu system locks up when I do a "Run" from within the Lazarus environment (Version 0.9.10 beta), if I get out of the IDE and double click on the exe file that was produced it works fine. I still don't know if the reason Lazarus produces bad results is because of a faulty configuration on my part or a genuine bug. The error message I get when I stop the program is "Project raised external exception class 'Externals: SIGSEGV'".

I tried stepping through the program with the debugger. What I got were various messages saying Lazarus couldn't find different inc files. It gave me an opportunity to supply my own path, so after searching around I provided a path (C:\lazarus\fpcsrc\rtl\inc\...), after which it kept working.

After exiting the program I tried finding where I could set the path and found Compiler Options under the Project menu, which had a place to give paths to different kinds of files. I set the path as above and got this message when the program compiled again:

File C:\lazarus\fpcsrc\rtl\inc\genstr.inc is newer than Release PPU file, C:\lazarus\pp\units\i386-win32\rtl\strings.ppu

along with a similar message for all the other inc files. I have no idea what this really means, but it makes me wonder what version of FPC Lazarus is using. (I have a separate installed copy of FPC, but Lazarus apparently has its own built in with no apparent way to redirect it to a different version.) Despite the messages, the program went ahead and built, with the same flaw as before.

So that is the state of my experimentation.

David Chandler wrote 17 lines
I created a bare-bones do-nothing test menu and double clicked each menu option to create an empty procedure in response to a mouse click. If I have no submenus, everything seems to work. But if I add submenus, the menu system locks up. One of my questions is, do I need to create click-handling procedures for the menu items whose only function is to open a submenu? The system locks up whether I create these procedures or not, but I can't imagine what I would put in such a procedure if it were required. Is there some other property I need to set to get the menu system to work? Is there a tutorial or documentation (short of reading the source code) that leads me through this learning process? (I feel awkward having to rely on the mailing list for questions I would normally be able to answer for myself reading a book or online document. I have been using Mastering Delphi 6, by the way, on the assumption that the Lazarus IDE is roughly equivalent.) --David Chandler