fixunix
Tags Register FAQ Members List Social Groups Calendar Search Today's Posts Mark Forums Read

[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 ...


Fix Unix > Tools > Motif > [Newbie] Inextensible button

Reply
 
LinkBack Tools
  #1  
Old 05-21-2010, 11:24 PM
Junior Member
 
Join Date: May 2010
Posts: 1
Default [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.
Reply With Quote
  #2  
Old 06-21-2010, 10:14 PM
Junior Member
 
Join Date: Jun 2010
Posts: 2
Default 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 With Quote
Reply

Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Custom Button Tutorial - does button.js store javascript AND XULor just js script? unix Mozilla 0 05-08-2008 10:34 PM
Conversion Key Button Labels --- Can I use my own button label description or must it be the ones you can select? unix Websphere 3 05-08-2008 12:14 AM
Custom Button Tutorial - does button.js store javascript AND XUL orjust js script? unix Mozilla 0 05-07-2008 08:26 PM
Hangs only on enter button or search button unix Mozilla 0 09-05-2007 03:37 AM


All times are GMT. The time now is 09:37 PM.