[Search for users]
[Overall Top Noters]
[List of all Conferences]
[Download this site]
Title: | DECWINDOWS 26-JAN-89 to 29-NOV-90 |
Notice: | See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit |
Moderator: | STAR::VATNE |
|
Created: | Mon Oct 30 1989 |
Last Modified: | Mon Dec 31 1990 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 3726 |
Total number of notes: | 19516 |
2854.0. "CSText widget do not mix fonts" by BEAGLE::LAFORGUE (It works better if you plug it!) Fri Jun 01 1990 12:02
This note is cross posted in the DECWINDOWS, CSTEXT and ULTRIX notesfile
I tried the Compound String Text widget on UWS v4.0 FT2 and I got the
follwing problem:
Using a compund string with a different character set in each segment
I managed to display it with two different font in a label widget
but not in the Text widget.
The whole CS string is displayed with the font of the first segment.
Is it a bug or a (lack of)feature of CSText ?
Thanks for any help,
Bernard
/* %M% %I% %E% */
/* simplest example of pushbuttom, CS text widget action table and
input focus , using the High level routines */
/* author: Bernard Laforgue Digital @VBO */
#include <stdio.h>
#ifdef VMS
#include <decw$include/DECwDwtApplProg.h>
#else
#include <X11/DECwDwtApplProg.h>
#endif
static void window_exposed();
static void helloworld_button_activate();
static void return_key();
static DwtCallback callback_arg[2];
static char translation[] = "<Key>0xff0d: return_key()\n\
<Key>0xff8d: return_key()";
static XtActionsRec action_table[] = {
{"return_key", (XtActionProc)return_key},
{NULL, NULL}
};
Widget label, button, text1, text2;
int main(argc, argv)
unsigned int argc;
char **argv;
{
Widget toplevel, helloworldmain, dialogw, workw;
DwtCompString line1, line2;
DwtFontList font_list;
Arg arglist[2];
/******** Set up the User Interface **********/
toplevel = XtInitialize("hellotext","Helloclass", NULL, 0, &argc, argv);
XtSetArg (arglist[0], XtNallowShellResize, TRUE) ;
XtSetValues (toplevel, arglist, 1) ;
helloworldmain = DwtMainWindow( toplevel, "mainwin", 0, 0, 170, 155);
dialogw = DwtDialogBox( helloworldmain, "dialogw", TRUE,0,0,
DwtLatin1String("Hi v%I%"), DwtWorkarea, 0, 0);
/* create the font list */
font_list = DwtCreateFontList(XLoadQueryFont(XtDisplay(toplevel),
"-*-Symbol-Medium-R-Normal--*-140-*-*-P-*-*-*"), 35); /* symbol */;
font_list = DwtAddFontList(font_list, XLoadQueryFont(XtDisplay(toplevel),
"-*-Times-Medium-R-Normal--*-140-*-*-P-*-*-*"), 1); /* ISO Latin 1 */;
XtSetArg(arglist[0], DwtNfont, font_list);
/* create the compound strings */
line1 = DwtCStrcat(DwtCSString("line 1: ", 1, False),
DwtCSString("abcdefg", 35, False));
line2 = DwtCStrcat(DwtCSString("line 2: ",35, False),
DwtCSString("hijklmn", 1, False));
label = DwtLabel( dialogw, "label", 0, 0, line1, 0);
XtSetValues (label, arglist, 1) ;
XtManageChild(label);
XtAddActions(action_table, 1);
text1 = DwtCSText(dialogw, "text", 0, 40, 20, 1, line1);
XtSetValues (text1, arglist, 1) ;
DwtCSTextSetEditable (text1, TRUE);
XtOverrideTranslations(text1, XtParseTranslationTable(translation));
XtManageChild(text1);
text2 = DwtCSText(dialogw, "text", 0, 55, 20, 1, line2);
XtSetValues (text2, arglist, 1) ;
DwtCSTextSetEditable (text2, FALSE);
/*
XtOverrideTranslations(text2, XtParseTranslationTable(translation));
*/
XtManageChild(text2);
callback_arg[0].proc = helloworld_button_activate;
callback_arg[0].tag = 0;
callback_arg[1].proc = NULL;
button = DwtPushButton( dialogw, "button", 15, 70,
DwtLatin1String("Hello\nWorld!"), callback_arg, 0);
XtSetValues (button, arglist, 1) ;
XtManageChild( button);
/* dummy work area, just to get an expose event */
callback_arg[0].proc = window_exposed;
workw = DwtWindow(helloworldmain, "workw", 0, 0, 10, 2, callback_arg);
XtManageChild( workw);
XtManageChild( dialogw); /* must be here to override workw */
XtManageChild( helloworldmain);
XtRealizeWidget( toplevel);
/* XtInstallAccelerators(text, button); */
XtMainLoop();
return (0);
}
static void window_exposed( widget, tag, callback_data)
Widget widget;
char *tag;
DwtAnyCallbackStruct *callback_data;
{
/* set the input focus to the first text widget */
/* this will grab the focus automatically to this aplication,
at its creation without anay action on the mouse */
XtCallAcceptFocus(text1, CurrentTime);
}
static void helloworld_button_activate( widget, tag, callback_data)
Widget widget;
char *tag;
DwtAnyCallbackStruct *callback_data;
{
Arg arglist[2];
static int call_count = 0;
call_count += 1 ;
switch ( call_count)
{
case 1:
XtSetArg( arglist[0], DwtNlabel,
DwtLatin1String("Goodbye\nWorld!"));
XtSetValues( widget, arglist, 1);
XtSetArg( arglist[0], DwtNlabel,
DwtLatin1String("Press button to exit."));
XtSetValues( label, arglist, 1);
break ;
case 2:
exit(1);
break ;
}
}
static void return_key (widget, tag, callback_data)
Widget widget;
char *tag;
DwtAnyCallbackStruct *callback_data;
{
DwtCompString content;
Arg arglist[1];
Widget w;
/* copies the content of the text to the pushbutton */
content = DwtCSTextGetString(widget);
XtSetArg( arglist[0], DwtNlabel, content);
XtSetValues(button, arglist, 1);
XFree(content);
/* set the input focus to the other text widget */
w = (widget==text1)? text2 : text1;
XtCallAcceptFocus(w, CurrentTime);
}
T.R | Title | User | Personal Name | Date | Lines |
---|
2854.1 | Just a guess... | LEOVAX::TREGGIARI | | Sat Jun 02 1990 09:28 | 4 |
| Try creating the CSTEXT widget with the correct fontlist rather
than calling XtSetValues after creating it.
Leo
|
2854.2 | Where is CSTEXT conference? | LEARN2::MUTH | Eatin' speaks louder than words | Mon Jun 04 1990 14:57 | 5 |
|
Could someone point me to the CSTEXT conference (and place the
pointer in the "Related Conferences" directory). Thanks.
Bill
|
2854.3 | ABSZK:: | ABSZK::SZETO | Simon Szeto, Asian Base-Systems @ZKO | Mon Jun 04 1990 23:52 | 7 |
| When Tim Greenwood created ABSZK::CSTEXT he wasn't about to publicize
it, not just yet anyway. However, mentioning its location here is not
a big deal, I don't think. I'll leave it up to Tim to decide whether
it's ready for prime time and the Related Conferences topic.
--Simon
|
2854.4 | Any other ideas? | CASEE::RAYNER | Doug -- CLT/CASEE, Valbonne, France | Wed Jun 06 1990 13:27 | 15 |
| Re: <<< Note 2854.1 by LEOVAX::TREGGIARI >>>
-< Just a guess... >-
> Try creating the CSTEXT widget with the correct fontlist rather
> than calling XtSetValues after creating it.
> Leo
I was thinking of using this capability of the CStext widget myself, so
when I saw this note, I started to do some experimenting. I can't get
it to work either. As you suggested, Leo, I set the font list at
widget creation time (i.e. with UIL), but this doesn't help. As
mentioned in the base note, it works fine with a label widget.
Any other ideas?
|
2854.5 | Do not use CSTEXT conference | ABSZK::GREENWOOD | Tim. International Systems Engineering | Mon Sep 10 1990 11:22 | 7 |
| The CSTEXT conference on ABSZK was created as a temporary conference to
discuss one issue which is now resolved. The CSTEXT widget is a full
part of the toolkit and any questions on it should be posted in one of
the other DECwindows conferences. DECWTOOLKIT looks like a good
candidate.
Tim
|