Re: Resizing object graphics on X [message #22181] |
Wed, 25 October 2000 00:00 |
promashkin
Messages: 169 Registered: December 1999
|
Senior Member |
|
|
David Fanning wrote:
>
> P.S. Anybody else discovering that writing platform-independent
> code takes a LOT of work. :-(
In fact, using DIMENSION keyword did not cross my mind to begin with, so
in my Display I used draw widget resize to begin with. Works perfectly
across platforms. I guess, I was not smart enough to get into a problem :-(
Cheers,
Pavel
|
|
|
Re: Resizing object graphics on X [message #22185 is a reply to message #22181] |
Wed, 25 October 2000 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Dave Greenwood (greenwoodde@ornl.gov) writes:
> The solution came from one of those newsgroup-shy RSI folks (thanks JP).
> What I needed to do was to resize the draw *widget* instead of the draw
> *window*:
>
> drawid = widget_info(event.top, find_by_uname='drawwidget')
> widget_control, drawid, xsize = event.x, ysize = event.y
> info.oWindow->draw, info.oView
How come these newsgroup-shy folks don't fill me in?
They must take sadistic pleasure in watching the so-called
experts make fools of themselves. :-(
Anyway, I plan to spend the weekend updating all my programs
to work with IDL 5.4. I'll add this to the list of updates
that have to be made. (Anyone using IDLgrColorbar? That
doesn't work correctly anymore, either. RSI has updated
code if you need it.)
Cheers,
David
P.S. Anybody else discovering that writing platform-independent
code takes a LOT of work. :-(
--
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: Resizing object graphics on X [message #22189 is a reply to message #22181] |
Wed, 25 October 2000 00:00  |
promashkin
Messages: 169 Registered: December 1999
|
Senior Member |
|
|
David Fanning wrote:
> That is how I would write the code. In fact, that
> is how I *write* the code in many of my programs,
> and I've never heard they don't work on X devices.
> But then again, maybe that's why no one wants to
> buy them. :-)
Na-a, that has nothing to do with it. It is more likely that they don't
buy 'em because they have an option of downloading 'em for free :-)
> I really don't have any suggestions. I'm really
> curious to see if this behavior can be duplicated
> by other people.
Sure, that's exactly what it did on my X terminal. But if you tell the
*draw widget* to resize on the top base event, not *ask* the OS to
resize an IDLgrWindow object, then the object window get resized
allright. Widget_control (notice "CONTROL" in it) allows you to
*control*, by the syntax alone. On the other hand, "setProperty,
dimension=[this, that], /if_you_please" is merely a plea to the OS,
which decides then if it likes you enough to do it :-)
Cheers,
Pavel
P.S. Now, as I think about it, what criteria does the OS use to decide
to ignore a programmer's request? Maybe, thats where personal
programming style comes into play :-)
|
|
|
Re: Resizing object graphics on X [message #22191 is a reply to message #22181] |
Wed, 25 October 2000 00:00  |
Dave Greenwood
Messages: 33 Registered: October 2000
|
Member |
|
|
davidf@dfanning.com (David Fanning) wrote:
> Dave Greenwood (greenwoodde@ornl.gov) writes:
>
>> I'm trying to learn a little about object graphics. I'd like to make
>> my widgets resizable, but I'm obviously missing something. The following
>> program (based on some code from the IDL examples and David's web site)
>> resizes the way I'd like on my PeeCee, but not when using X (on HP-UX or
>> VMS). On the PC, when I expand the size of the widget the graphics
>> display expands to fill the widget. Using X the graphics display stays
>> the original size in the lower left corner (but the "black drawing area"
>> expands to fill the widget). I'm using IDL 5.3 on all systems (well,
>> actually, the PC has 5.3.1.)
>>
>> What do I need to do to make resizing work on X devices?
>
> Wow. That's weird. :-(
>
> That is how I would write the code. In fact, that
> is how I *write* the code in many of my programs,
[snip]
Yeah, I know - I took the idea from one of your programs. ;-)
The solution came from one of those newsgroup-shy RSI folks (thanks JP).
What I needed to do was to resize the draw *widget* instead of the draw
*window*:
drawid = widget_info(event.top, find_by_uname='drawwidget')
widget_control, drawid, xsize = event.x, ysize = event.y
info.oWindow->draw, info.oView
Dave
--------------
Dave Greenwood Email: Greenwoodde@ORNL.GOV
Oak Ridge National Lab %STD-W-DISCLAIMER, I only speak for myself
|
|
|
Re: Resizing object graphics on X [message #22192 is a reply to message #22181] |
Wed, 25 October 2000 00:00  |
promashkin
Messages: 169 Registered: December 1999
|
Senior Member |
|
|
If you take a look at a caveat for DIMENSIONS keyword for the
IDGgrWindow object, then you will notice that it says "Note - Changing
DIMENSIONS properties is merely a request and may be ignored for various
reasons. "
Therefore, I think that your Windows toolkit fullfills that request *for
some reason*, while X ignores it for *some other reason*. Try the
following, it works on either one. Besides, at first I could see nothing
but a black box on both Mac and X, because the machines I have do not
(apparently) support a default OS backing store. So I added that, too.
Cheers,
Pavel
;***** MODIFIED *********
pro t_event, event
widget_control, event.top, get_uvalue=info, /no_copy
info.oWindow->SetProperty, Dimension=[event.x, event.y]
widget_control, info.draw, draw_xsize=event.x, $
draw_ysize=event.y
info.oWindow->draw, info.oView
widget_control, event.top, set_uvalue=info, /no_copy
end
PRO t
x=findgen(100)
y=sin(x/10)
oModel = obj_new('IDLgrModel')
oView = obj_new('IDLgrView')
oPlot = obj_new('IDLgrPlot', x, y)
oPlot->GetProperty, XRANGE=xr, YRange=yr
xs = Norm_Coord(xr)
xs[0] = xs[0] - 0.5
ys = Norm_Coord(yr)
ys[0] = ys[0] - 0.5
oPlot->SetProperty, XCoord_conv=xs, YCoord_conv=ys
oModel->add, oPlot
oView->add, oModel
base = Widget_base( uname='t', /tlb_size_events)
draw = Widget_draw( base, graphics_level=2, retain=2 )
widget_control, base, /realize
widget_control, draw, get_value=oWindow
oWindow->Draw, oView
info = { oWindow: oWindow, $
oView: oView , draw: draw }
widget_control, base, set_uvalue=info, /No_Copy
xmanager, 't', base
end
|
|
|
Re: Resizing object graphics on X [message #22194 is a reply to message #22181] |
Wed, 25 October 2000 00:00  |
mole6e23
Messages: 31 Registered: December 1998
|
Member |
|
|
I was able to reproduce the not resizing correctly behavior under IDL 5.3
on Alpha Unix. HOWEVER, I just installed IDL 5.4 about 15 minutes ago, and
ran the code again, and it works correctly now. I guess an update is
needed in order to get this to work on X???
Todd
davidf@dfanning.com (David Fanning) wrote:
> Dave Greenwood (greenwoodde@ornl.gov) writes:
>
>> I'm trying to learn a little about object graphics. I'd like to make
>> my widgets resizable, but I'm obviously missing something. The following
>> program (based on some code from the IDL examples and David's web site)
>> resizes the way I'd like on my PeeCee, but not when using X (on HP-UX or
>> VMS). On the PC, when I expand the size of the widget the graphics
>> display expands to fill the widget. Using X the graphics display stays
>> the original size in the lower left corner (but the "black drawing area"
>> expands to fill the widget). I'm using IDL 5.3 on all systems (well,
>> actually, the PC has 5.3.1.)
>>
>> What do I need to do to make resizing work on X devices?
>
> I really don't have any suggestions. I'm really
> curious to see if this behavior can be duplicated
> by other people.
>
> Cheers,
>
> David
|
|
|
Re: Resizing object graphics on X [message #22196 is a reply to message #22181] |
Wed, 25 October 2000 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Dave Greenwood (greenwoodde@ornl.gov) writes:
> I'm trying to learn a little about object graphics. I'd like to make
> my widgets resizable, but I'm obviously missing something. The following
> program (based on some code from the IDL examples and David's web site)
> resizes the way I'd like on my PeeCee, but not when using X (on HP-UX or
> VMS). On the PC, when I expand the size of the widget the graphics
> display expands to fill the widget. Using X the graphics display stays
> the original size in the lower left corner (but the "black drawing area"
> expands to fill the widget). I'm using IDL 5.3 on all systems (well,
> actually, the PC has 5.3.1.)
>
> What do I need to do to make resizing work on X devices?
Wow. That's weird. :-(
That is how I would write the code. In fact, that
is how I *write* the code in many of my programs,
and I've never heard they don't work on X devices.
But then again, maybe that's why no one wants to
buy them. :-)
I really don't have any suggestions. I'm really
curious to see if this behavior can be duplicated
by other people.
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
|
|
|