[Newbie] Inextensible button - Motif

This is a discussion on [Newbie] Inextensible button - Motif ; I'm a beginner in Motif. I have been trying to create a simple window with one button. I want this button not to resize with the window. I mean the button should have fixed size and location and should not ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: [Newbie] Inextensible button

  1. [Newbie] Inextensible button

    I'm a beginner in Motif.

    I have been trying to create a simple window with one button. I want this button not to resize with the window. I mean the button should have fixed size and location and should not resize while I'm fiddling with the window.

    Here is how I create the button:
    button = XmCreatePushButton(top_wid, "Push_me", NULL, 0);

    /* tell Xt to manage button */
    XtManageChild(button);

    /* !! Doesn't work, button still resize with the window */
    Arg args[1];
    XtSetArg(args[0], XmNresizePolicy, XmRESIZE_NONE);
    XtSetValues(button, args, 1);
    /* !! Doesn't work, button still resize with the window */

    What args should I set (XtSetArg()) to stop button form resizing?

    I'm running Mac Os X Snow Leopard, Motif built from macports.

  2. Re: [Newbie] Inextensible button

    you should "lay" something(main window, for example) under the button, to do not make it a child of the toplevel widget straightforwardly.
    Here is the code:

    // gcc -o filename -lXm -lXt filename.c

    #include
    #include

    Widget toplevel, button, main_w;
    XtAppContext app;

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

    Arg al[10];
    Cardinal ac = 0;

    XtSetLanguageProc (NULL, NULL, NULL);
    /* Initialize toolkit and parse command line options. */
    toplevel = XtVaOpenApplication (&app, "btn", NULL, 0, &argc, argv,
    NULL, sessionShellWidgetClass, NULL);
    /* main window contains a MenuBar and a Label displaying a pixmap */
    ac = 0;
    XtSetArg(al[ac], XmNscrollBarDisplayPolicy, XmAS_NEEDED); ac++;
    XtSetArg(al[ac], XmNscrollingPolicy, XmAUTOMATIC); ac++;
    main_w = XmCreateMainWindow (toplevel, "main_window", al, ac);

    button = XmCreatePushButton(main_w, "A button", al, 0);
    XtManageChild (button);

    XtManageChild (main_w);
    XtRealizeWidget (toplevel);
    XtAppMainLoop (app);
    }

+ Reply to Thread