XSPopup

SYNTAX

        wid=XSPopup(parent,x,y,width,height,list,pointer)

        XSWidget *wid,*parent;
        int  x,y,width,height,*pointer;
	char **list;

DESCRIPTION

XSPopup create a popup widget inside the selected parent, in the position x,y with size width,height. When you click in this widget, a popup menu will be open with options defined in the list and the index of selected item will be stored in *pointer. The list list must be a NULL terminated array of pointers to C strings. Only integer values are supported and will range from 0 to your desktop height/21 (by this time).

All operations of XSPopup in the X server are delayed until XSCheckEvent is executed.

Example

#include <xstep.h>
#include <stdlib.h>
#include <stdio.h>

int main(int argc,char **argv) {

	XSWidget *d1,*w1;
	int pointer=0;
	
	char *list[]={

		"68000",
		"68010",
		"68020",
		"68030",
		"68040",
		"68060",
		NULL,
	};
	
	d1=XSDesktop(getenv("DISPLAY"),argv,argc);
	w1=XSWindow(d1,0,0,400,400,"popup example");
	   XSPopup(w1,8,8,200,21,list,&pointer);
	   XSButton(w1,-8,-8,72,24,"Close",XSWindowClose);
	
	while(XSCheckEvent(d1,XS_BLOCK))
		printf("pointer %d: %s\n",pointer,list[pointer]);

	return 0;
}