Re: Widget Communication [message #53457] |
Thu, 12 April 2007 07:22 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
prahladvkumar@gmail.com writes:
> I am very new to IDL programming. Here is the code that i had written
> very recently.
> Please look to this. The problem I am facing with this program is---
> as and when i click on "Upper" button I am getting the output in upper
> case but if I click on the "Upper" again I am getting one more base.If
> I click for 10 times I am getting 10 basesbut I want the output in one
> base only even if I change the text in the box or even I click the
> button n times.
Well, don't create new widgets when you click the buttons.
Just get the text out of the one text widget you have, change
it, and put it back. Your event handler should look like this:
pro widget_linking_pointers_event,ev
widget_control,ev.top,get_uvalue = pstate
widget_control,ev.id,get_uvalue = uval
case uval of
'Lower' : begin
print,'hello'
widget_control,(*pstate).text, get_value = name
widget_control,(*pstate).text, set_value = StrLowCase(name)
end
'Upper' : begin
widget_control,(*pstate).text,get_value = name
widget_control,(*pstate).text,set_value = StrUpCase(name)
end
endcase
end
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|