* * *

Author Topic: Popup Menu Divider not working  (Read 1559 times)

HatForCat

  • Sr. Member
  • ****
  • Posts: 260
Popup Menu Divider not working
« on: February 11, 2017, 02:07:11 pm »
Hi, using Ubuntu 14.04 and Laz 1.6.2, when I put a single "-" as the Popup Menu Item Caption it doe snot create a divder.

Checking the FPC wiki it is supposed to create a divider.
Searching here, a 2011 posting has the same problem, but no resolution and nothing since that I can find.

Other than using "-----------------" as the Caption, is there some way I can get a real divider?

Using the string above means that moving down the popped-up menu, the string is highlighted like a normal Menu option and can be clicked which then closes the menu.
Acer-i5, 2.6GHz, 6GB, 256-SSD, Ubuntu 14.04-LTS, Unity Desktop, Lazarus 1.6.2, SQLite3 -- Retired: Programming for my own use for Ubuntu.

howardpc

  • Hero Member
  • *****
  • Posts: 2116
Re: Popup Menu Divider not working
« Reply #1 on: February 11, 2017, 05:16:51 pm »
That is very odd.
Perhaps there is something wrong with your setup.
Try this.
Start a new blank Lazarus application, saving it as Project1 and its main unit as Unit1 in some suitable location.
Add Menus to the uses clause.
Double click on the blank form to generate an OnCreate handler and fill it out thus:

Code: Pascal  [Select]
  1. var
  2.   i: integer;
  3.   s: string;
  4. begin
  5.   PopupMenu:=TPopupMenu.Create(Self);
  6.   for i:=0 to 10 do begin
  7.     Str(i, s);
  8.     s:='Item_'+s;
  9.     if Odd(i) then
  10.       PopupMenu.Items.Add(NewLine)
  11.     else PopupMenu.Items.Add(NewItem(s,0,False,True,nil,0,s));
  12.   end;
  13. end;  

If you compile and run the application and right click on the form, does the popup show dividers?
« Last Edit: February 11, 2017, 05:19:33 pm by howardpc »

HatForCat

  • Sr. Member
  • ****
  • Posts: 260
Re: Popup Menu Divider not working
« Reply #2 on: February 11, 2017, 09:12:16 pm »
Perhaps there is something wrong with your setup.

It would not surprise me. :)

I did as you suggested and I get a menu with items and faint thin gray line between each item. My menu looks like a Memo, no lines at all.

I then added your code into the program I am working on and side by side, my menu still looks like a Memo and yours pops up with the nice gray lines. HUH?

For my menus, I used the MenuEditor by a double-click on the icon once dropped on to the Form and it .
 
Acer-i5, 2.6GHz, 6GB, 256-SSD, Ubuntu 14.04-LTS, Unity Desktop, Lazarus 1.6.2, SQLite3 -- Retired: Programming for my own use for Ubuntu.

howardpc

  • Hero Member
  • *****
  • Posts: 2116
Re: Popup Menu Divider not working
« Reply #3 on: February 11, 2017, 09:52:29 pm »
Seems to be either a bug in the Object Inspector or TMenuItem property editor if setting TMenuItem.Caption to '-' does not produce a divider; or perhaps it is a quirk of gtk2, or some shortcoming or setup glitch on your particular machine.

However, I cannot reproduce it with Laz 1.6.2 on Mint 18 (based on Ubuntu 16) with gtk2.

Anyway, at least you've established that Lazarus can correctly produce menu dividers for your widgetset if you create them in code. Have you tried compiling for the qt widgetset? If so, do you still have the same problem?

BTW Lazarus trunk has a completely different menu editor which forces you to add (or delete) item dividers using a popup menu. In the newer menu editor you can't change a menuitem's Caption to '-' (IIRC this is because of gtk issues).

jacmoe

  • Full Member
  • ***
  • Posts: 242
    • Jacmoe's Cyber SoapBox
Re: Popup Menu Divider not working
« Reply #4 on: February 11, 2017, 09:57:54 pm »
That sounds really great  :D

Because, on Linux (Debian testing), not only does '-' not work - it also completely freezes my machine while Lazarus presents the gtk related runtime error, forcing me to hit the reset button.

I will try and update to trunk.

((Sorry for gatecrashing, but I got this runtime error today))
more signal - less noise

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2848
  • I like bugs.
Re: Popup Menu Divider not working
« Reply #5 on: February 11, 2017, 10:53:02 pm »
Because, on Linux (Debian testing), not only does '-' not work - it also completely freezes my machine while Lazarus presents the gtk related runtime error, forcing me to hit the reset button.
It is reported here:
 http://bugs.freepascal.org/view.php?id=31138
According to the report it worked with 1.6.0 but not with 1.6.2. I got the same freeze with trunk, too.
Could somebody find the reason or guilty revision please. I have other things going on. Apparently the reporter Wolfgang Siebeck is busy, too, and didn't give any feedback yet.

jacmoe

  • Full Member
  • ***
  • Posts: 242
    • Jacmoe's Cyber SoapBox
Re: Popup Menu Divider not working
« Reply #6 on: February 11, 2017, 11:04:06 pm »
Yes, I can confirm that it still does not work using trunk here as well.
Although, I have to say: the new menu editor is nice!  :D
more signal - less noise

Bart

  • Hero Member
  • *****
  • Posts: 2655
    • Bart en Mariska's Webstek
Re: Popup Menu Divider not working
« Reply #7 on: February 11, 2017, 11:12:30 pm »
Could somebody find the reason or guilty revision please. I have other things going on. Apparently the reporter Wolfgang Siebeck is busy, too, and didn't give any feedback yet.

That is going to be a painful process, since testing a "broken" revision will force you to restart your machine.

Bart

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2848
  • I like bugs.
Re: Popup Menu Divider not working
« Reply #8 on: February 12, 2017, 01:04:41 am »
That is going to be a painful process, since testing a "broken" revision will force you to restart your machine.
... or kill the frozen Lazarus process from another computer if you can connect with ssh.

Cyrax

  • Sr. Member
  • ****
  • Posts: 495
Re: Popup Menu Divider not working
« Reply #9 on: February 12, 2017, 08:11:31 am »
Could somebody find the reason or guilty revision please. I have other things going on. Apparently the reporter Wolfgang Siebeck is busy, too, and didn't give any feedback yet.

That is going to be a painful process, since testing a "broken" revision will force you to restart your machine.

Bart

No need for restart. Just use CTRL+ALT+<number> key combo to switch different virtual console and kill Lazarus from there.

Bart

  • Hero Member
  • *****
  • Posts: 2655
    • Bart en Mariska's Webstek
Re: Popup Menu Divider not working
« Reply #10 on: February 12, 2017, 11:35:52 am »
No need for restart. Just use CTRL+ALT+<number> key combo to switch different virtual console and kill Lazarus from there.

Well, that's better than the related bugreport about menu separators on GTK2, it froze my machine completely.

Bart

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2848
  • I like bugs.
Re: Popup Menu Divider not working
« Reply #11 on: February 12, 2017, 01:48:24 pm »
No need for restart. Just use CTRL+ALT+<number> key combo to switch different virtual console and kill Lazarus from there.
Are you sure? I remember it froze all keys and mouse. SSH may be the only choice.

zeljko

  • Hero Member
  • *****
  • Posts: 902
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Popup Menu Divider not working
« Reply #12 on: February 12, 2017, 02:46:14 pm »
Or Crtl+Alt+Backspace on older X11 installations where it was by default on to kill X11 server :)

jacmoe

  • Full Member
  • ***
  • Posts: 242
    • Jacmoe's Cyber SoapBox
Re: Popup Menu Divider not working
« Reply #13 on: February 12, 2017, 04:05:50 pm »
I can confirm that it completely freezes. Any key, even Ctrl+Alt+Backspace, does not register.
more signal - less noise

Cyrax

  • Sr. Member
  • ****
  • Posts: 495
Re: Popup Menu Divider not working
« Reply #14 on: February 12, 2017, 04:23:03 pm »
Okay. Then someone needs to play with LXC containers and VNC viewer a bit and see if it still freezes.

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus