/* File: multiple_selection_lists.c This is a simple example program of how to use the Otk_Coordinate_Selection_Lists function. It creates three lists that are linked together by a common scroll-bar. */ /* Created by OTK GUI-Builder v0.23 */ /* Compile on Linux with: cc -I/usr/X11R6/include -L/usr/X11R6/lib multiple_selection_lists.c \ -lGLU -lGL -lXmu -lXext -lX11 -lm -o multiple_selection_lists */ #include "otk_lib/otk_lib.c" OtkWidget panel0, sel1, sel2, sel3; void populate_lists( int N ) { int j; char text[100]; for (j=0; j < N; j++) /* Place some dummy values in the selection lists. */ { sprintf(text,"A%d", j ); Otk_Add_Selection_Item( sel1, text, 0, 0 ); sprintf(text,"B%d", j ); Otk_Add_Selection_Item( sel2, text, 0, 0 ); sprintf(text,"C%d", j ); Otk_Add_Selection_Item( sel3, text, 0, 0 ); } } void quit( void *data ) /* Action for the Quit button. */ { exit(0); } main( int argc, char **argv ) { float x1, width, y1, height; int rows=14, cols=10; OtkInitWindow( 610, 600, argc, argv ); panel0 = OtkMakePanel( OtkOuterWindow, Otk_Raised, Otk_LightGray, 8, 12, 80, 76 ); Otk_SetBorderThickness( panel0, 0.4 ); x1 = 10; width = 25; y1 = 20; height = 45; sel1 = Otk_Make_Selection_List( panel0, rows, cols, x1, y1, width, height ); x1 = x1 + width + 1; sel2 = Otk_Make_Selection_List( panel0, rows, cols, x1, y1, width, height ); x1 = x1 + width + 1; sel3 = Otk_Make_Selection_List( panel0, rows, cols, x1, y1, width, height ); Otk_Coordinate_Selection_Lists( sel3, sel1 ); Otk_Coordinate_Selection_Lists( sel3, sel2 ); populate_lists( 60 ); OtkMakeButton( panel0, 44, 87, 12, 8, "Quit", quit, 0 ); OtkMainLoop(); }