comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Updating existing IDL table widget
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Updating existing IDL table widget [message #31373 is a reply to message #31371] Wed, 10 July 2002 11:12 Go to previous messageGo to previous message
Rick Towler is currently offline  Rick Towler
Messages: 821
Registered: August 1998
Senior Member
"Heather Williams" <heather.williams@physics.cr.man.ac.uk> wrote

> This table is initially blank, but I then want to add a new row of
> data to every time a particular .pro is run, so I can see the results
> I have as I go along. I then want to export data within the completed
> table in a format which can be read by Microsoft Excel, as I already
> have a spreadsheet which does further (graphical) analysis very
> nicely.


What platform and version? If you are not on win32 (or are opposed to a
platform specific solution) continue to use widget_table and look at
write_sylk to export you data to excel. For mixed data types you will need
to pass write_sylk an array of structures:

ok=write_sylk('test.slk',[{a:'cows',b:3.0},{a:'moo',b:2.0}])

The problem with comma delimited text files is that you will have to
"import" them into excel. Sylk files load just like an .xls file.


For the adventurous, in 5.5 on win32 (NT/2000) you could skip the table and
go straight to excel by using widget_activex. Look at the "Using ActiveX
controls in IDL" in the "What's new in 5.5" .pdf in your IDL docs directory.
There is an example of embedding an excel worksheet. I have included a few
properties and a method that aren't in the example. The "export" method is
key, you need it to save your data.

This example requires win2k and office2k. Earlier versions of office
probably have a excel worksheet control that you can insert but you will
have to find the class ID.


pro excel_test

;define the top level base widget and some menu bar items
tlb=widget_base(column=1, title='ActiveX Test')

;create an excel worksheet object
wAx=WIDGET_ACTIVEX(tlb, '{0002E510-0000-0000-C000-000000000046}', $
scr_xsize=800, scr_ysize=600)

WIDGET_CONTROL, tlb, /REALIZE

;get the excel control object reference
WIDGET_CONTROL, wAx, GET_VALUE = oAx

;remove the title bar
oax -> setproperty, displaytitlebar=0, enableevents=0

;other properties you may want to fool with:
;displaycolheaders
;displayhorizontalscrollbar
;displayrowheaders
;displaytoolbars
;displayverticalscrollbar


;main program action goes here

;add your data into the table following the example
;in what's new in 5.5


;when you are ready, save the data...

;get the activesheet object
oax -> getproperty, activesheet=asheet

;export the data to disk
asheet -> export, 'test.xls'
obj_destroy, asheet

;you may wish to stop things here to take a look
;stop

widget_control, tlb, /destroy

end

There are some memory management issues that I just ignored for this
example. You will notice that a few objects aren't cleaned up properly.
Who knows where they come from, but a little bit of sleuthing would probably
solve this problem.


This might not be for the faint of heart but it certainly wins in the style
points competition!


-Rick
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: Using idlrt.exe
Next Topic: Executable

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 10:33:10 PDT 2025

Total time taken to generate the page: 0.80046 seconds