X

Help Articles are product support tips and information straight from the NV5 Geospatial Technical Support team developed to help you use our products to their fullest potential.



7556 Rate this article:
No rating

Example how to use .Xdefaults to alter appearance of Widgets on Linux

Topic:

Since IDL uses X Motif widgets on Linux, Mac OS X, and Solaris systems, the appearance of widgets on these platforms might appear different than the appearance on Windows. This article discusses how you can create an .Xdefaults file to customize the appearance of IDL's widgets on these platforms. 

Discussion:

If you create a widget application using IDL, you may find that the appearance is different between Windows and Linux. For example, if you run "test_control_widget_colors.pro" (shown below) it will have the following appearance on Windows:

.

If you run "test_control_widget_colors.pro" on a Linux, Mac OS X, or Solaris system, the result will have the following appearance:

The reason the appearance is different is because IDL uses Window's native toolkit and the Unix platforms are using the XMotif toolkit. You can adjust the appear of the widgets on Unix platforms by using the RESOURCE_NAME and adjust the properties of this Widget objects using the ~/.Xdefaults fileTo change the graphics you can use the following procedure:

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

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) Enter the following command into

xrdb -load ~/.Xdefaults

3) Open "idlde" from the same terminal (or any other text editor) and enter the following text into a new document. Save the document as "test_control_widget_colors.pro".

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:

 

There is some additional information and an example in the RESOURCE_NAME section of the WIDGET_BASE help page:

http://harrisgeospatial.com/docs/WIDGET_BASE.html

Written by DS and reviewed by JU 1/24/2014
Please login or register to post comments.
Featured

End-of-Life Policy Enforcement for ENVI 5.3 / IDL 8.5 and Earlier Versions

5/6/2024

April 1, 2024 Dear ENVI/IDL Customer,  We are reaching out to notify you of our supported... more »

How to Upgrade licenses to ENVI 6.x / IDL 9.x

12/5/2023

What is the new Upgrade function? Starting with ENVI 6.0 and IDL 9.0, we have implemented an... more »

What to do if the 'License Administrator - License Server' for the Next-Generation License Server does not start?

6/13/2023

Background: With the release of ENVI 5.7 & IDL 8.9 and the corresponding Next-Generation licensing... more »

Next-Generation Licensing FAQ

4/28/2023

  NV5 Geospatial has adopted a new licensing technology for all future releases of our ENVI, IDL... more »

The IDL Virtual Machine

6/6/2013

What is the IDL Virtual Machine? An IDL Virtual Machine is a runtime version of IDL that can... more »