Hi! Although it seems, that I'm alone on this list I'm not too shy to ask another question. I'm in the process of porting a small editor MP,
http://www.triptoco.com to PGUI. I have the problem, that this editor has dynamic menues. This means, I need to make a menu, step by step, hide it and let it pop up, if I press the button in the uppermost menubar. This is a wellknown task in many other widget toolkits. The problem is, that PGUI does not have such a "menu" widget. Maybe, this is not needed... All the examples that come with PGUI seem to use hardcoded menues. They work in that way, that they build up the menu at the time, where a callback funtion is called. But this means, that the menu is hardcoded in this function. I now want to bring up a dynamic menu instead. Here is my try on a generic callback function for all menues. It looks, from which Widget it is called and decides then what menu to bring up. For now only a box pops up: int _mpv_menu_callback(struct pgEvent *evt) /* menu click callback */ { pghandle result,toolbar; /* Do our own context management */ pgEnterContext(); /* Get the widget we come from */ result = pgGetWidget(pgGetEvent()->from,PG_WP_TEXT); if (result) pgMessageDialogFmt("Menu results",0, "You selected \"%s\"", pgGetString(result)); /* Clean-up time */ pgLeaveContext(); return 0; } Yes, possibly you know this code. My problem is: I do now the same, but don't want to bring up a box, but a menu: int _mpv_menu_callback(struct pgEvent *evt) /* menu click callback */ { pghandle result,toolbar; /* Do our own context management */ pgEnterContext(); /* Get the widget we come from */ result = pgGetWidget(pgGetEvent()->from,PG_WP_TEXT); if (result) { /* Create a popup menu at the cursor with automatic sizing */ pgNewPopupAt(PG_POPUP_ATEVENT,PG_POPUP_ATEVENT, PGDEFAULT,PGDEFAULT); pgNewWidget(PG_WIDGET_LABEL,0,0); pgSetWidget(PGDEFAULT, PG_WP_TEXT,pgNewString("Click something:"), 0); } /* Clean-up time */ pgLeaveContext(); return 0; } The strange thing is: If I put the menu on top of the "if (result)", everything works fine. So it seems to me, that the line, which finds out the callee widget, breaks something. This is a bug, or I make a mistake - well, I'm totally new to pgui. So: What does the pgNewPopupAt() routine need, that it can not show up, like the routine pgMessageDialogFmt()? Thanks in advance... -- Martin Doering ------------------------------------------------------- Sponsored by: ThinkGeek at http://www.ThinkGeek.com/ _______________________________________________ Pgui-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/pgui-devel
