1

I'm getting starting with GUIs in KSH, so this is my first example:

#! /usr/dt/bin/dtksh
  main()
  {
    XtInitialize TOPLEVEL dtHello DtHello "$@"

    XmCreateMessageDialog HELLO $TOPLEVEL hello \
            dialogTitle:"DtHello" \
            messageString:\
      "$(print "Hello\nWorld")"
    XmMessageBoxGetChild HELP $HELLO\
   DIALOG_HELP_BUTTON
    XtUnmanageChild $HELP
    XmMessageBoxGetChild CANCEL $HELLO\<\n>
   DIALOG_CANCEL_BUTTON
    XtUnmanageChild $CANCEL
    XtAddCallback $HELLO okCallback exit
    XtManageChild $HELLO
    XtMainLoop
   }

But when I try to launch my script, I get the next:

gui.ksh: syntax error at line 15: `newline' unexpected

The syntax error is in this line:

   DIALOG_CANCEL_BUTTON

And these are my references: reference 1 reference 2

Thanks in advance for any help.

1 Answer 1

0

Well... It was so easy, so I just needed check in this O'REILLY doc

I didn't know KSH is sensitive to spaces and tabulations. Anyway here's a solution if is useful to someone.

#! /usr/dt/bin/dtksh

main()
{
        XtInitialize TOPLEVEL dtHello DtHello "$@"

        XmCreateMessageDialog HELLO $TOPLEVEL hello \
                dialogTitle: "First Window" \
                messageString:"$(print "Hello\nWorld")"
        XmMessageBoxGetChild HELP $HELLO \
                DIALOG_HELP_BUTTON
        XtUnmanageChild $HELP
        XmMessageBoxGetChild CANCEL $HELLO \
                DIALOG_CANCEL_BUTTON
        XtUnmanageChild $CANCEL
        XtAddCallback $HELLO okCallback exit
        XtManageChild $HELLO
        XtMainLoop
}

Thanks.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .