Other XPopup Routines (XForms (Forms Library) - Version 1.2 (Rev. 4) A Graphical User Interface Toolkit for X)

Next: XPopup Attributes, Previous: XPopup Interaction, Up: XPopup [Contents][Index]

#### 23.3.3 Other XPopup Routines

Note that most of the setpup/getpup routines are recursive in nature and the function will search the menu and all its submenus for the item.

It is possible to modify the display characteristics of a given XPopup item after its creation using the following routine

    void fl_setpup_mode(int popup_id, int item_val, unsigned mode);

As usual `popup_id` is the XPopup ID as returned by `fl_newpup()` or `fl_defpup()` and `item_val` the value of the item. `mode` is one of `FL PUP NONE`, `FL PUP GREY`, `FL PUP BOX` or `FL PUP RADIO` (one of the later two can be bitwise ORed with `FL_PUP_CHECK`, as already discussed above.

To obtain the mode of a particular menu item, use the following routine

    unsigned int fl_getpup_mode(int popup_id, int item_val)

This comes in handy to check if a binary or radio item is set

    if (fl_getpup_mode(popupd, item_val) & FL_PUP_CHECK)
        /* item is set */

There exists also a routine that can be used to obtain an items text

    const char *fl_getpup_text(int popup_id, int item_val);

In some situations, especially when the popup is activated by non-pointer events (e.g., as a result of a keyboard shortcut), the default placement of popups based on mouse location might not be adequate or appropriate, thus XPopup provides the following routine to override the default placement

    void fl_setpup_position(int x, int y);

where `x` and `y` specify the location where the top-left corner of the popup should be. `x` and `y` must be given in screen coordinates (i.e., relative to the root window) with the origin at the top-left corner of the screen. This routine should be used immediately before invoking `fl_dopup()`, the position is not remembered afterwards.

If `x` or `y` is negative, the absolute value is taken to mean the desired location relative to the right or bottom corner of the popup (not the screen!).

Another function exists for controlling the positon of the popup. When the fuunction

    void fl_setpup_align_bottom(void);

then the pop-up will appear with its lower right hand corner aligned aligned with the mouse position or, if also `fl_setpup_position()` is active, the postion set this way will be interpreted to mean the lower right hand position of the popu-up.

A radio item in a group can be initialized to be in "pushed" state by using `%R`. But you can also switch a such a radio item to "pushed state also programmatically using

    void fl_setpup_selection(int popup_id, int item_val);

Of course, other radio items of the XPopup belonging to the same group are reset to "unpushed" state.

To obtain the number of items in a popup, use the following routine

    int fl_getpup_items(int popup_id)

Next: XPopup Attributes, Previous: XPopup Interaction, Up: XPopup [Contents][Index]