[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Direct Graphics Colorbar Object



Hi Folks,

I have been saying for some time that I was going to
write an example of a direct graphics program that was
written as an object. But the press of business has been
such that it has been impossible to find the time to do it.

But this week three separate programs Dick and I are
working on required a color bar and because of the way
these programs work, an "object" color bar seemed the
best choice. So I wrote one and I thought I would make
it avaiable here and on my web page an an example program.
My ulterior motive, of course, is to flush the bugs
out before I give it to my clients. :-)

The program, named "colorbar__define.pro" (two underscore
characters there) can be downloaded from my web page:

   http://www.dfanning.com/programs/colorbar__define.pro

The program can be used like this:

   colorbar = Obj_New("COLORBAR", Range=[0,1000], Format='(I4)', $
	Title='Values', Position=[0.1, 0.5, 0.9, 0.6])
   Window
   LoadCT, 5
   colorbar->Draw

If I wish to erase the color bar, I would do this:

   colorbar->Erase

Any number of properties of the color bar can be set
(or obtained) throught the SetProperty (or GetProperty)
method. For example, if I want to change the position 
of the plot in the window I might type this:

   colorbar->SetProperty, Position=[0.1, 0.75, 0.9, 0.80], /Draw

If the color bar already exists in the window, then I would
want to erase the first color bar before I drew the
changed one, like this:

   colorbar->SetProperty, Position=[0.1, 0.35, 0.9, 0.40], $
      Minor=5, /Draw, /Erase

When you are done with the color bar object, you must
destroy it, of course:

   Obj_Destroy, colorbar

I'll leave it to you to discover the numerous other things
this program can do. Documenation for this program as well
as all the other programs on my web page are available 
here:

   http://www.dfanning.com/programs/program.documentation.html

One of our purposes is to have a color bar that users
can easily drag around and position where ever they like.

Cheers,

David

-- 
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Progamming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155