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

Home » Public Forums » archive » leap variables and widgets
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
leap variables and widgets [message #39151] Tue, 20 April 2004 08:14
Olivier_Gasnault is currently offline  Olivier_Gasnault
Messages: 2
Registered: April 2004
Junior Member
Could anyone point out what goes wrong in the set of codes below.

Run the widget1 procedure and click twice on the button.
The program stops then.
At this stage pvar is not a valid pointer, while it should !
Why ?

If you comment the ptr_free command then the problem disappear...
But I do not understand why the ptr_free would be executed before the
end of the widget2 procedure.


;---

pro widget2_event, ev

common pointer, pvar
WIDGET_CONTROL, ev.id, get_uvalue=uval

if uval eq 'BUTTON2' then stop

end

;---

pro widget2

common pointer, pvar

base2 = WIDGET_BASE(title='widget2')
button2 = WIDGET_BUTTON(base2, uvalue='BUTTON2')

WIDGET_CONTROL, base2, /REALIZE
XMANAGER, 'Widget2', base2

end

;---

function main_widget2

common pointer, pvar

struct_pvar = {hello:'hello'}
pvar = ptr_new(struct_pvar, /NO_COPY)

widget2
ptr_free, pvar

end

;---

pro widget1_event, ev

WIDGET_CONTROL, ev.id, get_uvalue=uval

if uval eq 'BUTTON1' then f = main_widget2()

end

;---

pro widget1

base1 = WIDGET_BASE(title='widget1')
button1 = WIDGET_BUTTON(base1, uvalue='BUTTON1')

WIDGET_CONTROL, base1, /REALIZE
XMANAGER, 'Widget1', base1

end
[Message index]
 
Read Message
Previous Topic: dialog_pickfile
Next Topic: Re: leap variables and widgets

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

Current Time: Sun Oct 12 12:15:42 PDT 2025

Total time taken to generate the page: 0.56000 seconds