x 윈도우 프로그램인데 도와주세요.

익명 사용자의 이미지

sun에서 application을 만들고 있습니다.
motif 사용한다고 Xm, Xt... 이것저것 사용하고 있는데 잘안되네요.
x-window를 만들고, 텍스트 파일을 읽어서 x-window상에 나타내주는 것이 목적
이고요. 소스는 다음과 같습니다.
고수님들이 무엇이 잘못되었는지 가르쳐 주세요.

#include
#include
#include
#include
#include
#include
#include
#include

void noerror();
void error(int argc, char *argv[]);

void handle_button(w, client_data, call_data)
Widget w;
XtPointer client_data;
XmPushButtonCallbackStruct *call_data;
{
exit(1);
}

main(argc, argv)
int argc;
char *argv[];
{
noerror();

error(argc, argv);

}

void noerror()
{
Display *dpy;
Window w;
Font f;
GC gc;
XSetWindowAttributes xswa;

/* Xlib bottom display */
xswa.override_redirect = True;
dpy = XOpenDisplay(NULL);
w = XCreateSimpleWindow(dpy, RootWindow(dpy, 0), 0,
970,
1240, 50, 2, BlackPixel( dpy,
0 ),
WhitePixel( dpy, 0 ) );

XChangeWindowAttributes (dpy, w, CWOverrideRedirect,
&xswa);

XMapWindow ( dpy, w );
XFlush(dpy);

XMoveWindow(dpy, w, 0, 970);
XMapWindow(dpy, w);
XFlush(dpy);

gc = XCreateGC( dpy, w, 0L, ( XGCValues * )
NULL );
f = XLoadFont(
dpy, "helvetica_bold24" );
XSetFont ( dpy, gc, f );

XDrawString( dpy, w, gc, 14, 14,
">> NO Warning & Caution !!", 27 );

XFlush( dpy );

getchar();

/* XUnloadFont( dpy, f );
XFreeGC( dpy, gc );
XDestroyWindow( dpy, w );
XCloseDisplay( dpy ); */
}

void error(argc, argv)
int argc;
char *argv[];
{

Widget toplevel, rowcol, text_w, button, sb;
XtAppContext app;
Arg args[10];
int n = 0;

char buffer[80];
FILE *stream;

/* Xm full display */

XtSetLanguageProc ( NULL, NULL, NULL);

toplevel = XtVaAppInitialize (&app, "Demos",
NULL, 0, &argc, argv, NULL, NULL);

stream = fopen("result.txt", "rt");
while(!feof(stream)) {
fget(buffer, 80, stream);
}

rowcol = XtVaCreateWidget ("rowcol",
xmRowColumnWidgetClass, toplevel, NULL);

XtSetArg (args[n], XmNrows, 50); n++;
XtSetArg (args[n], XmNcolumns, 200); n++;
XtSetArg (args[n], XmNeditMode, XmMULTI_LINE_EDIT); n++;
XtSetArg (args[n], XmNscrollHorizontal, False); n++;
XtSetArg (args[n], XmNwordWrap, True); n++;
XtSetArg (args[n], XmNvalue, buffer);

text_w = XmCreateScrolledText (rowcol, "text_w", args,
n);
XtManageChild (text_w);

XtVaGetValues (XtParent (text_w), XmNverticalScrollBar,
&sb, NULL);
fclose(stream);
XtManageChild (rowcol);

button=XmCreatePushButton(toplevel, "button", al, ac);
XtManageChild(button);

button = XtVaCreateManagedWidget ("EXIT",
xmPushButtonWidgetClass, rowcol, NULL);
XtAddCallback(button, XmNactivateCallback,
handle_button, NULL);

XtRealizeWidget (toplevel);
XtAppMainLoop (app);

}

익명 사용자의 이미지

소스올리신 것 까진 좋은데...
혹 컴파일 시에문제가 발생했다면 그 에러문장을 적어주시고
컴파일 자체가 안되면 Makefile을 올려주시는게 좋겠네요.
LINUX에서는 Motif가 아니라 lesstif(맞나?)를 사용하긴 하지만
(자금에 여유가 있다면 Motif를 할 수도 있죠. ^^;) 일단 기본적인
형식은 비슷하니...
에러를 오려주심 집에가서라도(책이 집에 있어서요. --;) 찾아봐
드리죠.

익명 사용자의 이미지

..

익명 사용자의 이미지

이 소스는 아직 완벽하지는 않지만 지금 여기서는 button callback에서
다시 noerror함수로 돌아와서 처음의 noerror 화면만 나오게 하려는데...
근데 리눅스에서는 컴파일이 잘 안되는데...
참고로 저는 솔라리스 환경에서 프로그램을 하는데 motif는 다 지원되고
컴파일도 잘 되거든요..
하여튼 도와주시면 고맙고요, 혹 도움을 받을만한 곳이 없을지...

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.