osswald@serv1.uucp (Tim Osswald) (08/21/90)
Hello again, I have got things running now so that my window opens on 0,0. This was done by putting the line XCadPress*geometry: +0+0 in my Xdefaults file. Even though this is a good temporary solution, I would still much prefer to set this in the program, It is too easy for someone not to know to do this, and mess up the way the program is displayed. I then tried taking Michael Yee's suggestion to set these resources on my toplevel shell. It still doesn't set the x and y (don't know why) but I now at least get the proper window title. I also already have Mwm*clientAutoPlace set to False. Here is the relevant code of my program: MrmInitialize(); XtToolkitInitialize(); draw_display = XtOpenDisplay(NULL,NULL,"XCadPress", "XCadPress",NULL,0,&argc,argv); i=0; XtSetArg(args[i],XmNheight,750); i++; XtSetArg(args[i],XmNwidth,750); i++; XtSetArg(args[i],XmNx,0); i++; XtSetArg(args[i],XmNy,0); i++; XtSetArg(args[i],XmNtitle,window_name); i++; toplevel=XtAppCreateShell("XCadPress","XCadPress", applicationShellWidgetClass,draw_display,args,i); if (MrmOpenHierarchy(db_filename_num,db_filename_vec, NULL,&s_DRMHierarchy) != MrmSUCCESS) { printf("Error opening Hierarchy! \n"); exit(-1); } MrmRegisterNames(reglist, reglist_num); if (MrmFetchWidget(s_DRMHierarchy,"S_MAIN_WINDOW",toplevel, &main_widget, &dummy_class) != MrmSUCCESS) { printf("Error opening main window! \n"); exit(-1); } XtManageChild(main_widget); XtRealizeWidget(toplevel); XtMainLoop(); Sorry to keep this topic running but I need to get this to work right, and several people mailed me to keep them informed on any developments, they appear to be having the same problems I am. Again please direct any replies to address at the bottom. -john- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= John Hester internet: hester@ececci.ece.wisc.edu VAX Systems Manager bitnet: hester%ececci.decnet@wiscmacc Departement of Electrical Engineering University of Wisconsin - Madison ------------------------------------------------------------------------------- badgers --- BADGERS ---- we don't need no stinking BADGERS! =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
argv@turnpike.Eng.Sun.COM (Dan Heller) (08/21/90)
In article <244@erb1.engr.wisc.edu> osswald@serv1.uucp (Tim Osswald) writes: > XCadPress*geometry: +0+0 > in my Xdefaults file. Even though this is a good temporary solution, I would > still much prefer to set this in the program, It is too easy for someone > not to know to do this, and mess up the way the program is displayed. Use the XtNgeometry resource. Thus, instead of: > XtSetArg(args[i],XmNheight,750); i++; > XtSetArg(args[i],XmNwidth,750); i++; > XtSetArg(args[i],XmNx,0); i++; > XtSetArg(args[i],XmNy,0); i++; Use: > XtSetArg(args[i], XtNgeometry, "750x750+0+0"); i++; -- dan ---------------------------------------------------- O'Reilly && Associates argv@sun.com / argv@ora.com Opinions expressed reflect those of the author only.
krs0@GTE.COM (Rod Stephens) (08/21/90)
In article <244@erb1.engr.wisc.edu> osswald@serv1.uucp (Tim Osswald) writes: > >I have got things running now so that my window opens on 0,0. This was done >by putting the line > > XCadPress*geometry: +0+0 > >in my Xdefaults file... After seeing this I tried putting the following in an app-defaults file for one of my applications and it worked: *geometry: +0+0 This file would be called /usr/lib/X11/app-defaults/<AppClass> where <AppClass> is the application class name you use in your call to XtAppCreateShell (in your case the second use of "XCadPress"). The advantage of this over your .Xdefaults file is that all the users share it: you create the file and they don't even need to know about it. +---------------------------------------------------------------+ | Rod Stephens | "Haven't I told you not to play | | GTE Laboratories, Inc | with my super-weapons? You might | | (617)466-4182 | devastate yourself!" | | krs0@gte.com | | +---------------------------------------------------------------+
asente@adobe.com (Paul Asente) (08/22/90)
In article <141019@sun.Eng.Sun.COM> argv@turnpike.Eng.Sun.COM (Dan Heller) writes: >Use the XtNgeometry resource. Thus, instead of: >> XtSetArg(args[i],XmNheight,750); i++; >> XtSetArg(args[i],XmNwidth,750); i++; >> XtSetArg(args[i],XmNx,0); i++; >> XtSetArg(args[i],XmNy,0); i++; >Use: >> XtSetArg(args[i], XtNgeometry, "750x750+0+0"); i++; This is a Very Very bad thing to do. Not on the same level as committing serial axe murders, but bad nonetheless. Here's why: There are flags that an application passes to the window manager that tell whether the geometry the application specified came from the user or from the application. Many window managers pay attention to these flags; usually they place the window as requested if the flags say the geometry came from the user and use some other placement option (like asking the user) if the geometry came from the application. The Toolkit sets these flags by looking at whether or not the geometry resource is specified: having a geometry resource indicates user specified, and not having a geometry resource indicates program specified. If your application sets the geometry resource itself, it is lying to the window manager, claiming that the user specified the geometry. Now, why should you as a programmer feel obliged not to lie with the window manager? If you do this, there's no longer any way for a user who *wants* interactive position to get it. You may not personally care about this, but, rest assured, somebody will. So, briefly: To give the application's suggested geometry, set the x, y, width, and height. Do not set the geometry. A user who always wants a particular geometry can put a app.geometry: line in his or her .Xdefaults file. A user who wants interactive positioning sets nothing. -paul asente New address! asente@adobe.com ...decwrl!adobe!asente
argv@turnpike.Eng.Sun.COM (Dan Heller) (08/22/90)
In article <5792@adobe.UUCP> asente@adobe.com (Paul Asente) writes: > In article <141019@sun.Eng.Sun.COM> argv@turnpike.Eng.Sun.COM (Dan Heller) writes: > >Use the XtNgeometry resource. Thus, instead of: > >> XtSetArg(args[i],XmNheight,750); i++; > >> XtSetArg(args[i],XmNwidth,750); i++; > >> XtSetArg(args[i],XmNx,0); i++; > >> XtSetArg(args[i],XmNy,0); i++; > >Use: > >> XtSetArg(args[i], XtNgeometry, "750x750+0+0"); i++; > This is a Very Very bad thing to do. Not on the same level as committing > serial axe murders, but bad nonetheless. Here's why: Your explanation was good, and I take blame for not having made this absolutely clear when I made the above statements. *however*: > Now, why should you as a programmer feel obliged not to lie with the window > manager? If you do this, there's no longer any way for a user who *wants* > interactive position to get it. This is *presicely* why I made the suggestion. The poster was requesting help in knowing exactly how to do that. I was just answering his question. -- dan ---------------------------------------------------- O'Reilly && Associates argv@sun.com / argv@ora.com Opinions expressed reflect those of the author only.