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

Home » Public Forums » archive » Re: widget, draw and file pickup
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
Re: widget, draw and file pickup [message #60712] Sun, 08 June 2008 21:56
jigga1206 is currently offline  jigga1206
Messages: 9
Registered: February 2008
Junior Member
Thanks Jean for the post! I have often faced this problem...and
turning on & off event processing as Paul has suggested is not so
elegant when many files are being opened and closed, sometimes
congruently. I previously had used tedious error catching handlers to
overcome this side effect.

frank
Re: widget, draw and file pickup [message #60726 is a reply to message #60712] Fri, 06 June 2008 14:53 Go to previous message
Jean H. is currently offline  Jean H.
Messages: 472
Registered: July 2006
Senior Member
Hi again,

ok, Jim Pendleton from ITTVIS found the solution... it is an old bug in
dialog_pickfile (CR 14734). Basically, it triggers an event with some delay.

The workaround from Jim is attached, in case anyone else has the same
problem!

Thanks to Jim and all of you that had a look at this!

Jean

pro doublclickproblem_gui_itt_event, event
widget_control,event.top, get_uValue=info
;BUTTON EVENT
IF (TAG_NAMES(event, /STRUCTURE_NAME) eq 'WIDGET_BUTTON') THEN BEGIN
WIDGET_CONTROL, event.ID, GET_uValue=buttonPressed
if buttonPressed eq "open" then begin
widget_control, event.top, sensitive = 0
result=dialog_pickFile(dialog_parent = event.top)
wait, .1
widget_control, event.top, sensitive = 1
widget_control,info.drawID , /clear_events
endIf
ENDIF

;MOUSE EVENTS
IF (TAG_NAMES(event, /STRUCTURE_NAME) eq 'WIDGET_DRAW') THEN BEGIN
if (event.release eq 1) then $
print, "Click happened"
ENDIF
end



pro doublclickproblem_gui_itt
info = {mainBaseID:0, drawID:0}

;main
mainBaseID = widget_base(/col)
info.mainBaseID=mainBaseID

;display area
info.drawID = widget_draw(mainBaseID, SCR_XSIZE = 850, SCR_YSIZE = 512, /BUTTON_EVENTS)

;Open button
wbaseID = widget_base(mainBaseID,/row, group_leader = mainBaseID, frame=1)
tmp = widget_button(wbaseID,value="Open", uValue="open", toolTip = "Open a file")

widget_control,mainBaseID, set_uValue=info,/realize
xmanager, 'doublclickproblem_gui_itt', mainBaseID
end
Re: widget, draw and file pickup [message #60744 is a reply to message #60726] Thu, 05 June 2008 13:57 Go to previous message
Jean H. is currently offline  Jean H.
Messages: 472
Registered: July 2006
Senior Member
Paul van Delst wrote:
> Jean H wrote:
>> Ok, the workaround I have found it to record the system time when I
>> open my file, and to process the click event only if it happens more
>> than 0.2s after opening the file...
>>
>> I am still interested to know if there is a more elegant way of doing
>> this!
>
> Yes. Don't enable event processing until after the file is open.

Ah, of course!

... though, strange enough, enabling the button_event just after opening
the file still triggers the event...Anyways, that's a detail... I will
be working on it a bit :)

Thanks,
Jean
Re: widget, draw and file pickup [message #60746 is a reply to message #60744] Thu, 05 June 2008 13:20 Go to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
Jean H wrote:
> Ok, the workaround I have found it to record the system time when I open
> my file, and to process the click event only if it happens more than
> 0.2s after opening the file...
>
> I am still interested to know if there is a more elegant way of doing this!

Yes. Don't enable event processing until after the file is open.
Re: widget, draw and file pickup [message #60747 is a reply to message #60746] Thu, 05 June 2008 12:55 Go to previous message
Jean H. is currently offline  Jean H.
Messages: 472
Registered: July 2006
Senior Member
Ok, the workaround I have found it to record the system time when I open
my file, and to process the click event only if it happens more than
0.2s after opening the file...

I am still interested to know if there is a more elegant way of doing this!

Jean
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: vertical line that moves with cursor in draw widget
Next Topic: Group specification of format codes on data of varying dimensions

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

Current Time: Wed Oct 08 19:20:25 PDT 2025

Total time taken to generate the page: 0.00603 seconds