[gtkada] Underlined menu shortcuts

Larry Elmore ljelmore at home.com
Sat May 26 06:52:16 CEST 2001


Larry Elmore wrote:
> 
> Preben Randhol wrote:
> >
> > Larry Elmore <ljelmore at home.com> wrote on 25/05/2001 (10:07) :
> > > What in the world is the GtkAda equivalent to C's "GTK_LABEL (GTK_BIN
> > > (kon_tiki1)->child)"???
> >
> > Have you tried?
> >
> > with Gtk.Bin; use Gtk.Bin;
> >
> >   Child := Get_Child (kon_tiki1);
> 
>    Parse_Uline(Gtk_Label (Get_Child(Window1.New_Window1)), "_New
> Window");
> 
> compiles properly, but fails to run:
> 
>    raised STORAGE_ERROR : stack overflow (or erroneous memory access)
> 
> It looks like the only thing that works is the straightforward but
> clunkier approach of adding a bunch of Gtk_Labels to menu items created
> without labels. Instead of adding one line of code for each menu item,
> it's four lines, plus a fifth one modified. Oh well. At least it
> works... (why I didn't try this approach earlier, I haven't the faintest
> clue) :-(

Hmmh, the above Parse_Uline() runs properly if the Gtk.Label is created
separately, and then added to the menu item, but raises an exception if
it was created implicitly. Strange.
 
> Until I get to adding drag'n'drop support, I don't think the rest will
> be too bad. I hope! :)

Criminy! Separately created labels display underlined characters okay in
menus, but the drop-down menu-items are all center-justified, and
there's _no_ way to left-justify them again (left-justify has no effect
unless the text is wider than the label and carries over to the next
line)! How stupid is _that_? Worse, the hints for the regular keyboard
shortcuts have disappeared! Arrgghhh!!!

I expected a steep learning curve, but this is ridiculous! There's one
thing left to try, an item factory. If that doesn't work, then I give up
on underlined menu shortcuts. If it weren't that C/C++ gives me hives,
I'd almost consider just using that instead of Ada for this project.
Yeesh!

Larry



More information about the gtkada mailing list