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.

Mailing lists / lazarus / 2009-05
22 messages · 8 people · –
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
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.
I searched the bug tracker but found nothing
The PopupMenu property of TMemo does not work in GTK 2. I always get some standard GTK…
Is it related to this behaviour ?
http:/msg04840.html
Brad
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.
Zitat von Paul Ishenin :
"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
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.
Zitat von Paul Ishenin :
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
Zitat von Paul Ishenin : "just wants to replace system popup menu with his own" I don't…
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.
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/
And how it worked in LCL-win32 and LCL-gtk2 now.
Best regards,
Paul Ishenin.
I think that if I specify my own TPopupMenu, then that should replace whatever GTK thinks…
Zitat von Michael Van Canneyt :
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
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.
Zitat von Michael Van Canneyt : I don't know what windows has as default menu items. Ok,…
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.
Good idea, but maybe add a parameter:
TPopupMenu.AddDefaultItems(AControl: TWinControl; SkipExisting: Boolean = true);Michael.
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;I don't think so; The point is that the system should behave the same on all platforms,…
Zitat von Michael Van Canneyt :
I can't follow you. Just because a widgetset does not support something, does not mean we disable this on all platforms.
Mattias
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.
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 :
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
On windows we also have Undo item. Maybe on carbon/qt also something special?
Best regards,
Paul Ishenin.
Just add what you think is appropriate.
Or do you propose something other than a set?
Mattias
On windows we also have Undo item. Maybe on carbon/qt also something special? Paul…
Many thanks to both Paul and Mattias for all the menu fixes !
I closed all related bugreports.
Michael.
On Mon, 18 May 2009 22:40:42 +0800 Just add what you think is appropriate. Or do you…
Mattias Gaertner wroteJust add what you think is appropriate. Or do you propose something other than a set?
No, set is ok.
Where to place windows Undo item and iirc Qt also has Undo/Redo items - imeUndoFunctions?
What with osx? What items edits/memos have there?
Best regards,
Paul Ishenin.