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

Home » Public Forums » archive » running an application from the IDL virtual machine
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
running an application from the IDL virtual machine [message #92333] Thu, 19 November 2015 09:58 Go to next message
markb77 is currently offline  markb77
Messages: 217
Registered: July 2006
Senior Member
hi,

My IDL application is written as an object. When the object is created, the GUI of the application pops up, and the user may use the application until the application window is closed.

The application is started like this:

foo = obj_new('my_application')

My question is, how should I run this application from the VM?

If I create a script file containing the command above, and compile this into a SAV file, would that work?

What happens is this: everything starts OK. The object is created and the GUI of the application pops up. However, once the IDL VM finishes executing this line of code, it thinks that it has finished running the program. The VM closes, and my application is destroyed with the VM.

What is the solution? How can I keep the VM running, in an efficient way, until the user closes the application window?

thanks
Mark
Re: running an application from the IDL virtual machine [message #92334 is a reply to message #92333] Thu, 19 November 2015 16:52 Go to previous messageGo to next message
Jim  Pendleton is currently offline  Jim Pendleton
Messages: 165
Registered: November 2011
Senior Member
On Thursday, November 19, 2015 at 10:58:23 AM UTC-7, superchromix wrote:
> hi,
>
> My IDL application is written as an object. When the object is created, the GUI of the application pops up, and the user may use the application until the application window is closed.
>
> The application is started like this:
>
> foo = obj_new('my_application')
>
> My question is, how should I run this application from the VM?
>
> If I create a script file containing the command above, and compile this into a SAV file, would that work?
>
> What happens is this: everything starts OK. The object is created and the GUI of the application pops up. However, once the IDL VM finishes executing this line of code, it thinks that it has finished running the program. The VM closes, and my application is destroyed with the VM.
>
> What is the solution? How can I keep the VM running, in an efficient way, until the user closes the application window?
>
> thanks
> Mark

You will probably want your main widget event loop to be blocking if that's all your object is responsible for.
Re: running an application from the IDL virtual machine [message #92335 is a reply to message #92334] Fri, 20 November 2015 01:41 Go to previous messageGo to next message
markamatic is currently offline  markamatic
Messages: 2
Registered: November 2015
Junior Member
On Friday, November 20, 2015 at 1:52:20 AM UTC+1, Jim P wrote:

> You will probably want your main widget event loop to be blocking if that's all your object is responsible for.

I don't understand what you mean here. Do you mean that the object initialization should never finish, and that the variable foo in the above example should not be returned, until the application closes?

The application itself is a graphics window. It can spawn further instances of itself if it needs to create new windows. The object initialization needs to finish smoothly, in order for things like that to work.
Re: running an application from the IDL virtual machine [message #92336 is a reply to message #92335] Fri, 20 November 2015 02:14 Go to previous messageGo to next message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
On Friday, November 20, 2015 at 10:41:53 AM UTC+1, marka...@gmail.com wrote:
> On Friday, November 20, 2015 at 1:52:20 AM UTC+1, Jim P wrote:
>
>> You will probably want your main widget event loop to be blocking if that's all your object is responsible for.
>
> I don't understand what you mean here. Do you mean that the object initialization should never finish, and that the variable foo in the above example should not be returned, until the application closes?
>
> The application itself is a graphics window. It can spawn further instances of itself if it needs to create new windows. The object initialization needs to finish smoothly, in order for things like that to work.

Hi,
the way I do this is to make an executable of a pro that calls the object.
This is how it looks like:

function myObj::init
;make your widget here or elsewhere within the object
;no need to block the widget
self.wBase = widget_base()
self.wlabel = widget_label(self.wBase, value='show something')
widget_control, self.wBase, /realize
xmanager, 'myObjWid', self.wBase, /no_block
print, 'wid obj initialized'
return,1
end

pro myObj__define
void ={myObj, wBase:0l, wLabel:0l}
end

pro runMyObj
obj = obj_new('myObj')
print, 'obj called, exit pro. Obj lives on.'
end

This does the trick for me.
Is this what you're looking for?

Cheers,
Helder
Re: running an application from the IDL virtual machine [message #92338 is a reply to message #92336] Fri, 20 November 2015 03:26 Go to previous messageGo to next message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
On Friday, November 20, 2015 at 11:14:09 AM UTC+1, Helder wrote:
> On Friday, November 20, 2015 at 10:41:53 AM UTC+1, marka...@gmail.com wrote:
>> On Friday, November 20, 2015 at 1:52:20 AM UTC+1, Jim P wrote:
>>
>>> You will probably want your main widget event loop to be blocking if that's all your object is responsible for.
>>
>> I don't understand what you mean here. Do you mean that the object initialization should never finish, and that the variable foo in the above example should not be returned, until the application closes?
>>
>> The application itself is a graphics window. It can spawn further instances of itself if it needs to create new windows. The object initialization needs to finish smoothly, in order for things like that to work.
>
> Hi,
> the way I do this is to make an executable of a pro that calls the object.
> This is how it looks like:
>
> function myObj::init
> ;make your widget here or elsewhere within the object
> ;no need to block the widget
> self.wBase = widget_base()
> self.wlabel = widget_label(self.wBase, value='show something')
> widget_control, self.wBase, /realize
> xmanager, 'myObjWid', self.wBase, /no_block
> print, 'wid obj initialized'
> return,1
> end
>
> pro myObj__define
> void ={myObj, wBase:0l, wLabel:0l}
> end
>
> pro runMyObj
> obj = obj_new('myObj')
> print, 'obj called, exit pro. Obj lives on.'
> end
>
> This does the trick for me.
> Is this what you're looking for?
>
> Cheers,
> Helder

Hi,
just so to make sure FG also works, here is a minimal example. Once started, you can interact with the plot as usual.
What I always find strange, is that in my case the plot (widget_window) appears black until I run the mouse over the window...

But the rest works. Cheers, Helder

function myObj::init
;make your widget here or elsewhere within the object
;no need to block the widget
self.wBase = widget_base()
self.wWindow = widget_window(self.wBase)
widget_control, self.wBase, /realize
xmanager, 'myObjWid', self.wBase, /no_block
self.pp = plot(/test, current=self.wWindow)
print, 'wid obj initialized'
return,1
end

pro myObj__define
void ={myObj, wBase:0l, wWindow:0l, pp:obj_new()}
end

pro runMyObj
obj = obj_new('myObj')
print, 'obj called, exit pro. Obj lives on.'
end
Re: running an application from the IDL virtual machine [message #92339 is a reply to message #92338] Fri, 20 November 2015 05:39 Go to previous message
markb77 is currently offline  markb77
Messages: 217
Registered: July 2006
Senior Member
Thanks Helder - this works.

Also, it seems that each time I run the executable version of the application, it starts in a new IDL process, running on a different core of the CPU.

Therefore, running my application in the VM is an easy way to use multiple cores of the CPU, without requiring me to start up several IDL_IDLBridge processes, etc.

cheers
Mark
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Transparent overlay in postscript cgimage
Next Topic: IDL Online Documentation for Color Tables

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

Current Time: Wed Oct 08 15:10:03 PDT 2025

Total time taken to generate the page: 0.00519 seconds