Programming Guide |
Gets the ID of an option menu or combo box
int sm_optmnu_id(void);
- · An integer handle that uniquely identifies an option menu or combo box.
- ·
PR_NULL_OBJID
: Unable to identify an option menu or combo box.
sm_optmnu_id
gets the object ID property of an option menu or combo box that is initialized on popup from an external screen (initialization
=PV_FILL_AT_POPUP
); this function can only be called by the external screen's entry function; otherwise, it returnsPR_NULL_OBJID
. (For more information about initializing option menu data, refer to "Using Data from an External Source" in Using the Editors.)For example, you might have two option menus that are initialized from the same external screen but require different sets of data. The external screen's entry function can call
sm_optmnu_id
to get the ID of its caller and thereby determine which database query fetches the required data:/* get the option menu's ID */
vars opt_id
opt_id = sm_optmnu_id()
dbms declare cursor c1
dbms with cursor c1 alias array1
/* query the database according to option menu name */
if @id(opt_id)->name == "ratings_opt"
{
dbms declare cursor c1 \
select rating_code from titles \
group by rating_code order by 1
}
else if @id(opt_id)->name == "genre_opt"
{
dbms declare cursor c1 \
select descr from codes \
where code_type = 'genre_code' order by 1
}
dbms with cursor c1 execute
dbms close cursor c1
return