--============_-1327995733==_============
Content-Type: text/enriched; charset="us-ascii"
Can anyone out there tell me what am I doing wrong in trying to create
a menu bar (windows style). When I vary the y dimension in the
following code
<bigger><bigger> from fl_bgn_form(FL_UP_BOX,280,90);
to fl_bgn_form(FL_UP_BOX,280,30);
the contents of the menu can not be seen.
I am attaching the test file I'm trying to run; would appreciate your
help
thanks
</bigger></bigger>
--============_-1327995733==_============
Content-Type: text/plain; name="pup2.c"; charset="us-ascii"
Content-Disposition: attachment; filename="pup2.c"
#include "forms.h"
#include <stdlib.h>
FL_FORM *pup;
FL_OBJECT *done, *pret, *menu;
void create_form_pup(void);
void init_menu(void);
int main(int argc,char *argv[])
{
fl_initialize(&argc, argv, "FormDemo", 0, 0);
create_form_pup();
/* initialize */
fl_set_form_position(pup, 0, 0 );
fl_show_form(pup, FL_PLACE_GEOMETRY, FL_TRANSIENT,"");
init_menu();
fl_do_forms();
return 0;
}
void init_menu(void)
{
int mm,smm;
mm = fl_newpup(fl_default_win());
fl_setpup_bw(mm, -2);
fl_setpup_shadow(mm, 0);
smm = fl_newpup(0);
fl_setpup_shadow(smm, 0);
fl_addtopup(mm,"MenuItem1|MenuItem2%m|MenuItem3",smm);
fl_addtopup(smm,"SubItem1%x11|SubItem2%x12|SubItem3%x13");
/* attach pup to menu */
fl_set_menu_popup(menu, mm);
}
void do_menu(FL_OBJECT *ob, long data)
{
char buf[128];
if(fl_get_menu(ob) >= 0)
sprintf(buf,"%d [%s]", fl_get_menu(ob), fl_get_menu_text(ob));
else
sprintf(buf,"%d", fl_get_menu(ob));
fl_set_object_label(pret, buf);
}
void done_cb(FL_OBJECT *ob, long data)
{
exit(0);
}
void create_form_pup(void)
{
FL_OBJECT *obj;
if (pup)
return;
pup = fl_bgn_form(FL_UP_BOX,280,30);
done = obj = fl_add_button(FL_NORMAL_BUTTON,190,55,90,35,"Done");
fl_set_object_callback(obj,done_cb, 0);
menu = obj = fl_add_menu(FL_PULLDOWN_MENU,0,0,60,25,"Menu");
fl_set_object_callback(obj, do_menu, 0);
pret = obj = fl_add_text(FL_NORMAL_TEXT,60,25,220,30,"");
fl_set_object_lalign(obj,FL_ALIGN_CENTER);
fl_end_form();
}
--============_-1327995733==_============--
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
Xforms Home Page: http://bloch.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/