X

NV5 Geospatial Blog

Each month, NV5 Geospatial posts new blog content across a variety of categories. Browse our latest posts below to learn about important geospatial information or use the search bar to find a specific topic or author. Stay informed of the latest blog posts, events, and technologies by joining our email list!



Not All Supernovae Are Created Equal: Rethinking the Universe’s Measuring Tools

Not All Supernovae Are Created Equal: Rethinking the Universe’s Measuring Tools

6/3/2025

Rethinking the Reliability of Type 1a Supernovae   How do astronomers measure the universe? It all starts with distance. From gauging the size of a galaxy to calculating how fast the universe is expanding, measuring cosmic distances is essential to understanding everything in the sky. For nearby stars, astronomers use... Read More >

Using LLMs To Research Remote Sensing Software: Helpful, but Incomplete

Using LLMs To Research Remote Sensing Software: Helpful, but Incomplete

5/26/2025

Whether you’re new to remote sensing or a seasoned expert, there is no doubt that large language models (LLMs) like OpenAI’s ChatGPT or Google’s Gemini can be incredibly useful in many aspects of research. From exploring the electromagnetic spectrum to creating object detection models using the latest deep learning... Read More >

From Image to Insight: How GEOINT Automation Is Changing the Speed of Decision-Making

From Image to Insight: How GEOINT Automation Is Changing the Speed of Decision-Making

4/28/2025

When every second counts, the ability to process geospatial data rapidly and accurately isn’t just helpful, it’s critical. Geospatial Intelligence (GEOINT) has always played a pivotal role in defense, security, and disaster response. But in high-tempo operations, traditional workflows are no longer fast enough. Analysts are... Read More >

Thermal Infrared Echoes: Illuminating the Last Gasp of a Dying Star

Thermal Infrared Echoes: Illuminating the Last Gasp of a Dying Star

4/24/2025

This blog was written by Eli Dwek, Emeritus, NASA Goddard Space Flight Center, Greenbelt, MD and Research Fellow, Center for Astrophysics, Harvard & Smithsonian, Cambridge, MA. It is the fifth blog in a series showcasing our IDL® Fellows program which supports passionate retired IDL users who may need support to continue their work... Read More >

A New Era of Hyperspectral Imaging with ENVI® and Wyvern’s Open Data Program

A New Era of Hyperspectral Imaging with ENVI® and Wyvern’s Open Data Program

2/25/2025

This blog was written in collaboration with Adam O’Connor from Wyvern.   As hyperspectral imaging (HSI) continues to grow in importance, access to high-quality satellite data is key to unlocking new insights in environmental monitoring, agriculture, forestry, mining, security, energy infrastructure management, and more.... Read More >

1345678910Last
21301 Rate this article:
5.0

Using .Xdefaults to customize the appearance of your widgets on Linux

Anonym

This post discusses how you can create a “.Xdefaults” file to customize the appearance of your IDL widgets on Linux and Mac OS X.

If you write widget application using IDL, you might find that the appearance is different when you run it on Windows and Unix based systems. For example, if you run the program “test_control_widget_colors” (find the code below) on Windows, it will have the following appearance:

 

If you run “test_control_widget_colors.pro” on a Linux, MacOS X, or Solaris system, the result will have the following appearance:

The appearance is different between platforms because IDL uses the Motif toolkit to construct widgets on Linux, Mac OS X and Solaris. The appearance of Motif widgets can be customized by using the RESOURCE_NAME keyword and a “.Xdefaults” file. There is some information about how this can be done in the RESOURCE_NAME section on the WIDGET_BASE help page.

One quick thing I wanted to note is that the IDL documentation mentions OSF/Motif Programmer’s Reference Manual, but the OSF (Open Software Foundation) is currently part of the Open Group. You can find useful documentation about "Open Motif" by going to the Open Group’s website.

There is an example of how to customize widgets on Unix platforms within the IDL documentation. Below, I have provided an additional example. You can get it to work by following the steps below:

1)  Open a text editor, enter the following text and save it as ".Xdefaults" in your home directory :

Idl*background:grey90
Idl*testWidget*testText*background:  White
Idl*testWidget*area*indicatorType: One_OF_MANY_ROUND
Idl*testWidget*area*selectColor: Black
Idl*testWidget*area*bottomShadowColor: grey39
Idl*testWidget*area*topShadowColor: grey39
Idl*testWidget*checkarea*indicatorOn: INDICATOR_CHECK_BOX

2) Open a terminal, and enter the following command:

xrdb -load ~/.Xdefaults

3) Open "idlde" from the same terminal, and copy/paste the following code into a new document. Save the document as "test_control_widget_colors.pro", and run it.

pro test_control_widget_colors_event, ev
  compile_opt idl2
 
  help, /STRUCTURE, ev
 
end


pro test_control_widget_colors
  compile_opt idl2

  wb = widget_base(resource_name="testWidget",/COLUMN)
  wlabel = WIDGET_LABEL(wb, VALUE="Test Label")
 
  wtext = WIDGET_TEXT(wb, VALUE="Test Value", $
                      resource_name="testText",/EDITABLE)
 
  areabase = widget_base(wb, /exclusive, $
                        /row, resource_name="area")
 
  yes_button = WIDGET_BUTTON(areabase, $
                             value='yes', $
                             RESOURCE_NAME="radiobutton")
 
  no_button = widget_button(areabase, value='no', $
                            RESOURCE_NAME="nobutton")
 
  maybe_button = widget_button(areabase,value='maybe', $
                           RESOURCE_NAME="maybebutton")

  checkbase = widget_base(wb, /NONEXCLUSIVE, /row, $
                             RESOURCE_NAME="checkarea")
 
  checkbutton = widget_button(checkbase, value="Check", $
                            RESOURCE_NAME="checkbutton")

  widget_control, /REALIZE, wb
  xmanager, "test_control_widget_colors", wb


end

If everything works, the output widget should have the following appearance:

 

I want to provide a brief description of what is happening in the ".Xdefaults" file.  The first thing to note is that each object within the widget was assigned a RESOURCE_NAME. These RESOURCE_NAME values are used to identify widget components within the “.Xdefaults”  file.

The first line in the ".Xdefaults" file, changes the background color of all of IDL’s widgets to a lighter grey. To do this, I changed the "background" property of the "Idl" resource to a different shade of grey.

Idl*background:grey90

In the second line of ".Xdefaults", I wanted to change the background of my text object to white. To do this, I reproduced the branch of resource names (separated with a “*” character) and defined the “background” property of this widget element to “White”.

Idl*testWidget*testText*background: White

The third line of ".Xdefaults", changes the shape of the toggle buttons to circles. To do this, I found the property of Motif toggle button that controls the shape (XmNindicatorType), dropped the "XmN", and set this property to be circular (One_OF_MANY_ROUND).

Idl*testWidget*area*indicatorType: One_OF_MANY_ROUND

 

In the remainder of the file, I used a similar procedure to change the color of the buttons outline ("bottomShadowColor" and "topShadowColor") and show a check in the checkbox ("indicatorOn").

I hope that this information to be helpful. Thanks for reading!

3 comments on article "Using .Xdefaults to customize the appearance of your widgets on Linux"

Avatar image

joy

I will come back here


Avatar image

Jerry

Would you please tell me who will be the chief guest for the training session? I will write my paper today about the various issue related to this subject.Actually every event training may carry some weight for the interested people.


Avatar image

essay writer

Through such event show training on trading strategy and the marketing process according to the current economic situation of the world, the method for changing color and front size, this training will surely help a lot and thus they are becoming more conscious about the effect of this training.

Please login or register to post comments.