Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wasatch!cs.utexas.edu!pp!kauai!duanev From: duanev@kauai.ACA.MCC.COM (Duane Voth) Newsgroups: comp.windows.x Subject: Re: tabs in xedit Summary: not a perfect fix but quite useable Keywords: xedit Message-ID: <130@kauai.ACA.MCC.COM> Date: 22 Mar 89 04:31:48 GMT References: <421b1e62.142c4@retina.engin.umich.edu> Distribution: na Organization: MCC, Austin, TX Lines: 97 I haven't found any way to call the SetTabs "method" provided for TextSinks in ascii*Widgets but the following hack works reasonably well. patch for xedit.c... *** xedit.c Wed Feb 8 19:36:39 1989 --- xedit.c.00 Tue Feb 7 10:57:09 1989 *************** *** 82,90 **** XtTextSource source, asource, dsource, psource, messsource; extern DoQ(); - extern void SetDefaultTabs(); - makeButtonsAndBoxes() { int boxHeight; --- 82,88 ---- *************** *** 141,147 **** MessArgs[1].value = (XtArgVal)XtAsciiSinkCreate(outer, NULL, 0); messwidget = XtCreateManagedWidget("messageWindow", textWidgetClass, outer, MessArgs, XtNumber(MessArgs)); - SetDefaultTabs(messwidget); XtPanedSetMinMax((Widget) messwidget, 40, 40); labelwindow = XtCreateManagedWidget("labelWindow",labelWidgetClass, --- 139,144 ---- *************** *** 151,157 **** TextArgs[1].value = (XtArgVal)XtAsciiSinkCreate(outer, NULL, 0); textwindow = XtCreateManagedWidget("editWindow", textWidgetClass, outer, TextArgs, XtNumber(TextArgs)); - SetDefaultTabs(textwindow); XtPanedSetRefigureMode(outer, TRUE); } --- 148,153 ---- new file tabs.c... /* * Set tabs to the usual every-8-stops standard * * This file exists outside of xedit.c cause I can't find a way to * access widget->text.sink->SetTabs without including all the * private Xt h files. * * 02/08/89 - duanev@mcc - created * */ #include #include #include #include #include #include #define TAB_COUNT 32 void SetDefaultTabs(widget) Widget widget; { Arg args[1]; Dimension leftmargin; XtTextSink sink = ((TextWidget)widget)->text.sink; void (*NullProc)() = NULL; /* some compilers require this */ Position tabs[TAB_COUNT], tab; int i; if (sink->SetTabs != NullProc) { XtSetArg(args[0], XtNleftMargin, &leftmargin); XtGetValues(widget, args, XtNumber(args)); for (i=0, tab=leftmargin; iSetTabs) (widget, leftmargin, TAB_COUNT, tabs); } } and of course, add tabs.[co] to the Imakefile -- --- Effectiveness is the measure of Truth: ---- ALL systems are arbitrary! --- duane voth duanev@mcc.com --