The question is self-explaining, how to create a tearoff menu using GTKAda? I can't make it work.
Thanks.
The question is self-explaining, how to create a tearoff menu using GTKAda? I can't make it work.
Thanks.
Not sure if this is what you are looking for, but the GtkAda reference manual says:
All the menus in GtkAda can be "Tear off" menus, i.e you can detach them from their parent (either a menu bar or another menu) to keep them visible on the screen at all times).
So it sounds as if you don't have to do anything.
If you added the code you have to your question it would be more descriptive.
I've written a bit of code to demonstrate the usage of the tear off menu with GTKAda, it's not so difficult, but it may be hard to find documentation about it:
function CreateFileMenu(tearOff : boolean) return Gtk_Menu is
fileMenu : Gtk_Menu;
newFile, loadFile, saveFile, saveAs, close : Gtk_Menu_Item;
begin
-- Create the menu:
Gtk_New(fileMenu);
-- Add the tear off item to the menu if required:
if tearOff then
declare
tear : Gtk_Tearoff_Menu_Item;
begin
Gtk_New(tear);
Append fileMenu, tear);
Show(tear);
end;
end if;
-- Create the rest of the menu items:
Gtk_New_With_Mnemonic(newFile, "_New");
Gtk_New_With_Mnemonic(loadFile, "_Load");
Gtk_New_With_Mnemonic(saveFile, "_Save");
Gtk_New_With_Mnemonic(saveAs, "Save _as...");
Gtk_New_With_Mnemonic(close, "_Close");
-- Add the items to the menu:
Add(fileMenu, newFile);
Add(fileMenu, loadFile);
Add(fileMenu, saveFile);
Add(fileMenu, saveAs);
Add(fileMenu, close);
return fileMenu;
end CreateFileMenu;
The declare/begin/end
structure allows you to declare variables in run time.
The boolean
parameter allows you decide if you want it to be a tear off menu when you create it. The function just creates the menu so you'd have to add it to a menu bar (for example) later.