victorv@issi.lcs.mit.EDU (Victor Villalpando) (05/21/91)
Below is a sample program that uses the old SunView API for creating a button along with the XView API to create the same thing. Now, since the old mannar provides a means of passing a font as an argument to the create call I can set any font & size I like and everything works fine. My question is...Will the next version of XView provide the same capability or has this function just been left in for compatability reasons? Also using the old SunView renders a rectangle type of button and the default XView renders the oval type of button. Is there a way other than what I have here to render the same type of rectangle button using XView? The rectangle button looks nicer. o<--------------------------- cut here --------------------------------------- #include <xview/xview.h> #include <xview/panel.h> #include <xview/font.h> static Frame frame = (Frame) NULL; static Panel panel = (Panel) NULL; static Panel_item quit_button = (Panel_item) NULL; main(argc,argv) int argc; char **argv; { void change_proc(), quit_proc(); Xv_Font myfont; xv_init( XV_INIT_ARGC_PTR_ARGV, &argc, argv, 0 ); /* create the frame, panel, scrolling list */ frame = xv_create( 0, FRAME, XV_LABEL, "Button API Test...", FRAME_SHOW_FOOTER,TRUE, 0 ); panel = xv_create( frame, PANEL, PANEL_LAYOUT, PANEL_VERTICAL, 0 ); myfont = (Xv_Font)xv_find(frame, FONT, FONT_NAME, "Courier-boldoblique-24", NULL); xv_create( panel, PANEL_BUTTON, PANEL_LABEL_IMAGE, panel_button_image(panel,"Change Style",10,myfont,0), PANEL_NOTIFY_PROC, change_proc, 0 ); xv_set( panel, PANEL_LAYOUT, PANEL_HORIZONTAL, 0 ); quit_button=xv_create( panel, PANEL_BUTTON, PANEL_LABEL_STRING, "Quit", PANEL_NOTIFY_PROC, quit_proc, 0 ); window_fit( panel ); window_fit( frame ); xv_main_loop( frame ); } /* ** quit_proc(). This function will destroy the window. */ void quit_proc() { xv_destroy_safe(panel); xv_destroy_safe(frame); exit(0); } /* ** change_proc(). This function will set the quit button to the rectangle ** type using the old SunView API. */ void change_proc() { xv_set(quit_button,PANEL_LABEL_IMAGE, panel_button_image(panel,"Quit",2,0)); } ---------------------------------------------------------------------------- Victor Villalpando International Software Systems Inc. Austin. TX USA victorv@issi.uucp