[Lazarus] TPopupMenu bug

Osvaldo Filho arquivostcf at gmail.com
Mon May 18 15:30:58 CEST 2009


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;




Em Seg, 2009-05-18 às 15:20 +0200, Michael Van Canneyt escreveu:
> 
> On Mon, 18 May 2009, Paul Ishenin wrote:
> 
> > Mattias Gärtner wrote:
> >> Zitat von Michael Van Canneyt <michael at freepascal.org>:
> >> 
> >>> [...]
> >>> 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 Lazarus at lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus





More information about the Lazarus mailing list