SGI: Development

Motif fileselector box is blue - Page 1

Hello,

when I create a Motif fileselector box, it always has a blue background (see image),
but I would like to have a more common color (like grey).

Image

System: SGI Fuel
Is that a matter of system settings or do I have to tweak the colors in my app?

The sourcecode is:


Code:
#include <stdio.h>
#include <stdlib.h>
#include <Xm/FileSB.h>

int  main(int argc, char* argv[])
{
Widget        toplevel, dialog;
XtAppContext  app;
char* FileBoxName = "Select File";

if (argc == 2)
{
FileBoxName = argv[1];
}

XtSetLanguageProc (NULL, NULL, NULL);

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


/* Create a simple FileSelectionDialog -- no frills */
dialog = XmCreateFileSelectionDialog (toplevel, FileBoxName, NULL, 0);
XtAddCallback (dialog, XmNcancelCallback, (XtCallbackProc) cancel, NULL);
XtAddCallback (dialog, XmNokCallback, (XtCallbackProc) echo_file, NULL);

XtManageChild (dialog);
XtAppMainLoop (app);
return 0;
}


Greetings,
Martin
Martin Steen wrote:
Hello,

when I create a Motif fileselector box, it always has a blue background (see image),
but I would like to have a more common color (like grey).

Image

System: SGI Fuel
Is that a matter of system settings or do I have to tweak the colors in my app?

The sourcecode is:


Code:
#include <stdio.h>
#include <stdlib.h>
#include <Xm/FileSB.h>

int  main(int argc, char* argv[])
{
Widget        toplevel, dialog;
XtAppContext  app;
char* FileBoxName = "Select File";

if (argc == 2)
{
FileBoxName = argv[1];
}

XtSetLanguageProc (NULL, NULL, NULL);

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


/* Create a simple FileSelectionDialog -- no frills */
dialog = XmCreateFileSelectionDialog (toplevel, FileBoxName, NULL, 0);
XtAddCallback (dialog, XmNcancelCallback, (XtCallbackProc) cancel, NULL);
XtAddCallback (dialog, XmNokCallback, (XtCallbackProc) echo_file, NULL);

XtManageChild (dialog);
XtAppMainLoop (app);
return 0;
}


Greetings,
Martin


Check out the X resources file... There should be documentation about it somewhere.. You can set values in the resources for stuff like selector background colours etc, from memory... its been a long time.. I have completed some raw Xt and Xm applications in the past but IRIX has a few little quirks that annoyed me enough to mess around with Qt4 (its in nekoware)

I think there a Motif specific across all widget classes one somewhere.
http://www.le.ac.uk/cc/dsss/docs/xcustom.shtml asserts possible to ascertain some of the resource names which can be used by referring to the documentation on the widget library. The OSF/Motif "Programmers Reference" is useful if doing this for Motif based programs.

You could also do it programatically.



Regan

_________________
死の神はりんごだけ食べる

アレゲはアレゲ以上のなにものでもなさげ -- アレゲ研究家

:Onyx2R: :Onyx2RE: :0300: <-> :0300: <-> :0300: :O200: :Octane: :O2: :O2: :Indigo2IMP: :Indigo: :PI: :PI: :1600SW: :1600SW: :Indy: :Indy: :Indy: :Indy: :Indy: :Indy: :Indy: :Indy: :O2000: :hpserv: J5600,
3 x SUN, 2 x Mac, Alpha DS20E, Alpha 800 5/550, 2 x RS/6000, Amiga 4000 VideoToaster, Amiga4000 -030, 733MHz Sam440 AmigaOS 4.1 update 1. Tandem Himalaya S-Series Nonstop S72000 ServerNet.
PymbleSoftware wrote:

Check out the X resources file... There should be documentation about it somewhere.. You can set values in the resources for stuff like selector background colours etc, from memory... its been a long time.. I have completed some raw Xt and Xm applications in the past but IRIX has a few little quirks that annoyed me enough to mess around with Qt4 (its in nekoware)

I think there a Motif specific across all widget classes one somewhere.
http://www.le.ac.uk/cc/dsss/docs/xcustom.shtml asserts possible to ascertain some of the resource names which can be used by referring to the documentation on the widget library. The OSF/Motif "Programmers Reference" is useful if doing this for Motif based programs.

You could also do it programatically.
Regan


Thank you for the hints and the links, I will give it a try.

I know that one can make a fileselector-box with Qt or GTK, but I don't want users to have to
install a bunch of libraries. AFAIK is Motif the "lowest common level" for Unix systems and it
works without installing additional libs (at least I hope so).

Best regards,
Martin
When calling XtAppInitialize(), you can supply a set of fallback resources as one of the arguments. You can also do it manually by XtAppSetFallbackResources(), but in that case it has to be before certain other calls that create the window. I dont remember which ones.

You can declare fallbacks like this:

#define APP_CLASS "XMyApp"

String fbRes[] = {
APP_CLASS <resource and value as a string>,
NULL
};

The resource and value part can be very generic or more specific. For example
- "*.background: white" would make every widget background white, or
- "*XmBlah*.background: white", would make every instance of XmBlah's background white.

These will be used if no resources file for the app was found. I cant really remember which gets priority with regard to general resource file locations (which can be defined in loads of places). The Xdefaults files in your home directory override everything else I think.

Its been a long long time, so double check all this before doing it. I think all the O'Reilly Motif books were made freely available. They will be much more useful at Motif than I am nowadays.
kramlq wrote:

The resource and value part can be very generic or more specific. For example
- "*.background: white" would make every widget background white, or
- "*XmBlah*.background: white", would make every instance of XmBlah's background white.


Thank you a lot! I will try this when I'm back home this evening.

I still wonder why the default-color is "light blue". But if I can manage to change the colors with
some Motif function calls, everything is great.

Best regards,
Martin
Martin Steen wrote:
I still wonder why the default-color is "light blue".

Its just a default used in Motif. In fact, seeing your dialog in that colour immediately brought back memories of an industrial laser etch machine I once did software for. I can almost smell it now :-)

Its the same colour for custom apps in Motif on Linux and HP-UX. It is probably defined in one of the dozen or so configuration files X Windows uses for resources, or as a coded fallback. I wont even try to hazard a guess as to where exactly. One of the things about X Windows is it is almost too configurable. I gave two resource examples, but it essentially works like pattern matching, so you can easily configure the colour of every single widget in the system, or a single widget in a single app. It is extremely powerful. I think there is also a tool to change resources in a live app, which may be useful to you for experimenting. Perhaps somebody else remembers the name of it.

Quote:
But if I can manage to change the colors with some Motif function calls, everything is great.

Fallbacks are useful, because you can code in some sane values to use if nothing else was found, but they can still easily be overidden on a per-user basis.


BTW, I'm inclined to agree with the suggestion that Qt or something else might be more applicable nowadays. Motif might be a common denominator on many commercial UNIX variants, but despite being free now, it may not necessarily be preinstalled on open source UNIX systems. Qt is often preinstalled on most open source UNIX systems, and those are in the majority these days.
You also want to set the SGI Motif flag using

Code:
static String fallback_resources[] = {
"*sgiMode: TRUE",
"*SgNuseEnhancedFSB: TRUE",
"*useSchemes: all",
NULL
};


Will make everything look IndigoMagic-ish. :)
I still have one of the SGI Freeware apps installed on my Octane. When displayed on the Octane the window matches the decor of all of the other open apps. If I install the same Freeware application on a different system, or remotely display the app from the Octane, I get the default 'blue' Motif decor that Martin mentions.

The drives in my Octane are some <or clones of some> that I've upgraded and carried forward for years. Somewhere along the line I installed or modified something to produce the difference, but I'll be damned if I can spot <or even remember> what that was. From somewhere I get the faint recollection of a nekochan post <or maybe even comp.sys.sgi.*> that described the process to get the Octane to where it is, but I can't dredge it up with a search. The changes in application appearance don't appear to be related to user config changes - I can copy my entire directory from /usr/people from one box to another, and the behavior doesn't migrate with the user files.

It may be a red herring, but as long as the install base on the Octane has been around, I probably installed some variant of Buffy GTK somewhere along the line. The Octane is down at the moment for some SCSI peripheral swapping, so I'm not certain if I installed the Freeware version of Buffy GTK or the one neko made ; or even what <if any> bearing it has on the issue.

_________________
***********************************************************************
Welcome to ARMLand - 0/0x0d00
running...(sherwood-root 0607201829)
* InfiniteReality/Reality Software, IRIX 6.5 Release *
***********************************************************************
Martin Steen wrote:
AFAIK is Motif the "lowest common level" for Unix systems and it
works without installing additional libs (at least I hope so).


Not quite, it's a layered system...

Motif sits on X11 Intrinsics (Widgets), which in turn sits on XLib, which then sits on sockets (well actually they sit on ICE and SM).

For instance Linux & NetBSD (et al) include XLib and X11 Intrinsics, but not Motif.

There is a free impersonator called LessTif, and also OpenMotif, they fall into the "install additional libs" catagory.
squeen wrote:
You also want to set the SGI Motif flag using

Code:
static String fallback_resources[] = {
"*sgiMode: TRUE",
"*SgNuseEnhancedFSB: TRUE",
"*useSchemes: all",
NULL
};


Will make everything look IndigoMagic-ish. :)


It works!
That fallback-argument did the trick. It seems like only the line
"*useSchemes: all" is needed to change the colors.

Thank you all for your help! It's great to have so many Motif-experts here around.

Best regards,
Martin

Image

(here is the final code. I added a XtVaSetValues call to set the dialog title
properly)

Code:
#include <stdio.h>
#include <stdlib.h>
#include <Xm/FileSB.h>

int  main(int argc, char* argv[])
{
static String fallback_resources[] =
{
"*sgiMode: TRUE",
"*SgNuseEnhancedFSB: TRUE",
"*useSchemes: all",
NULL
};

Widget        toplevel, dialog;
XtAppContext  app;
char* FileBoxName = "Select File";

if (argc == 2)
{
FileBoxName = argv[1];
}

XtSetLanguageProc (NULL, NULL, NULL);

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

/* Create a simple FileSelectionDialog -- no frills */
dialog = XmCreateFileSelectionDialog (toplevel, FileBoxName, NULL, 0);
XtVaSetValues(XtParent(dialog), XmNtitle, FileBoxName, NULL);

XtAddCallback (dialog, XmNcancelCallback, (XtCallbackProc) cancel, NULL);
XtAddCallback (dialog, XmNokCallback, (XtCallbackProc) echo_file, NULL);

XtManageChild (dialog);
XtAppMainLoop (app);
return 0;
}
Close, but no cigar. It's not as hideous as the blue version, but it still lacks the SGI scrollbar decorations and the drag-n-drop target. Here's the Nedit File->Open dialog:

_________________
Now this is a deep dark secret, so everybody keep it quiet :)
It turns out that when reset, the WD33C93 defaults to a SCSI ID of 0, and it was simpler to leave it that way... -- Dave Olson, in comp.sys.sgi

Currently in commercial service: Image :Octane2: :Onyx2: (2x) :0300:
In the museum: almost every MIPS/IRIX system.
jan-jaap wrote:
Close, but no cigar. It's not as hideous as the blue version, but it still lacks the SGI scrollbar decorations and the drag-n-drop target. Here's the Nedit File->Open dialog:


Ok, that box looks better than the standard Motif box :cry:
But how can I create the Nedit fileselectorbox?

Best regards,
Martin
Martin Steen wrote:
jan-jaap wrote:
Close, but no cigar. It's not as hideous as the blue version, but it still lacks the SGI scrollbar decorations and the drag-n-drop target. Here's the Nedit File->Open dialog:


Ok, that box looks better than the standard Motif box :cry:
But how can I create the Nedit fileselectorbox?

Best regards,
Martin


Dig through the nedit source code...
It is available on nedit.org
http://www.nedit.org/source.php

If desired someone could update the wiki topic on Motif programming..
http://www.nekochan.net/wiki/index.php/ ... rogramming


Regan

_________________
死の神はりんごだけ食べる

アレゲはアレゲ以上のなにものでもなさげ -- アレゲ研究家

:Onyx2R: :Onyx2RE: :0300: <-> :0300: <-> :0300: :O200: :Octane: :O2: :O2: :Indigo2IMP: :Indigo: :PI: :PI: :1600SW: :1600SW: :Indy: :Indy: :Indy: :Indy: :Indy: :Indy: :Indy: :Indy: :O2000: :hpserv: J5600,
3 x SUN, 2 x Mac, Alpha DS20E, Alpha 800 5/550, 2 x RS/6000, Amiga 4000 VideoToaster, Amiga4000 -030, 733MHz Sam440 AmigaOS 4.1 update 1. Tandem Himalaya S-Series Nonstop S72000 ServerNet.
Martin Steen wrote:
jan-jaap wrote:
Close, but no cigar. It's not as hideous as the blue version, but it still lacks the SGI scrollbar decorations and the drag-n-drop target. Here's the Nedit File->Open dialog:


Ok, that box looks better than the standard Motif box :cry:
But how can I create the Nedit fileselectorbox?

Best regards,
Martin

"*SgNuseEnhancedFSB: TRUE" should have activated the SGI style file selector box and given you the improved box....hmmm.
Try adding this to the widget's resources:

Code:
argcount=0;
XtSetArg( arglist[argcount], SgNuseEnhancedFSB, TRUE );argcount++;
XmCreateFileSelectionDialog( w, "openFileDialog", arglist, argcount );
Quote:
"*SgNuseEnhancedFSB: TRUE" should have activated the SGI style file selector box and given you the improved box....hmmm.
Try adding this to the widget's resources:

Code:
argcount=0;
XtSetArg( arglist[argcount], SgNuseEnhancedFSB, TRUE );argcount++;
XmCreateFileSelectionDialog( w, "openFileDialog", arglist, argcount );


Thank you for your help. But the additional code did not change anything.

I found the solution 10 Minutes ago on this page:
http://mecca.spd.louisville.edu/ebt-bin/nph-dweb/dynaweb/SGI_Developer/IIDsktp_IG/@ebt-link;cs=fullhtml;pt=1134?target=%25N%15_18455_START_RESTART_N%25#X

The trick is, that you have to add -lSgm to the linker-flags in the makefile.
Code:
LDFLAGS = -lSgm  -lXm -lXt -lX11


Now the fileselector box looks like it should! :D

Best regards,
Martin

P.S. @jan-jaap: cigar now? ;)

Image
In case anyone's wondering (though I'm sure many of you already know); the xrdb program can be used to add/modify X resources into a running X server. For example, if you put the changes into your .Xdefaults file:

xrdb -merge ~/.Xdefaults
Martin Steen wrote:
P.S. @jan-jaap: cigar now? ;)
Attachment:
cigar.jpg
cigar.jpg [ 4.24 KiB | Viewed 101 times ]

_________________
Now this is a deep dark secret, so everybody keep it quiet :)
It turns out that when reset, the WD33C93 defaults to a SCSI ID of 0, and it was simpler to leave it that way... -- Dave Olson, in comp.sys.sgi

Currently in commercial service: Image :Octane2: :Onyx2: (2x) :0300:
In the museum: almost every MIPS/IRIX system.
jan-jaap wrote:
Martin Steen wrote:
P.S. @jan-jaap: cigar now? ;)
Attachment:
cigar.jpg


LOL, thank you, now that' s a nice cigar! Unfortunately I have quit smoking last year, but for
this virtual cigar I make an exception ;)

Best regards,
Martin
Was wondering if anyone here has updated NEDIT tardist on nekoware with SGI GUi widget?

_________________
Image SGI Tezro 2x700Mhz R16000, 8Gb
I'm not a programmer, but I think using ViewKit is generally the easiest way to get applications that integrate properly into the IRIX desktop.

_________________
:Fuel: :O2: :Octane: :Octane2: :0300: