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

Home » Public Forums » archive » Locking graphics in GUI / disable resize, rotate or translate
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
Locking graphics in GUI / disable resize, rotate or translate [message #90501] Thu, 05 March 2015 08:43 Go to next message
PMan is currently offline  PMan
Messages: 61
Registered: January 2011
Member
Hello,

I created a fancy GUI for a project and showed my 10 year old son it. He is interesting in programming and I wanted show off the sorts of things you can make.

Anyway, within about three seconds he can screwed up all the graphics with in the Gui. My question is, is there a way to lock graphics in a GUi? I am using window_widgets with either a map() graphic or image () graphics. I still need the user to be able to click on the map so I can get points from the user clicks, but I don't want the user to be able to zoom, rotate or translate the graphic.


Any idea how to do this?

Best Regards,
Paul
Re: Locking graphics in GUI / disable resize, rotate or translate [message #90502 is a reply to message #90501] Thu, 05 March 2015 08:47 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Paul Mallas writes:

> I created a fancy GUI for a project and showed my 10 year old son it. He is interesting in programming and I wanted show off the sorts of things you can make.
>
> Anyway, within about three seconds he can screwed up all the graphics with in the Gui.

Have you mentioned this to Helder? He might have a job for your son! ;-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: Locking graphics in GUI / disable resize, rotate or translate [message #90503 is a reply to message #90501] Thu, 05 March 2015 08:56 Go to previous messageGo to next message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
On Thursday, March 5, 2015 at 9:43:18 AM UTC-7, Paul Mallas wrote:
> Hello,
>
> I created a fancy GUI for a project and showed my 10 year old son it. He is interesting in programming and I wanted show off the sorts of things you can make.
>
> Anyway, within about three seconds he can screwed up all the graphics with in the Gui. My question is, is there a way to lock graphics in a GUi? I am using window_widgets with either a map() graphic or image () graphics. I still need the user to be able to click on the map so I can get points from the user clicks, but I don't want the user to be able to zoom, rotate or translate the graphic.
>
>
> Any idea how to do this?
>
> Best Regards,
> Paul

Hi Paul,

You can use the EVENT_HANDLER keyword on the Window object, then override a bunch of the methods, and return "0" to skip the default event handling.

Look in the docs under the Widget_Window.

Cheers,
Chris
Re: Locking graphics in GUI / disable resize, rotate or translate [message #90504 is a reply to message #90502] Thu, 05 March 2015 09:01 Go to previous messageGo to next message
PMan is currently offline  PMan
Messages: 61
Registered: January 2011
Member
On Thursday, March 5, 2015 at 11:47:10 AM UTC-5, David Fanning wrote:
> Paul Mallas writes:
>
>> I created a fancy GUI for a project and showed my 10 year old son it. He is interesting in programming and I wanted show off the sorts of things you can make.
>>
>> Anyway, within about three seconds he can screwed up all the graphics with in the Gui.
>
> Have you mentioned this to Helder? He might have a job for your son! ;-)
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")

Funnel his destructive powers for profit? I like it. :)
Re: Locking graphics in GUI / disable resize, rotate or translate [message #90505 is a reply to message #90503] Thu, 05 March 2015 09:03 Go to previous messageGo to next message
PMan is currently offline  PMan
Messages: 61
Registered: January 2011
Member
On Thursday, March 5, 2015 at 11:56:13 AM UTC-5, Chris Torrence wrote:
> On Thursday, March 5, 2015 at 9:43:18 AM UTC-7, Paul Mallas wrote:
>> Hello,
>>
>> I created a fancy GUI for a project and showed my 10 year old son it. He is interesting in programming and I wanted show off the sorts of things you can make.
>>
>> Anyway, within about three seconds he can screwed up all the graphics with in the Gui. My question is, is there a way to lock graphics in a GUi? I am using window_widgets with either a map() graphic or image () graphics. I still need the user to be able to click on the map so I can get points from the user clicks, but I don't want the user to be able to zoom, rotate or translate the graphic.
>>
>>
>> Any idea how to do this?
>>
>> Best Regards,
>> Paul
>
> Hi Paul,
>
> You can use the EVENT_HANDLER keyword on the Window object, then override a bunch of the methods, and return "0" to skip the default event handling.
>
> Look in the docs under the Widget_Window.
>
> Cheers,
> Chris

Thanks Chris, I will look into it.
Re: Locking graphics in GUI / disable resize, rotate or translate [message #90508 is a reply to message #90503] Thu, 05 March 2015 10:21 Go to previous messageGo to next message
PMan is currently offline  PMan
Messages: 61
Registered: January 2011
Member
On Thursday, March 5, 2015 at 11:56:13 AM UTC-5, Chris Torrence wrote:
> On Thursday, March 5, 2015 at 9:43:18 AM UTC-7, Paul Mallas wrote:
>> Hello,
>>
>> I created a fancy GUI for a project and showed my 10 year old son it. He is interesting in programming and I wanted show off the sorts of things you can make.
>>
>> Anyway, within about three seconds he can screwed up all the graphics with in the Gui. My question is, is there a way to lock graphics in a GUi? I am using window_widgets with either a map() graphic or image () graphics. I still need the user to be able to click on the map so I can get points from the user clicks, but I don't want the user to be able to zoom, rotate or translate the graphic.
>>
>>
>> Any idea how to do this?
>>
>> Best Regards,
>> Paul
>
> Hi Paul,
>
> You can use the EVENT_HANDLER keyword on the Window object, then override a bunch of the methods, and return "0" to skip the default event handling.
>
> Look in the docs under the Widget_Window.
>
> Cheers,
> Chris

Great - it works just fine. Thanks for pointing it out.
Re: Locking graphics in GUI / disable resize, rotate or translate [message #90514 is a reply to message #90508] Thu, 05 March 2015 12:53 Go to previous messageGo to next message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
On Thursday, March 5, 2015 at 7:21:05 PM UTC+1, Paul Mallas wrote:
> On Thursday, March 5, 2015 at 11:56:13 AM UTC-5, Chris Torrence wrote:
>> On Thursday, March 5, 2015 at 9:43:18 AM UTC-7, Paul Mallas wrote:
>>> Hello,
>>>
>>> I created a fancy GUI for a project and showed my 10 year old son it. He is interesting in programming and I wanted show off the sorts of things you can make.
>>>
>>> Anyway, within about three seconds he can screwed up all the graphics with in the Gui. My question is, is there a way to lock graphics in a GUi? I am using window_widgets with either a map() graphic or image () graphics. I still need the user to be able to click on the map so I can get points from the user clicks, but I don't want the user to be able to zoom, rotate or translate the graphic.
>>>
>>>
>>> Any idea how to do this?
>>>
>>> Best Regards,
>>> Paul
>>
>> Hi Paul,
>>
>> You can use the EVENT_HANDLER keyword on the Window object, then override a bunch of the methods, and return "0" to skip the default event handling.
>>
>> Look in the docs under the Widget_Window.
>>
>> Cheers,
>> Chris
>
> Great - it works just fine. Thanks for pointing it out.

I'll just add this link where I posted a similar question (although my heir where not the cause for this inquiry).

https://groups.google.com/d/msg/comp.lang.idl-pvwave/JaoG-Ra 9Cms/REMp4vvrn2UJ

Cheers,
Helder
Re: Locking graphics in GUI / disable resize, rotate or translate [message #90547 is a reply to message #90503] Mon, 09 March 2015 12:09 Go to previous messageGo to next message
PMan is currently offline  PMan
Messages: 61
Registered: January 2011
Member
On Thursday, March 5, 2015 at 11:56:13 AM UTC-5, Chris Torrence wrote:
> On Thursday, March 5, 2015 at 9:43:18 AM UTC-7, Paul Mallas wrote:
>> Hello,
>>
>> I created a fancy GUI for a project and showed my 10 year old son it. He is interesting in programming and I wanted show off the sorts of things you can make.
>>
>> Anyway, within about three seconds he can screwed up all the graphics with in the Gui. My question is, is there a way to lock graphics in a GUi? I am using window_widgets with either a map() graphic or image () graphics. I still need the user to be able to click on the map so I can get points from the user clicks, but I don't want the user to be able to zoom, rotate or translate the graphic.
>>
>>
>> Any idea how to do this?
>>
>> Best Regards,
>> Paul
>
> Hi Paul,
>
> You can use the EVENT_HANDLER keyword on the Window object, then override a bunch of the methods, and return "0" to skip the default event handling.
>
> Look in the docs under the Widget_Window.
>
> Cheers,
> Chris

Hi Chris,

I have been working creating a class for handling events. Things are moving along slowly but I think I can do all the stuff I need with this. But I have one question - I am trying to override the selectChange method. How do I change the selection of the graphic directly? I can't do graphic.select (or graphic.select, /clear) since this calls the method I am trying to override and I end up with an infinite loop. Does this make any sense?

Thanks,
Paul
Re: Locking graphics in GUI / disable resize, rotate or translate [message #90549 is a reply to message #90547] Mon, 09 March 2015 14:40 Go to previous messageGo to next message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
On Monday, March 9, 2015 at 1:09:07 PM UTC-6, Paul Mallas wrote:
> Hi Chris,
>
> I have been working creating a class for handling events. Things are moving along slowly but I think I can do all the stuff I need with this. But I have one question - I am trying to override the selectChange method. How do I change the selection of the graphic directly? I can't do graphic.select (or graphic.select, /clear) since this calls the method I am trying to override and I end up with an infinite loop. Does this make any sense?
>
> Thanks,
> Paul

Would it be possible to have some sort of state variable in your class, like "self.selecting=1"? Then call graphic.Select, and check for this variable within your handler, and then return,1 if that were true (after turning the variable back off).
-Chris
Re: Locking graphics in GUI / disable resize, rotate or translate [message #90555 is a reply to message #90549] Tue, 10 March 2015 06:42 Go to previous messageGo to next message
PMan is currently offline  PMan
Messages: 61
Registered: January 2011
Member
On Monday, March 9, 2015 at 5:40:31 PM UTC-4, Chris Torrence wrote:
> On Monday, March 9, 2015 at 1:09:07 PM UTC-6, Paul Mallas wrote:
>> Hi Chris,
>>
>> I have been working creating a class for handling events. Things are moving along slowly but I think I can do all the stuff I need with this. But I have one question - I am trying to override the selectChange method. How do I change the selection of the graphic directly? I can't do graphic.select (or graphic.select, /clear) since this calls the method I am trying to override and I end up with an infinite loop. Does this make any sense?
>>
>> Thanks,
>> Paul
>
> Would it be possible to have some sort of state variable in your class, like "self.selecting=1"? Then call graphic.Select, and check for this variable within your handler, and then return,1 if that were true (after turning the variable back off).
> -Chris

I tried something similar to this - managing the selection at a higher level (sort of above where IDL considers a graphic selected). But I had no luck. But let me take another look. Thanks.
Re: Locking graphics in GUI / disable resize, rotate or translate [message #90556 is a reply to message #90555] Tue, 10 March 2015 07:03 Go to previous messageGo to next message
PMan is currently offline  PMan
Messages: 61
Registered: January 2011
Member
On Tuesday, March 10, 2015 at 9:42:52 AM UTC-4, Paul Mallas wrote:
> On Monday, March 9, 2015 at 5:40:31 PM UTC-4, Chris Torrence wrote:
>> On Monday, March 9, 2015 at 1:09:07 PM UTC-6, Paul Mallas wrote:
>>> Hi Chris,
>>>
>>> I have been working creating a class for handling events. Things are moving along slowly but I think I can do all the stuff I need with this. But I have one question - I am trying to override the selectChange method. How do I change the selection of the graphic directly? I can't do graphic.select (or graphic.select, /clear) since this calls the method I am trying to override and I end up with an infinite loop. Does this make any sense?
>>>
>>> Thanks,
>>> Paul
>>
>> Would it be possible to have some sort of state variable in your class, like "self.selecting=1"? Then call graphic.Select, and check for this variable within your handler, and then return,1 if that were true (after turning the variable back off).
>> -Chris
>
> I tried something similar to this - managing the selection at a higher level (sort of above where IDL considers a graphic selected). But I had no luck. But let me take another look. Thanks.

Part of problem here is that for one 'select' event, my selectChange method gets called twice. Seems to be a bug (I reported this to the support folks) or perhaps some shortfall in my understanding.
Re: Locking graphics in GUI / disable resize, rotate or translate [message #90557 is a reply to message #90556] Tue, 10 March 2015 08:00 Go to previous messageGo to next message
PMan is currently offline  PMan
Messages: 61
Registered: January 2011
Member
On Tuesday, March 10, 2015 at 10:03:13 AM UTC-4, Paul Mallas wrote:
> On Tuesday, March 10, 2015 at 9:42:52 AM UTC-4, Paul Mallas wrote:
>> On Monday, March 9, 2015 at 5:40:31 PM UTC-4, Chris Torrence wrote:
>>> On Monday, March 9, 2015 at 1:09:07 PM UTC-6, Paul Mallas wrote:
>>>> Hi Chris,
>>>>
>>>> I have been working creating a class for handling events. Things are moving along slowly but I think I can do all the stuff I need with this. But I have one question - I am trying to override the selectChange method. How do I change the selection of the graphic directly? I can't do graphic.select (or graphic.select, /clear) since this calls the method I am trying to override and I end up with an infinite loop. Does this make any sense?
>>>>
>>>> Thanks,
>>>> Paul
>>>
>>> Would it be possible to have some sort of state variable in your class, like "self.selecting=1"? Then call graphic.Select, and check for this variable within your handler, and then return,1 if that were true (after turning the variable back off).
>>> -Chris
>>
>> I tried something similar to this - managing the selection at a higher level (sort of above where IDL considers a graphic selected). But I had no luck. But let me take another look. Thanks.
>
> Part of problem here is that for one 'select' event, my selectChange method gets called twice. Seems to be a bug (I reported this to the support folks) or perhaps some shortfall in my understanding.

Here is my barest bones example. Run the code below, the graphics name gets printed twice per one click:

FUNCTION ExWid2Win::Init

self.select = 0

return, 1
END

FUNCTION ExWid2Win::SelectChange, oWin, graphic, mode, wasSelected

print, graphic.name

return, 0

END

PRO ExWid2Win__define

void = {ExWid2Win, $
inherits GraphicsEventAdapter, $
select: 0L}

END

PRO ExWidget2WindowEvents_event, event

w = WIDGET_EVENT(/NOWAIT)

print, 'do nothing'

END

PRO ExWidget2WindowEvents

wBase = WIDGET_BASE(/COLUMN, /TLB_RESIZE_NODRAW, MAP=0)

wDraw = WIDGET_WINDOW(wBase)

WIDGET_CONTROL, wBase, /REALIZE

WIDGET_CONTROL, wDraw, GET_VALUE=win

win.Select

p = PLOT(/TEST, /CURRENT)

handler = OBJ_NEW('ExWid2Win')

win.EVENT_HANDLER = handler

WIDGET_CONTROL, wBase, /MAP

XMANAGER, 'ExWidget2WindowEvents', wBase, /NO_BLOCK

END
Re: Locking graphics in GUI / disable resize, rotate or translate [message #90560 is a reply to message #90557] Tue, 10 March 2015 09:17 Go to previous messageGo to next message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
Hi Paul,

You are getting what looks like two select events because the first time it is trying to directly select the plot while the second time it is trying to use a "select box" to select anything within the box. If you change your handler to return "1", then it only goes in there once, because the selection was successful.

So the short answer is that you need to take that into account when you're designing your handler.

Hope this helps.

-Chris
Re: Locking graphics in GUI / disable resize, rotate or translate [message #90563 is a reply to message #90560] Tue, 10 March 2015 11:23 Go to previous messageGo to next message
PMan is currently offline  PMan
Messages: 61
Registered: January 2011
Member
On Tuesday, March 10, 2015 at 12:17:31 PM UTC-4, Chris Torrence wrote:
> Hi Paul,
>
> You are getting what looks like two select events because the first time it is trying to directly select the plot while the second time it is trying to use a "select box" to select anything within the box. If you change your handler to return "1", then it only goes in there once, because the selection was successful.
>
> So the short answer is that you need to take that into account when you're designing your handler.
>
> Hope this helps.
>
> -Chris

If I change the SelectChange to return '1', I still get two events in for 'data space' plus one more for the 'plot.' But the plot is easy to id and ignore. But I see what your saying, about the call from idlitmanipselectbox__define.pro when return is '0'. When return is '1' there is second call from graphicsmanip__define.pro instead.

Anyway, it seems either way there are at least two calls to selectChange. The only way I can differentiate is using scope_traceback() and just look for the calls from _idlitmanipulator__define.pro and only consider those valid.
Re: Locking graphics in GUI / disable resize, rotate or translate [message #90564 is a reply to message #90563] Tue, 10 March 2015 11:40 Go to previous message
PMan is currently offline  PMan
Messages: 61
Registered: January 2011
Member
On Tuesday, March 10, 2015 at 2:23:22 PM UTC-4, Paul Mallas wrote:
> On Tuesday, March 10, 2015 at 12:17:31 PM UTC-4, Chris Torrence wrote:
>> Hi Paul,
>>
>> You are getting what looks like two select events because the first time it is trying to directly select the plot while the second time it is trying to use a "select box" to select anything within the box. If you change your handler to return "1", then it only goes in there once, because the selection was successful.
>>
>> So the short answer is that you need to take that into account when you're designing your handler.
>>
>> Hope this helps.
>>
>> -Chris
>
> If I change the SelectChange to return '1', I still get two events in for 'data space' plus one more for the 'plot.' But the plot is easy to id and ignore. But I see what your saying, about the call from idlitmanipselectbox__define.pro when return is '0'. When return is '1' there is second call from graphicsmanip__define.pro instead.
>
> Anyway, it seems either way there are at least two calls to selectChange. The only way I can differentiate is using scope_traceback() and just look for the calls from _idlitmanipulator__define.pro and only consider those valid.

But if change plot(/test) to image(/test), it works just as you described.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: FG-graphics polyline - moving the line and changing length/slope
Next Topic: IDLgrImage and the channel keyword

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

Current Time: Wed Oct 08 11:40:19 PDT 2025

Total time taken to generate the page: 0.00582 seconds