warner%s3snorkel@SCUBED.ARPA (Ken Warner) (05/01/88)
On page 31 of X Toolkit Widgets there is documented a function called
XtDialogCreate()...there is no such animal in libX11.a or libXaw.a.
There is no font resource for the Dialog Widget or for buttons; am I correct?
Will there be?
Does anyone have any spiffy buttons. Buttons with round ends or radio buttons?
Lastly, I noticed that when resizing a widget that contained other widgets and
labels that the bitmap representing the label became distorted. At first I
thought that the font had somehow been changed but then found there is no font
resource. I think there is a counting error during resizing that affects the
bitmap, thereby distorting the label.
Below is the program I was foolin' around with. Compile in the usual way and
resize it a few times. Did the appearance of the labels change for you?
--------------------------------------------------------------------------------
#include <X11/Intrinsic.h>
#include <X11/Atoms.h>
#include <X11/Form.h>
#include <X11/Label.h>
#include <X11/Dialog.h>
#include <X11/Command.h>
void Callback(widget,clientData,callData)
Widget widget;
caddr_t clientData,callData;
{
(void)printf("Goodbye, cruel world\n");
exit();
}
void SecondCallback(widget,clientData,callData)
Widget widget;
caddr_t clientData,callData;
{
(void)printf("Big Button\n");
exit();
}
void ThirdCallback(widget,clientData,callData)
Widget widget;
caddr_t clientData,callData;
{
(void)printf("Little Button\n");
exit();
}
int main(argc,argv)
int argc;
char **argv;
{
Widget toplevel,box,dialog_box,dialog,label,command;
Widget XtDialogCreate(),Xtinitialize(),XtCreateManagedWidget();
Arg arg[25];
unsigned int n;
toplevel = XtInitialize("goodbye","Goodby",NULL,0,&argc,argv);
box = XtCreateManagedWidget("box",formWidgetClass,toplevel,(Arg *)NULL,0);
/*XtDialogCreate(dialog_box,"dialog_box","foo-bar",(Arg *)NULL,0);*/
n = 0;
XtSetArg(arg[n],XtNx,10); n++;
XtSetArg(arg[n],XtNy,10); n++;
XtSetArg(arg[n],XtNlabel,"Goodby, world"); n++;
label = XtCreateManagedWidget("label",labelWidgetClass,box,arg,n);
n = 0;
XtSetArg(arg[n],XtNx,10); n++;
XtSetArg(arg[n],XtNy,40); n++;
XtSetArg(arg[n],XtNfromVert,label); n++;
XtSetArg(arg[n],XtNvertDistance,10); n++;
XtSetArg(arg[n],XtNlabel,"Click and die"); n++;
command = XtCreateManagedWidget("command",commandWidgetClass,box,arg,n);
XtAddCallback(command,XtNcallback,Callback,NULL);
n = 0;
XtSetArg(arg[n],XtNx,10); n++;
XtSetArg(arg[n],XtNy,110); n++;
XtSetArg(arg[n],XtNlabel,"Dialog Box"); n++;
XtSetArg(arg[n],XtNwidth,50); n++;
XtSetArg(arg[n],XtNfromVert,command); n++;
XtSetArg(arg[n],XtNvertDistance,10); n++;
XtSetArg(arg[n],XtNvalue,"Some Value"); n++;
dialog = XtCreateManagedWidget("dialog",dialogWidgetClass,box,arg,n);
XtDialogAddButton(dialog,"Big Button",SecondCallback,NULL);
XtDialogAddButton(dialog,"Little Button",ThirdCallback,NULL);
XtRealizeWidget(toplevel);
XtMainLoop();
}swick@ATHENA.MIT.EDU (Ralph R. Swick) (05/14/88)
Date: Sat, 30 Apr 88 19:11:57 PDT
From: warner%s3snorkel@scubed.ARPA (Ken Warner)
On page 31 of X Toolkit Widgets there is documented a function called
XtDialogCreate()...there is no such animal in libX11.a or libXaw.a.
Documentation bug. Use XtCreateWidget().
There is no font resource for the Dialog Widget or for buttons; am I correct?
Will there be?
Dialog is a composite widget that uses Label, Text and Command. All three
of the components have font resources and a specification of the form
'*Dialog*Font' will allow you to specify them as a group.