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

Home » Public Forums » archive » Widget draw problems...
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
Widget draw problems... [message #15182] Thu, 29 April 1999 00:00 Go to next message
euluis is currently offline  euluis
Messages: 4
Registered: January 1999
Junior Member
Hi all,

windows 95, IDL 5.1.1

I have the following message error on my program, when I destroy a draw
widget and create another in the same base widget (it isn't a top level
base). But this doesn't happen all the times, just when I switch between the
widgets without drawing more than one time to each!

Also Windows�s GDI resources went low when I caused many of these errors. Next
goes some output that I copied to this message:

IDL> .STEP
% Program caused arithmetic error: Floating illegal operand
;self.wdvel contains the ID of the draw widget:
IDL> help, self.wdvel
<Expression> LONG = 273

;The statement that caused the error was:
widget_control, self.WDvel, /DESTROY
;self.WDvel is a draw widget ID.

If you've stepped on this problem, please help me!

Luis Oliveira

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Re: widget draw problems... [message #15233 is a reply to message #15182] Fri, 07 May 1999 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Luis Oliveira (euluis@netscape.net) writes:

> 1.I'm destroying one draw widget and creating two other within the same base.
> Because I want that the base to have the same size, I am doing it like this.
> Of course that I could create one more draw widget instead of destroying one
> and creating two, but, that's not the point ;-)

Humm. I still can't tell what exactly is going on from the
code that you are using, but here is what I suspect. When
you create the new draw widget and realize it, you will have
to have NOTIFY_REALIZE turned on for the draw widget. This will,
in turn, have to call a SET_WID method that will set the window
index number for that draw widget in your object.

There are several things that could go wrong in this
process, but I suspect the window index number is not
being set properly in the object. Thus, you can't draw
into the appropriate window.

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: Widget draw problems... [message #15293 is a reply to message #15182] Mon, 03 May 1999 00:00 Go to previous message
Pavel Romashkin is currently offline  Pavel Romashkin
Messages: 166
Registered: April 1999
Senior Member
Mike Schienle wrote:

> User-Hostile programming! Tie it in to a Quicken account and you could
> really train people fast. When every mistake really costs, there's no
> telling how much we could learn.

Why benefit those who don't deserve it?

> It's not as much fun as electro-shock
> therapy through the mouse button, but definitely more profitable to the
> programmers.

That facility, actually, would be useful. Tactile guidance might be needed to some.
You wouldn't believe that sometimes people would repeatedly click the mouse button
after the warning that pops up saying NOT TO DO so ... In this case I just say to
myself that they just like the looks of the warning message ... A Mac is
irreplaceble here: with a 1-button mouse you can't go wrong. It is better to forget
about holding keys down to emulate other buttons (I think I will yet have more
trouble with this because I am using this feature in my new development).
Cheers,
Pavel
Re: widget draw problems... [message #15299 is a reply to message #15182] Mon, 03 May 1999 00:00 Go to previous message
euluis is currently offline  euluis
Messages: 4
Registered: January 1999
Junior Member
> Luis Oliveira (euluis@netscape.net) writes:
>> I have the following message error on my program, when I destroy a draw
>> widget and create another in the same base widget (it isn't a top level
>> base). But this doesn't happen all the times, just when I switch between the
>> widgets without drawing more than one time to each!
>>
>> Also Windows�s GDI resources went low when I caused many of these errors.
> Next
>> goes some output that I copied to this message:
>>
>> IDL> .STEP
>> % Program caused arithmetic error: Floating illegal operand
>> ;self.wdvel contains the ID of the draw widget:
>> IDL> help, self.wdvel
>> <Expression> LONG = 273
>>
>> ;The statement that caused the error was:
>> widget_control, self.WDvel, /DESTROY
>> ;self.WDvel is a draw widget ID.
>>
>> If you've stepped on this problem, please help me!
>
> There is not enough information here to solve this
> problem, but here are two things to think about:
>
> 1. Why in the world would you be destroying a draw
> widget and creating another one? and,
>
> 2. Are you certain you are not confusing the draw widget's
> identifier with the draw widget's window index number,
> which is the *value* of the draw widget.
>
> We would have to see more code to be certain of what you
> are doing. But I've been racking my brain unsuccessfully
> trying to think of a reason to destroy a draw widget. :-(
>
> Cheers,
>
> David

Hi, sorry for only today being replying.

1.I'm destroying one draw widget and creating two other within the same base.
Because I want that the base to have the same size, I am doing it like this.
Of course that I could create one more draw widget instead of destroying one
and creating two, but, that's not the point ;-)

2. No, I will append the procedure where the error appears...

I'm doing this, so that the user can toogle between one graphic and two,
being that they are two diferent ways to display some data. The user will do
this, by pressing a toolbar button of the application.

Here goes the code (the place where the error occurs will be signaled):

pro TOnePrfView::OnSelGraph, event
;filter events with event.SELECT set to 0
if not event.SELECT then return
;set the flag that "says" if velocity graph is or is not active
vel_active = widget_info(self.WDvel, /VALID_ID)
;check for repeated selection of one of the toolbar buttons
if (event.id eq self.TBSGvel and vel_active) or $
(event.id eq self.TBSGSpeedDir and not vel_active) then return
;if the event came from the menu button then set the toolbar
;buttons
if event.id eq self.MVSelGraph then begin
if vel_active eq 0 then not_vel_active = 1 $
else not_vel_active = 0
widget_control, self.TBSGvel, SET_BUTTON = not_vel_active
widget_control, self.TBSGSpeedDir, SET_BUTTON = vel_active
endif

if vel_active then begin
;/////////////THE ERROR OCCURS HERE
widget_control, self.WDvel, /DESTROY
self->CreateSpeedDirGrWidgets
self->DrawSpeedDirGr
widget_control, self.MVSelGraph, $
SET_VALUE = 'velocity components'
endif else begin
;/////////////THE ERROR OCCURS HERE
widget_control, self.WDspeed, /DESTROY
widget_control, self.WDdir, /DESTROY
self->CreateVelGrWidgets
self->DrawVelGr
widget_control, self.MVSelGraph, SET_VALUE = 'speed direction'
endelse
end ;of TOnePrfView::OnSelGraph

TOnePrfView::Create???GrWidgets creates the draw widgets.
TOnePrfView::Draw???Gr draws to those draw widgets.
Remember that if I draw more than once to one of those draw widgets, the error
don't occurs.

Thanks for reading and for the previous reply,
Luis Oliveira

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Re: Widget draw problems... [message #15322 is a reply to message #15182] Fri, 30 April 1999 00:00 Go to previous message
mgs is currently offline  mgs
Messages: 144
Registered: March 1995
Senior Member
In article <MPG.1192dd62faf3fa54989786@news.frii.com>, davidf@dfanning.com
(David Fanning) wrote:

> Pavel Romashkin (promashkin@cmdl.noaa.gov) writes:
>
>> Speaking about the reasons: I put in the /destroy on a draw widget once as a
>> response of the application to a very reckless user action, so that an
over-excited
>> user could notice that he did something very wrong, if it caused half of the
>> application to collapse and the rest lost any symmethrical shape. I did
not try to
>> recover the application after that though, just made it quit totally
after another
>> mouse click (which most people do instinctively when something goes wrong). I
>> couldn't think of any other reason...
>
> I like it!
>
> For really boneheaded users who don't have a clue you
> could start deleting widgets randomly, depending upon
> how boneheaded they are. Make a stupid choice on a menu
> and BOOM!,the Colors button goes. It would train users
> real fast, I think.
>
> I'm going to include a special chapter in my new
> book on this. :-)

User-Hostile programming! Tie it in to a Quicken account and you could
really train people fast. When every mistake really costs, there's no
telling how much we could learn. It's not as much fun as electro-shock
therapy through the mouse button, but definitely more profitable to the
programmers.

--
Mike Schienle Interactive Visuals, Inc.
mgs@ivsoftware.com Remote Sensing and Image Processing
http://www.ivsoftware.com/ Analysis and Application Development
Re: Widget draw problems... [message #15327 is a reply to message #15182] Thu, 29 April 1999 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Pavel Romashkin (promashkin@cmdl.noaa.gov) writes:

> Speaking about the reasons: I put in the /destroy on a draw widget once as a
> response of the application to a very reckless user action, so that an over-excited
> user could notice that he did something very wrong, if it caused half of the
> application to collapse and the rest lost any symmethrical shape. I did not try to
> recover the application after that though, just made it quit totally after another
> mouse click (which most people do instinctively when something goes wrong). I
> couldn't think of any other reason...

I like it!

For really boneheaded users who don't have a clue you
could start deleting widgets randomly, depending upon
how boneheaded they are. Make a stupid choice on a menu
and BOOM!,the Colors button goes. It would train users
real fast, I think.

I'm going to include a special chapter in my new
book on this. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Q:Comparison IDL-PVWAVE
Next Topic: Re: Variable stride in array indices

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

Current Time: Wed Oct 08 15:12:42 PDT 2025

Total time taken to generate the page: 0.00828 seconds