Re: widget draw problems... [message #15299 is a reply to message #15182] |
Mon, 03 May 1999 00:00   |
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
|
|
|