Reset fonts / Problem with colorbuttonbitmap.pro from D. Fanning [message #61279] |
Mon, 14 July 2008 04:10  |
Justus Skorps
Messages: 20 Registered: April 2007
|
Junior Member |
|
|
Hi,
I just tried to use the colorbuttonbitmap tool in a program and got a
problem with it:
I am working on an Solaris system and normally, when I enter
Device, get_current_font=font
I get an empty string as answer. But after using the
colorbuttonbitmap.pro another value is set ('-dt-interface system-
medium-r-normal-m sans-17-170-72-72-p-97-iso8859-1') and I cannot
reset the font. Trying to enter the empty string with
Device, set_font=''
does not work. The problem is now that any letters as marks, titles...
have an different size depending if the colorbuttonbitmap function has
been used or not. After using the function I have to quit IDL and
start it again, a simple reset does not work, to get the normal font
size back.
Anyone has a solution for this problem?
Thanks,
Justus
---The code snipplet (taken from colorbuttonbitmap.pro from D.
Fanning):
wTLB = Widget_Base()
wBtn = Widget_Button(wTLB)
font = Widget_Info(wBtn, /FontName)
Widget_Control, wTLB, /Destroy
Window, XSize=100, YSize=100, /Pixmap, /Free, Retain=2
Device, Set_Font=font
WDelete, !D.Window
|
|
|
Re: Reset fonts / Problem with colorbuttonbitmap.pro from D. Fanning [message #61391 is a reply to message #61279] |
Wed, 16 July 2008 07:02  |
jschwab@gmail.com
Messages: 30 Registered: December 2006
|
Member |
|
|
> The 'problem' is when no element matches the condition...you always
> have to use the count parameter to check if the result is an usable
> index..
>
> for example, if I have an array A and I want to set all elements less
> than 0 to 0..then I would like to use a command like
>
> A[where(A lt 0)]=0
>
> But this works only if there is at least one element in A less than
> 0...so you always have to use two lines of code for such a simple
> thing..
For the really simple thing you mentioned, you can do it in one line.
a >= 0
For more complex things, the extra line of code isn't too much of a
hassle. Considering the usefulness of where() it's a price I'm quite
willing to pay.
Josiah
|
|
|
Re: Reset fonts / Problem with colorbuttonbitmap.pro from D. Fanning [message #61394 is a reply to message #61279] |
Wed, 16 July 2008 05:41  |
Carsten Lechte
Messages: 124 Registered: August 2006
|
Senior Member |
|
|
James Kuyper wrote:
> A valid issue; but to call it "screwed up", you should have some more
> convenient alternative approach in mind. What would that alternative be?
Whatever Matlab does, of course :-)
Return an empty array, and let empty arrays be valid array subscripts.
I remember reading that the way IDL works internally, it is not possible
to have empty arrays without a major rewrite of IDL.
chl
|
|
|
Re: Reset fonts / Problem with colorbuttonbitmap.pro from D. Fanning [message #61403 is a reply to message #61279] |
Wed, 16 July 2008 02:41  |
jameskuyper
Messages: 79 Registered: October 2007
|
Member |
|
|
Justus Skorps wrote:
> On 15 Jul., 21:21, Jeremy Bailin <astroco...@gmail.com> wrote:
>>> Fonts are not the only thing totally screwed up in IDL...just look at
>>> the 'where' command...
>> I'm just curious... what about WHERE do you find screwed up? In my
>> experience, it always behaves very predictably!
>>
>> -Jeremy.
>
> The 'problem' is when no element matches the condition...you always
> have to use the count parameter to check if the result is an usable
> index..
>
> for example, if I have an array A and I want to set all elements less
> than 0 to 0..then I would like to use a command like
>
> A[where(A lt 0)]=0
>
> But this works only if there is at least one element in A less than
> 0...so you always have to use two lines of code for such a simple
> thing..
A valid issue; but to call it "screwed up", you should have some more
convenient alternative approach in mind. What would that alternative be?
What would SkorpesWhere do when no element matches the condition?
|
|
|
Re: Reset fonts / Problem with colorbuttonbitmap.pro from D. Fanning [message #61404 is a reply to message #61279] |
Tue, 15 July 2008 23:22  |
Justus Skorps
Messages: 20 Registered: April 2007
|
Junior Member |
|
|
On 15 Jul., 21:21, Jeremy Bailin <astroco...@gmail.com> wrote:
>> Fonts are not the only thing totally screwed up in IDL...just look at
>> the 'where' command...
>
> I'm just curious... what about WHERE do you find screwed up? In my
> experience, it always behaves very predictably!
>
> -Jeremy.
The 'problem' is when no element matches the condition...you always
have to use the count parameter to check if the result is an usable
index..
for example, if I have an array A and I want to set all elements less
than 0 to 0..then I would like to use a command like
A[where(A lt 0)]=0
But this works only if there is at least one element in A less than
0...so you always have to use two lines of code for such a simple
thing..
But back to topic:
It seems that
Devcie, Set_font='*'
can be used to reset the font...I am not sure if it is a real reset,
but after this command my plots looks much more like before the
colorbuttonbitmap.pro...
|
|
|