Sign in Join

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

Mailing lists / lazarus / 2009-05

TPopupMenu bug

22 messages · 8 people · –

Reply by email Subscribe to this list Your subscription

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

Michael Van Canneyt

Hi,

The PopupMenu property of TMemo does not work in GTK 2.

I always get some standard GTK popup menu instead of the menu which I designed.

Is this a known issue ?

Michael.

Reply by email

Brad Campbell
to Michael Van Canneyt: The PopupMenu property of TMemo does not work in GTK 2. I always get some standard GTK…
Michael Van Canneyt wrote 7 lines
Hi, The PopupMenu property of TMemo does not work in GTK 2. I always get some standard GTK popup menu instead of the menu which I designed. Is this a known issue ?

Is it related to this behaviour ?

http:/msg04840.html

Brad

Dolphins are so intelligent that within a few weeks they can train Americans to stand at the edge of the pool and throw them fish.

Reply by email

Paul Ishenin
to Brad Campbell
Brad Campbell wrote 10 lines
Michael Van Canneyt wrote: > Hi, > > The PopupMenu property of TMemo does not work in GTK 2. > I always get some standard GTK popup menu instead of the menu which I > designed. > > Is this a known issue ? Is it related to this behaviour ?

Not exactly. Michael just wants to replace system popup menu with his own. I made a few changes today to allow this. But this needs to be fixed in a bit different way with changing LCL (not only gtk interface) code. So better fix will come later.

Best regards,
Paul Ishenin.

Reply by email

Mattias Gärtner
to Paul Ishenin

Zitat von Paul Ishenin :

Show quoted text 16 lines
Brad Campbell wrote: > Michael Van Canneyt wrote: >> Hi, >> >> The PopupMenu property of TMemo does not work in GTK 2. >> I always get some standard GTK popup menu instead of the menu >> which I designed. >> >> Is this a known issue ? > > Is it related to this behaviour ? Not exactly. Michael just wants to replace system popup menu with his own. I made a few changes today to allow this. But this needs to be fixed in a bit different way with changing LCL (not only gtk interface) code. So better fix will come later.

"just wants to replace system popup menu with his own" I don't think he wants that. The system popup menu contains not only cut/copy/paste but also input methods needed for accessibility and multi language systems. Loosing them would be a bad example for the book.

About cut/copy/paste:
Apps can create better cut/copy/paste functions, so a mechanism to replace those is needed.

Mattias

Powered by NetMail

Reply by email

Paul Ishenin
to Mattias Gärtner
Mattias G?rtner wrote
"just wants to replace system popup menu with his own" I don't think he wants that. The system popup menu contains not only cut/copy/paste but also input methods needed for accessibility and multi language systems. Loosing them would be a bad example for the book.

Maybe we read what we want but I can't translate this sentence differently: "I always get some standard GTK popup menu instead of the menu which I designed."

About cut/copy/paste: Apps can create better cut/copy/paste functions, so a mechanism to replace those is needed.

You can't add items to the standard menu in a legal way on all systems. But if you want some standard items you can create them yourself always.

Best regards,
Paul Ishenin.

Reply by email

Mattias Gärtner
to Paul Ishenin

Zitat von Paul Ishenin :

Show quoted text 18 lines
Mattias G?rtner wrote: > "just wants to replace system popup menu with his own" > I don't think he wants that. The system popup menu contains not > only cut/copy/paste but also input methods needed for accessibility > and multi language systems. Loosing them would be a bad example for > the book. Maybe we read what we want but I can't translate this sentence differently: "I always get some standard GTK popup menu instead of the menu which I designed." > About cut/copy/paste: > Apps can create better cut/copy/paste functions, so a mechanism to > replace those is needed. You can't add items to the standard menu in a legal way on all systems. But if you want some standard items you can create them yourself always.

Maybe I was not clear, or maybe I misunderstood.
1. we want to add our TPopupMenu menu items
2. we need some important menu items of the gtk

One solution is to add the TPopupMenu items to the gtk menu items, but then some menu items may be doubled (cut/copy/paste/select all). This needs a solution.
Another solution is to remove the gtk menu items, add the TPopupMenu items and add the gtk menu items in the gtk intf. Again duplicates should be avoided.
A workaround solution is to add the TPopupMenu items and move all gtk items to a sub menu. Then the duplicates will be at least in different sub menus. But the user has to click one time more to switch his input method.

Mattias

Powered by NetMail

Reply by email

Michael Van Canneyt
to Mattias Gärtner: Zitat von Paul Ishenin : "just wants to replace system popup menu with his own" I don't…
Mattias G?rtner wrote 27 lines
Zitat von Paul Ishenin : > Brad Campbell wrote: >> Michael Van Canneyt wrote: >>> Hi, >>> >>> The PopupMenu property of TMemo does not work in GTK 2. >>> I always get some standard GTK popup menu instead of the menu which I >>> designed. >>> >>> Is this a known issue ? >> >> Is it related to this behaviour ? > > Not exactly. Michael just wants to replace system popup menu with his own. > I made a few changes today to allow this. But this needs to be fixed in a > bit different way with changing LCL (not only gtk interface) code. So > better fix will come later. "just wants to replace system popup menu with his own" I don't think he wants that. The system popup menu contains not only cut/copy/paste but also input methods needed for accessibility and multi language systems. Loosing them would be a bad example for the book. About cut/copy/paste: Apps can create better cut/copy/paste functions, so a mechanism to replace those is needed.

I think that if I specify my own TPopupMenu, then that should replace whatever GTK thinks it should put there. If I don't specify one, then the standard GTK one is used. I don't want merging or whatever.

It's the same as what happens on Windows.

Michael.

Reply by email

Graeme Geldenhuys
to Michael Van Canneyt

2009/5/18 Michael Van Canneyt :

I think that if I specify my own TPopupMenu, then that should replace whatever GTK thinks it should put there. If I don't specify one, then the standard GTK one is used. I don't want merging or whatever.

That's the behaviour that I would expect as well. That is also how it works in Delphi.

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Paul Ishenin
to Graeme Geldenhuys
Graeme Geldenhuys wrote 10 lines
2009/5/18 Michael Van Canneyt : > I think that if I specify my own TPopupMenu, then that should replace > whatever GTK thinks it should put there. If I don't specify one, then > the standard GTK one is used. I don't want merging or whatever. > That's the behaviour that I would expect as well. That is also how it works in Delphi.

And how it worked in LCL-win32 and LCL-gtk2 now.

Best regards,
Paul Ishenin.

Reply by email

Mattias Gärtner
to Michael Van Canneyt: I think that if I specify my own TPopupMenu, then that should replace whatever GTK thinks…

Zitat von Michael Van Canneyt :

Show quoted text 6 lines
[...] I think that if I specify my own TPopupMenu, then that should replace whatever GTK thinks it should put there. If I don't specify one, then the standard GTK one is used. I don't want merging or whatever. It's the same as what happens on Windows.

I don't know what windows has as default menu items.

Ok, so you vote against using the gtk2 bidi system and easy switching input methods, which afaik is needed by many asian languages. But I'm no expert - maybe you are right.
Perhaps there is some one here who knows about the gtk2 imm features and can tell what we will loose?
Should I ask on the gtk2 list?

Mattias

Powered by NetMail

Reply by email

Michael Van Canneyt
to Mattias Gärtner
Mattias G?rtner wrote 17 lines
Zitat von Michael Van Canneyt : > [...] > I think that if I specify my own TPopupMenu, then that should replace > whatever GTK thinks it should put there. If I don't specify one, then > the standard GTK one is used. I don't want merging or whatever. > > It's the same as what happens on Windows. I don't know what windows has as default menu items. Ok, so you vote against using the gtk2 bidi system and easy switching input methods, which afaik is needed by many asian languages. But I'm no expert - maybe you are right. Perhaps there is some one here who knows about the gtk2 imm features and can tell what we will loose? Should I ask on the gtk2 list?

I don't think so; The point is that the system should behave the same on all platforms, i.e. assigning a popupmenu removes the system-defined popup menu.

Otherwise you'd have to merge the system popup menu on e.g. windows as well, and I don't think you have access to that.

Michael.

Reply by email

Paul Ishenin
to Mattias Gärtner: Zitat von Michael Van Canneyt : I don't know what windows has as default menu items. Ok,…
Mattias G?rtner wrote 17 lines
Zitat von Michael Van Canneyt : > [...] > I think that if I specify my own TPopupMenu, then that should replace > whatever GTK thinks it should put there. If I don't specify one, then > the standard GTK one is used. I don't want merging or whatever. > > It's the same as what happens on Windows. I don't know what windows has as default menu items. Ok, so you vote against using the gtk2 bidi system and easy switching input methods, which afaik is needed by many asian languages. But I'm no expert - maybe you are right. Perhaps there is some one here who knows about the gtk2 imm features and can tell what we will loose? Should I ask on the gtk2 list?

How one relates with other?

If I want my own popup menu I must have a way to set it. If I want to mix my items with the starndard I must have a way to do so.

VCL and LCL allows only the first. If you want the second let's invent how to do so.

For example: TPopupMenu.AddDefaultItems(AControl: TWinControl)

Best regards,
Paul Ishenin.

Reply by email

Michael Van Canneyt
to Paul Ishenin
Paul Ishenin wrote 27 lines
Mattias G?rtner wrote: > Zitat von Michael Van Canneyt : > >> [...] >> I think that if I specify my own TPopupMenu, then that should replace >> whatever GTK thinks it should put there. If I don't specify one, then >> the standard GTK one is used. I don't want merging or whatever. >> >> It's the same as what happens on Windows. > > I don't know what windows has as default menu items. > > Ok, so you vote against using the gtk2 bidi system and easy switching input > methods, which afaik is needed by many asian languages. But I'm no expert - > maybe you are right. > Perhaps there is some one here who knows about the gtk2 imm features and > can tell what we will loose? > Should I ask on the gtk2 list? How one relates with other? If I want my own popup menu I must have a way to set it. If I want to mix my items with the starndard I must have a way to do so. VCL and LCL allows only the first. If you want the second let's invent how to do so. For example: TPopupMenu.AddDefaultItems(AControl: TWinControl)

Good idea, but maybe add a parameter:

TPopupMenu.AddDefaultItems(AControl: TWinControl; SkipExisting: Boolean = true);

Michael.

Reply by email

Osvaldo Filho
to Michael Van Canneyt

Is this?

http://www.torry.net/pages.php?id=147

Sometimes I must insert a new items into system menu of some form. I think that I such not one...

type TyourForm = class(TForm)
  private
    { Private declarations }
    procedure wmSysCommand(var Message:TMessage); message WM_SYSCOMMAND;
  end;
const
  ID_ABOUT  = Word(-1);
implementation
procedure TyourForm.wmSysCommand;
begin
  if Message.wParam = ID_ABOUT then
  begin
     <some actions>
  end;
  inherited;
end;
procedure TyourForm.FormCreate(Sender: TObject);
var sysMenu: THandle;
begin
  sysMenu := GetSystemMenu(Handle, False);
  AppendMenu(sysMenu, MF_SEPARATOR, Word(-1), '');
  AppendMenu(sysMenu, MF_BYPOSITION, ID_ABOUT, 'About...');
end;
Michael Van Canneyt wrote 37 lines
On Mon, 18 May 2009, Paul Ishenin wrote: > Mattias G?rtner wrote: >> Zitat von Michael Van Canneyt : >> >>> [...] >>> I think that if I specify my own TPopupMenu, then that should replace >>> whatever GTK thinks it should put there. If I don't specify one, then >>> the standard GTK one is used. I don't want merging or whatever. >>> >>> It's the same as what happens on Windows. >> >> I don't know what windows has as default menu items. >> >> Ok, so you vote against using the gtk2 bidi system and easy switching input >> methods, which afaik is needed by many asian languages. But I'm no expert - >> maybe you are right. >> Perhaps there is some one here who knows about the gtk2 imm features and >> can tell what we will loose? >> Should I ask on the gtk2 list? > How one relates with other? > > If I want my own popup menu I must have a way to set it. > If I want to mix my items with the starndard I must have a way to do so. > > VCL and LCL allows only the first. If you want the second let's invent how to > do so. > > For example: TPopupMenu.AddDefaultItems(AControl: TWinControl) Good idea, but maybe add a parameter: TPopupMenu.AddDefaultItems(AControl: TWinControl; SkipExisting: Boolean = true); Michael. _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Mattias Gärtner
to Michael Van Canneyt: I don't think so; The point is that the system should behave the same on all platforms,…

Zitat von Michael Van Canneyt :

Show quoted text 27 lines
On Mon, 18 May 2009, Mattias G?rtner wrote: > Zitat von Michael Van Canneyt : > >> [...] >> I think that if I specify my own TPopupMenu, then that should replace >> whatever GTK thinks it should put there. If I don't specify one, then >> the standard GTK one is used. I don't want merging or whatever. >> >> It's the same as what happens on Windows. > > I don't know what windows has as default menu items. > > Ok, so you vote against using the gtk2 bidi system and easy > switching input methods, which afaik is needed by many asian > languages. But I'm no expert - maybe you are right. > Perhaps there is some one here who knows about the gtk2 imm > features and can tell what we will loose? > Should I ask on the gtk2 list? I don't think so; The point is that the system should behave the same on all platforms, i.e. assigning a popupmenu removes the system-defined popup menu. Otherwise you'd have to merge the system popup menu on e.g. windows as well, and I don't think you have access to that.

I can't follow you. Just because a widgetset does not support something, does not mean we disable this on all platforms.

Mattias

Powered by NetMail

Reply by email

Paul Ishenin
to Mattias Gärtner
Mattias G?rtner wrote 10 lines
> I don't think so; The point is that the system should behave the same > on all > platforms, i.e. assigning a popupmenu removes the system-defined > popup menu. > > Otherwise you'd have to merge the system popup menu on e.g. windows > as well, and I don't think you have access to that. I can't follow you. Just because a widgetset does not support something, does not mean we disable this on all platforms.

Agree with you. But also we should not substitute one feature with another. Therefore if I want my own menu I will use TMemo.PopupMenu := MyPopupMenu; and if I want to insert some items into system popupmenu I will use some other code.

Best regards,
Paul Ishenin.

Reply by email

Mattias Gärtner
to Paul Ishenin: How one relates with other? If I want my own popup menu I must have a way to set it. If I…

Zitat von Paul Ishenin :

Show quoted text 22 lines
Mattias G?rtner wrote: > Zitat von Michael Van Canneyt : > >> [...] >> I think that if I specify my own TPopupMenu, then that should replace >> whatever GTK thinks it should put there. If I don't specify one, then >> the standard GTK one is used. I don't want merging or whatever. >> >> It's the same as what happens on Windows. > > I don't know what windows has as default menu items. > > Ok, so you vote against using the gtk2 bidi system and easy > switching input methods, which afaik is needed by many asian > languages. But I'm no expert - maybe you are right. > Perhaps there is some one here who knows about the gtk2 imm > features and can tell what we will loose? > Should I ask on the gtk2 list? How one relates with other? If I want my own popup menu I must have a way to set it. If I want to mix my items with the starndard I must have a way to do so.

Yes, that's what I'm trying to say. :)

VCL and LCL allows only the first. If you want the second let's invent how to do so. For example: TPopupMenu.AddDefaultItems(AControl: TWinControl)

This is an implementation of my second proposal. It needs parameters to define what to add. For example:

TPopupMenu.AddDefaultItems(AControl: TWinControl; SkipMenuEntries:
TInterfaceMenuEntries);

type
TInterfaceMenuEntry = (
imeClipboardFunctions,
imeSelectionFunctions,
imeInputMethods,
imeUnicodeFunctions

     );
   TInterfaceMenuEntries = set of TInterfaceMenuEntry;

Mattias

Powered by NetMail

Reply by email

Paul Ishenin
to Mattias Gärtner
Mattias G?rtner wrote 14 lines
This is an implementation of my second proposal. It needs parameters to define what to add. For example: TPopupMenu.AddDefaultItems(AControl: TWinControl; SkipMenuEntries: TInterfaceMenuEntries); type TInterfaceMenuEntry = ( imeClipboardFunctions, imeSelectionFunctions, imeInputMethods, imeUnicodeFunctions ); TInterfaceMenuEntries = set of TInterfaceMenuEntry;

On windows we also have Undo item. Maybe on carbon/qt also something special?

Best regards,
Paul Ishenin.

Reply by email

Mattias Gaertner
to Paul Ishenin
Show quoted text 17 lines
Mattias G?rtner wrote: > This is an implementation of my second proposal. It needs > parameters to define what to add. For example: > > TPopupMenu.AddDefaultItems(AControl: TWinControl; SkipMenuEntries: > TInterfaceMenuEntries); > > type > TInterfaceMenuEntry = ( > imeClipboardFunctions, > imeSelectionFunctions, > imeInputMethods, > imeUnicodeFunctions > ); > TInterfaceMenuEntries = set of TInterfaceMenuEntry; On windows we also have Undo item. Maybe on carbon/qt also something special?

Just add what you think is appropriate.
Or do you propose something other than a set?

Mattias

Reply by email

Michael Van Canneyt
to Paul Ishenin: On windows we also have Undo item. Maybe on carbon/qt also something special? Paul…
Paul Ishenin wrote 16 lines
Mattias G?rtner wrote: > This is an implementation of my second proposal. It needs parameters to > define what to add. For example: > > TPopupMenu.AddDefaultItems(AControl: TWinControl; SkipMenuEntries: > TInterfaceMenuEntries); > > type > TInterfaceMenuEntry = ( > imeClipboardFunctions, > imeSelectionFunctions, > imeInputMethods, > imeUnicodeFunctions > ); > TInterfaceMenuEntries = set of TInterfaceMenuEntry; On windows we also have Undo item. Maybe on carbon/qt also something special?

Many thanks to both Paul and Mattias for all the menu fixes !

I closed all related bugreports.

Michael.

Reply by email