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

Home » Public Forums » archive » Widget Resize on Mac
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 Resize on Mac [message #20801] Tue, 25 July 2000 00:00 Go to next message
Ben Tupper is currently offline  Ben Tupper
Messages: 186
Registered: August 1999
Senior Member
Hello,

I have a resizeable widget direct graphics routine that I am able to use
on UNIX and Windows without difficulty. I have been fussing with it
all day on the Mac because it resizes incorrectly. It seems like the
right hand margin gets chopped so that the last axis label may (or may
not) get trimmed. It doesn't seem to matter if the resize event
results in a smaller or larger widget base.

I have tried using the explicit fix for UNIX widget resizing described
on David's webpage and it seems to help considerably, but the fix does
not solve the problem entirely. Before using the fix, the plot runs
off the draw widget (to the right) after a resize event occurs. With
the fix in place, the plot falls entirely within the draw widget but the
righthand vertical axis is squished against the right hand side of the
draw window.

The UNIX fix is described on David's page...
http://www.dfanning.com/idl5_info/unix_tlb_menu.html

Has this been dealt with before? if so, what is the solution?

Thanks,

Ben

P.S. How come the Mac keyboard size is inversely related to it's
speed? Geez, I'm glad we didn't get the top of the line G4! This
keyboard is much too dainty for my fingers to stump around on!


--
Ben Tupper
Bigelow Laboratory for Ocean Science
West Boothbay Harbor, Maine
btupper@bigelow.org
note: email address new as of 25JULY2000
Re: Widget Resize on Mac [message #20941 is a reply to message #20801] Tue, 01 August 2000 00:00 Go to previous message
promashkin is currently offline  promashkin
Messages: 169
Registered: December 1999
Senior Member
I apologize, I should have been more careful about the width of scroll
bars. 48 pixels now seems like way too much. I just checked and they
appear to be 15 pixels wide. Where I got 48 from, was IDL online help
and it *did not* say it was the width of scroll bars:
***
SCROLL
Set this keyword to give the widget scroll bars that allow viewing
portions of the widget contents that are not currently on the screen.
Note For the Macintosh, if you set XSIZE or YSIZE to a value less than
48, the base created with the SCROLL keyword will be a minimum of 48x48.
If you have not specified values for XSIZE or YSIZE, the base will be
set to a minimum of 66x66. If the base is resized, it will jump to the
minimum size of 128x64.
***
However, Online help must have taken into consideration the way IDL for
Mac works with positioning in the top base, because when I used 48 as a
negative offset on Ben's misaligned Draw widget, that provided perfeclty
visible right plot edge that was very close to the edge of inactive
scroll bar.
I guess I humbly accept I have not yet outgrown the "It works! Cool!"
attitude :-(

Cheers,
Pavel
Re: Widget Resize on Mac [message #20943 is a reply to message #20801] Tue, 01 August 2000 00:00 Go to previous message
Struan Gray is currently offline  Struan Gray
Messages: 178
Registered: December 1995
Senior Member
Ben Tupper, btupper@bigelow.org writes:

> I think you are resizing the draw_widget
> explicity as opposed to resizing the base_widget.

Yup. Well, I'm changing the draw widget to fill up the resized
base defined by the user via the window manager.


> The value 12 is a surprise

It's been a while since I made up the hack, but I seem to remember
that it didn't make sense to me either. It has worked reliably over
several versions of IDL, from 4 onwards. I first stumbled across it
when trying to get some David F's resizable widgets to look nice: they
always seemed to resize twice over without the Mac-specific tweak.
I've seen the same thing with a program ported from Solaris IDL.

I try to take a teenage attitude to these things (It works!
Cool!) without getting too toddlerish (But why Daddy?
Whyyyyyyyyy????). I think this is why the IDL advanced programmers'
group have never invited me to be a Plenary speaker.


Struan
PS: there's a new 'pro' mouse and keyboard from Apple, supposedly
better than the 'orrible ones sold with your G4.
Re: Widget Resize on Mac [message #20945 is a reply to message #20801] Tue, 01 August 2000 00:00 Go to previous message
Ben Tupper is currently offline  Ben Tupper
Messages: 186
Registered: August 1999
Senior Member
Wow! This is getting quite interesting. I had taken the liberty of
pestering Pavel for help which he supplied generously. He tracked the
problem down to my top level base definition which looked like the following:

TLB = Widget_Base(Title = 'Generic Window',$
column = 1, /Base_Align_Center, $
TLB_Size_Events = 1, MBar = MenuID)

Other than the menu bar, the only content of the widget base was a draw
widget. Pavel suggested that I set Base_Align_Center to zero. It solved
the problem.

Your solution is interesting because the window is an IDLgrWindow (as opposed
to a Direct Graphics window, unless your Info.mainWindow is a object wrapper
around the Direct Graphics window.) I think you are resizing the draw_widget
explicity as opposed to resizing the base_widget. The value 12 is a
surprise because Pavel mentioned that the ever-present Mac window scroll bars
occupy 48 pixels.


Thanks,

Ben


Struan Gray wrote:

> Ben Tupper, btupper@bigelow.org writes:
>
>> Has this been dealt with before? if so, what is the solution?
>
> An ugly hack.
>
> My top level bases send only resize events, so in my event handler
> I can have something like this (info is a pointer to a state
> structure):
>
> Case event.id of
> (*info).myID: begin ; resize event from top level base
> if !version.os_family eq 'MacOS' then begin
> xsize = event.x-12
> ysize = event.y-12
> endif else begin
> xsize = event.x
> ysize = event.y
> endelse
> (*info).mainWindow -> SetProperty, Dimension=[xsize, ysize]
> end
> else: ; blah blah blah
> end ; case event.id
>
>
> The value 12 was found by trial and error, but works for both
> direct and object graphics windows (with the appropriate set size
> commands.
>
> Struan

--
Ben Tupper
Bigelow Laboratory for Ocean Science
West Boothbay Harbor, Maine
btupper@bigelow.org
note: email address new as of 25JULY2000
Re: Widget Resize on Mac [message #20948 is a reply to message #20801] Tue, 01 August 2000 00:00 Go to previous message
Struan Gray is currently offline  Struan Gray
Messages: 178
Registered: December 1995
Senior Member
Ben Tupper, btupper@bigelow.org writes:

> Has this been dealt with before? if so, what is the solution?

An ugly hack.

My top level bases send only resize events, so in my event handler
I can have something like this (info is a pointer to a state
structure):

Case event.id of
(*info).myID: begin ; resize event from top level base
if !version.os_family eq 'MacOS' then begin
xsize = event.x-12
ysize = event.y-12
endif else begin
xsize = event.x
ysize = event.y
endelse
(*info).mainWindow -> SetProperty, Dimension=[xsize, ysize]
end
else: ; blah blah blah
end ; case event.id


The value 12 was found by trial and error, but works for both
direct and object graphics windows (with the appropriate set size
commands.


Struan
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Record Day on IDL Newsgroup
Next Topic: ����� �������� ���������� � ������

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

Current Time: Wed Oct 08 13:34:17 PDT 2025

Total time taken to generate the page: 0.00606 seconds