[comp.windows.open-look] Window

871579l@aucs.AcadiaU.ca (Todd Lowe) (03/04/91)

I'm having a few problems getting x-view to put my windows where I want
them.  I want the first to open anywhere, but the second to open
directly below it on the display.

I'm trying:

 frame = (Frame)xv_create(NULL,      FRAME,  
	   FRAME_LABEL,      argv[0],
	   FRAME_SHOW_FOOTER,TRUE,   
	   NULL);                    

This creates my first frame fine. Then I create a panel and some buttons
on it and call:

   windowfit(panel);windowfit(frame);

After this I create another frame:

subframe = (Frame)xv_create(frame, FRAME, 
      FRAME_LABEL,       "Command Output:",  
      XV_X,              xv_get(frame,XV_X),
	 XV_Y,              xv_get(frame,XV_Y)+xv_get(frame,XV_HEIGHT),            
	 XV_WIDTH,          xv_get(frame,XV_WIDTH),
      XV_HEIGHT,         xv_get(frame,XV_HEIGHT),
      FRAME_SHOW_FOOTER, TRUE,
	 XV_SHOW,           TRUE,
	 NULL);                   

I want this 'subframe' to be the same size as frame and be placed
directly below it.  (X possition the same, but Y possition lower 
on the screen by frame's height.)  It does get the correct size,
but both frames are displayed in random(?) possitions rather than
the 2nd being displayed relative to the frist.

Any help with this problem would be appreciated.

-Todd Lowe
871579l@aucs.acadiaU.CA
todd@falcon.acadiaU.CA

kneller@dufy.mmwb.ucsf.edu (Don Kneller) (03/06/91)

871579l@aucs.AcadiaU.ca (Todd Lowe) writes:


>I'm having a few problems getting x-view to put my windows where I want
>them.  I want the first to open anywhere, but the second to open
>directly below it on the display.

I would have thought XV_X and XV_Y could be used for positioning windows
relative to the server, but in fact they are used for positioning items
on panels.

I have used frame_{g|s}et_rect() successfully:

	/*
	 * Create main and mode objects
	 */
	main_obj = main_main_objects_initialize(NULL, NULL);
	mode_obj = main_popup_objects_initialize(NULL, main_obj->main);

	/*
	 * Position the window and popup (subframe)
	 */
	frame_get_rect((Frame) main_obj->main, &rect);
	left = rect.r_top = rect.r_left = 0;
	bottom = rect.r_top + rect.r_height;
	frame_set_rect((Frame) main_obj->main, &rect);

	frame_get_rect((Frame) mode_obj->popup, &rect);
	rect.r_left = left;
	rect.r_top = bottom;
	frame_set_rect((Frame) mode_obj->popup, &rect);


	/*
	 * Show them.
	 */
	xv_set(main_obj->main, XV_SHOW, TRUE, 0);
	xv_set(mode_obj->popup, XV_SHOW, TRUE, 0);

- don