Problems with bitmapped button widget [message #59775] |
Fri, 11 April 2008 04:56  |
rhyme2ri2
Messages: 11 Registered: February 2008
|
Junior Member |
|
|
Hello all,
A very simple thing i'm trying to do but somehow i'm stuck with it....
I want a bitmapped button. For this i'm using following :
cmddownloadall = Widget_Button(pradar, UNAME='cmddownloadall' $
,XOFFSET=800 ,YOFFSET=100 ,SCR_XSIZE=30 ,SCR_YSIZE=24 $
,/ALIGN_CENTER,TOOLTIP='Download All files' $
,VALUE='downloadall.bmp' ,sensitive=0,frame=1,/BITMAP)
Well this is it and i'm not able to get the image button. Issues like
checking the availability of file or trying to provide the full path
name of image file are already addressed by me :)
Image is a 24-bit bitmap.
What it shows is just a blank button with the frame or sometimes just
the text written in value..(strange but true)
Can any one point out where m i wrong??
Thanks & Regards
-Ritu
|
|
|
Re: Problems with bitmapped button widget [message #59870 is a reply to message #59775] |
Mon, 14 April 2008 14:18   |
Spon
Messages: 178 Registered: September 2007
|
Senior Member |
|
|
On Apr 14, 8:29 pm, Bob Crawford <Snowma...@gmail.com> wrote:
> On Apr 11, 10:38 am, Spon <christoph.b...@gmail.com> wrote:
>
>
>
>> On Apr 11, 3:26 pm, Spon <christoph.b...@gmail.com> wrote:
>
>>> On Apr 11, 12:56 pm, rhyme2ri2 <rhyme2...@gmail.com> wrote:
>
>>>> Hello all,
>
>>>> A very simple thing i'm trying to do but somehow i'm stuck with it....
>>>> I want a bitmapped button. For this i'm using following :
>
>>>> cmddownloadall = Widget_Button(pradar, UNAME='cmddownloadall' $
>>>> ,XOFFSET=800 ,YOFFSET=100 ,SCR_XSIZE=30 ,SCR_YSIZE=24 $
>>>> ,/ALIGN_CENTER,TOOLTIP='Download All files' $
>>>> ,VALUE='downloadall.bmp' ,sensitive=0,frame=1,/BITMAP)
>
>>>> Well this is it and i'm not able to get the image button. Issues like
>>>> checking the availability of file or trying to provide the full path
>>>> name of image file are already addressed by me :)
>>>> Image is a 24-bit bitmap.
>
>>>> What it shows is just a blank button with the frame or sometimes just
>>>> the text written in value..(strange but true)
>
>>>> Can any one point out where m i wrong??
>
>>>> Thanks & Regards
>>>> -Ritu
>
>>> Using IDL v6.4 on Windows XP Pro, I can duplicate your problem. It
>>> goes away when I set sensitivity = 1
>>> I guess it might be a bug.
>>> Can anyone else verify this?
>
>>> Regards,
>>> Chris
>
>> Looking at it again, it may even be a Feature. I can merrily show and
>> hide the bitmap at will if I stick in a second button that switches
>> the sensitivity of the bitmap button on and off.- Hide quoted text -
>
>> - Show quoted text -
>
> On my system at least 'c:\windows\coffee bean.bmp' is an 8-bit
> bitmap.
>
> Using a 24-bit version has a slightly different effect, rather than
> hiding the whole image the color appears to be turned on/off.
Hi Bob,
Yes, I should've picked a 24-bit file, I guess.
I've tried that now, and yes, with a 24-bit file you can always tell
the bitmaps's there even when the button isn't active. It may be grey,
but it's not invisible, like with 8-bit ones.
According to the helpfile, the bottom left hand pixel's value gets
designated the 'background' value in 24-bit pixels, and becomes see-
through. I'm not sure how this affects how it's displayed in its
'greyed-out' state, maybe it just averages across the r,g,b colour
values for every point or something.
>
> BTW Using your example code the image is visible when the button is
> labelled "On". Isn't that sensitivity = 1?
Yes. The whole point of my example code was to show that I can toggle
bitmap visibility by toggling button sensitivity. :-)
It's what convinced me that the effect was a feature, not a bug.
|
|
|
Re: Problems with bitmapped button widget [message #59872 is a reply to message #59775] |
Mon, 14 April 2008 12:29   |
Bob[3]
Messages: 60 Registered: December 2006
|
Member |
|
|
On Apr 11, 10:38 am, Spon <christoph.b...@gmail.com> wrote:
> On Apr 11, 3:26 pm, Spon <christoph.b...@gmail.com> wrote:
>
>
>
>
>
>> On Apr 11, 12:56 pm, rhyme2ri2 <rhyme2...@gmail.com> wrote:
>
>>> Hello all,
>
>>> A very simple thing i'm trying to do but somehow i'm stuck with it....
>>> I want a bitmapped button. For this i'm using following :
>
>>> cmddownloadall = Widget_Button(pradar, UNAME='cmddownloadall' $
>>> ,XOFFSET=800 ,YOFFSET=100 ,SCR_XSIZE=30 ,SCR_YSIZE=24 $
>>> ,/ALIGN_CENTER,TOOLTIP='Download All files' $
>>> ,VALUE='downloadall.bmp' ,sensitive=0,frame=1,/BITMAP)
>
>>> Well this is it and i'm not able to get the image button. Issues like
>>> checking the availability of file or trying to provide the full path
>>> name of image file are already addressed by me :)
>>> Image is a 24-bit bitmap.
>
>>> What it shows is just a blank button with the frame or sometimes just
>>> the text written in value..(strange but true)
>
>>> Can any one point out where m i wrong??
>
>>> Thanks & Regards
>>> -Ritu
>
>> Using IDL v6.4 on Windows XP Pro, I can duplicate your problem. It
>> goes away when I set sensitivity = 1
>> I guess it might be a bug.
>> Can anyone else verify this?
>
>> Regards,
>> Chris
>
> Looking at it again, it may even be a Feature. I can merrily show and
> hide the bitmap at will if I stick in a second button that switches
> the sensitivity of the bitmap button on and off.- Hide quoted text -
>
> - Show quoted text -
On my system at least 'c:\windows\coffee bean.bmp' is an 8-bit
bitmap.
Using a 24-bit version has a slightly different effect, rather than
hiding the whole image the color appears to be turned on/off.
BTW Using your example code the image is visible when the button is
labelled "On". Isn't that sensitivity = 1?
|
|
|
|
Re: Problems with bitmapped button widget [message #59886 is a reply to message #59775] |
Sat, 12 April 2008 13:39   |
rhyme2ri2
Messages: 11 Registered: February 2008
|
Junior Member |
|
|
On Apr 11, 8:01 pm, Spon <christoph.b...@gmail.com> wrote:
> On Apr 11, 3:43 pm, David Fanning <n...@dfanning.com> wrote:
>
>
>
>
>
>> Spon writes:
>>> Using IDL v6.4 on Windows XP Pro, I can duplicate your problem. It
>>> goes away when I set sensitivity = 1
>>> I guess it might be a bug.
>>> Can anyone else verify this?
>
>> I can't duplicate it. Do you have an example program?
>
>> Cheers,
>
>> David
>> --
>> David Fanning, Ph.D.
>> Fanning Software Consulting, Inc.
>> Coyote's Guide to IDL Programming:http://www.dfanning.com/
>> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
>
> Sure thing, here it is:
>
> -----
> pro testbuttonwidget_event, event
> print, 'button press detected.'
> end
>
> pro testbuttonwidget_switch, event
> widget_control, event.top, get_uvalue = uval
> uval.state = (uval.state + 1) MOD 2
> widget_control, uval.butn, sensitive = uval.state
> if uval.state eq 0 then switchvalue = 'Off' $
> else switchvalue = 'On'
> widget_control, uval.turn, set_value = switchvalue
> widget_control, event.top, set_uvalue = uval
> end
>
> pro testbuttonwidget_quit, event
> widget_control, event.top, /destroy
> end
>
> pro testbuttonwidget, debug = debug
>
> file = 'c:\windows\coffee bean.bmp'
>
> check = query_bmp(file, debug)
> if check ne 1 then message, 'Not a bitmap.'
>
> base = widget_base(/col)
> butn = widget_button(base, xoffset = 80, $
> yoffset = 80, scr_xsize = 64, scr_ysize = $
> 64, /align_center, tooltip = 'Download all files', $
> value = file, sensitive = 0, frame = 1, /bitmap)
> turn = widget_button(base, value = 'Off', $
> event_pro = 'testbuttonwidget_switch')
> exit = widget_button(base, value = 'Quit', $
> event_pro = 'testbuttonwidget_quit')
> widget_control, base, /realize
> uval = {butn:butn, turn:turn, state:0}
> widget_control, base, set_uvalue = uval
> xmanager, 'testbuttonwidget', base, /no_block
>
> return
> end
>
> ------ Hide quoted text -
>
> - Show quoted text -
Well i'v IDL 6.3....
and ya i tries with sensitivity 1 too... but even it is not happening
It gives the error that 'Can't load bitmap file: filename' this is
it....
But the file is there for sire
I even tries using FilePath bt invain...
ne more solutions
_Thanks & Regards
-Ritu
|
|
|
Re: Problems with bitmapped button widget [message #59915 is a reply to message #59775] |
Fri, 11 April 2008 08:01   |
Spon
Messages: 178 Registered: September 2007
|
Senior Member |
|
|
On Apr 11, 3:43 pm, David Fanning <n...@dfanning.com> wrote:
> Spon writes:
>> Using IDL v6.4 on Windows XP Pro, I can duplicate your problem. It
>> goes away when I set sensitivity = 1
>> I guess it might be a bug.
>> Can anyone else verify this?
>
> I can't duplicate it. Do you have an example program?
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Sure thing, here it is:
-----
pro testbuttonwidget_event, event
print, 'button press detected.'
end
pro testbuttonwidget_switch, event
widget_control, event.top, get_uvalue = uval
uval.state = (uval.state + 1) MOD 2
widget_control, uval.butn, sensitive = uval.state
if uval.state eq 0 then switchvalue = 'Off' $
else switchvalue = 'On'
widget_control, uval.turn, set_value = switchvalue
widget_control, event.top, set_uvalue = uval
end
pro testbuttonwidget_quit, event
widget_control, event.top, /destroy
end
pro testbuttonwidget, debug = debug
file = 'c:\windows\coffee bean.bmp'
check = query_bmp(file, debug)
if check ne 1 then message, 'Not a bitmap.'
base = widget_base(/col)
butn = widget_button(base, xoffset = 80, $
yoffset = 80, scr_xsize = 64, scr_ysize = $
64, /align_center, tooltip = 'Download all files', $
value = file, sensitive = 0, frame = 1, /bitmap)
turn = widget_button(base, value = 'Off', $
event_pro = 'testbuttonwidget_switch')
exit = widget_button(base, value = 'Quit', $
event_pro = 'testbuttonwidget_quit')
widget_control, base, /realize
uval = {butn:butn, turn:turn, state:0}
widget_control, base, set_uvalue = uval
xmanager, 'testbuttonwidget', base, /no_block
return
end
-----
|
|
|
|
Re: Problems with bitmapped button widget [message #59918 is a reply to message #59775] |
Fri, 11 April 2008 07:38   |
Spon
Messages: 178 Registered: September 2007
|
Senior Member |
|
|
On Apr 11, 3:26 pm, Spon <christoph.b...@gmail.com> wrote:
> On Apr 11, 12:56 pm, rhyme2ri2 <rhyme2...@gmail.com> wrote:
>
>
>
>> Hello all,
>
>> A very simple thing i'm trying to do but somehow i'm stuck with it....
>> I want a bitmapped button. For this i'm using following :
>
>> cmddownloadall = Widget_Button(pradar, UNAME='cmddownloadall' $
>> ,XOFFSET=800 ,YOFFSET=100 ,SCR_XSIZE=30 ,SCR_YSIZE=24 $
>> ,/ALIGN_CENTER,TOOLTIP='Download All files' $
>> ,VALUE='downloadall.bmp' ,sensitive=0,frame=1,/BITMAP)
>
>> Well this is it and i'm not able to get the image button. Issues like
>> checking the availability of file or trying to provide the full path
>> name of image file are already addressed by me :)
>> Image is a 24-bit bitmap.
>
>> What it shows is just a blank button with the frame or sometimes just
>> the text written in value..(strange but true)
>
>> Can any one point out where m i wrong??
>
>> Thanks & Regards
>> -Ritu
>
> Using IDL v6.4 on Windows XP Pro, I can duplicate your problem. It
> goes away when I set sensitivity = 1
> I guess it might be a bug.
> Can anyone else verify this?
>
> Regards,
> Chris
Looking at it again, it may even be a Feature. I can merrily show and
hide the bitmap at will if I stick in a second button that switches
the sensitivity of the bitmap button on and off.
|
|
|
Re: Problems with bitmapped button widget [message #59919 is a reply to message #59775] |
Fri, 11 April 2008 07:26   |
Spon
Messages: 178 Registered: September 2007
|
Senior Member |
|
|
On Apr 11, 12:56 pm, rhyme2ri2 <rhyme2...@gmail.com> wrote:
> Hello all,
>
> A very simple thing i'm trying to do but somehow i'm stuck with it....
> I want a bitmapped button. For this i'm using following :
>
> cmddownloadall = Widget_Button(pradar, UNAME='cmddownloadall' $
> ,XOFFSET=800 ,YOFFSET=100 ,SCR_XSIZE=30 ,SCR_YSIZE=24 $
> ,/ALIGN_CENTER,TOOLTIP='Download All files' $
> ,VALUE='downloadall.bmp' ,sensitive=0,frame=1,/BITMAP)
>
> Well this is it and i'm not able to get the image button. Issues like
> checking the availability of file or trying to provide the full path
> name of image file are already addressed by me :)
> Image is a 24-bit bitmap.
>
> What it shows is just a blank button with the frame or sometimes just
> the text written in value..(strange but true)
>
> Can any one point out where m i wrong??
>
> Thanks & Regards
> -Ritu
Using IDL v6.4 on Windows XP Pro, I can duplicate your problem. It
goes away when I set sensitivity = 1
I guess it might be a bug.
Can anyone else verify this?
Regards,
Chris
|
|
|
Re: Problems with bitmapped button widget [message #59946 is a reply to message #59775] |
Tue, 22 April 2008 06:33  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Spon writes:
> You can get around this by creating a child base to the base with /
> SCROLL on, and making this child the parent of your button widget.
> Although I'm guessing it'll make it even more tricky to get the
> overall widget geometry to behave >:-(
I've been adding XPAD=0, YPAD=0 to all of my layout
bases recently to get them to take up less space. In
the old days, they used to not take up any space at all.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Problems with bitmapped button widget [message #59947 is a reply to message #59775] |
Tue, 22 April 2008 06:28  |
Spon
Messages: 178 Registered: September 2007
|
Senior Member |
|
|
On Apr 22, 11:43 am, rhyme2ri2 <rhyme2...@gmail.com> wrote:
> On Apr 15, 2:18 am, Spon <christoph.b...@gmail.com> wrote:
>
>
>
>> On Apr 14, 8:29 pm, Bob Crawford <Snowma...@gmail.com> wrote:
>
>>> On Apr 11, 10:38 am, Spon <christoph.b...@gmail.com> wrote:
>
>>>> On Apr 11, 3:26 pm, Spon <christoph.b...@gmail.com> wrote:
>
>>>> > On Apr 11, 12:56 pm, rhyme2ri2 <rhyme2...@gmail.com> wrote:
>
>>>> > > Hello all,
>
>>>> > > A very simple thing i'm trying to do but somehow i'm stuck with it....
>>>> > > I want a bitmapped button. For this i'm using following :
>
>>>> > > cmddownloadall = Widget_Button(pradar, UNAME='cmddownloadall' $
>>>> > > ,XOFFSET=800 ,YOFFSET=100 ,SCR_XSIZE=30 ,SCR_YSIZE=24 $
>>>> > > ,/ALIGN_CENTER,TOOLTIP='Download All files' $
>>>> > > ,VALUE='downloadall.bmp' ,sensitive=0,frame=1,/BITMAP)
>
>>>> > > Well this is it and i'm not able to get the image button. Issues like
>>>> > > checking the availability of file or trying to provide the full path
>>>> > > name of image file are already addressed by me :)
>>>> > > Image is a 24-bit bitmap.
>
>>>> > > What it shows is just a blank button with the frame or sometimes just
>>>> > > the text written in value..(strange but true)
>
>>>> > > Can any one point out where m i wrong??
>
>>>> > > Thanks & Regards
>>>> > > -Ritu
>
>>>> > Using IDL v6.4 on Windows XP Pro, I can duplicate your problem. It
>>>> > goes away when I set sensitivity = 1
>>>> > I guess it might be a bug.
>>>> > Can anyone else verify this?
>
>>>> > Regards,
>>>> > Chris
>
>>>> Looking at it again, it may even be a Feature. I can merrily show and
>>>> hide the bitmap at will if I stick in a second button that switches
>>>> the sensitivity of the bitmap button on and off.- Hide quoted text -
>
>>>> - Show quoted text -
>
>>> On my system at least 'c:\windows\coffee bean.bmp' is an 8-bit
>>> bitmap.
>
>>> Using a 24-bit version has a slightly different effect, rather than
>>> hiding the whole image the color appears to be turned on/off.
>
>> Hi Bob,
>
>> Yes, I should've picked a 24-bit file, I guess.
>> I've tried that now, and yes, with a 24-bit file you can always tell
>> the bitmaps's there even when the button isn't active. It may be grey,
>> but it's not invisible, like with 8-bit ones.
>
>> According to the helpfile, the bottom left hand pixel's value gets
>> designated the 'background' value in 24-bit pixels, and becomes see-
>> through. I'm not sure how this affects how it's displayed in its
>> 'greyed-out' state, maybe it just averages across the r,g,b colour
>> values for every point or something.
>
>>> BTW Using your example code the image is visible when the button is
>>> labelled "On". Isn't that sensitivity = 1?
>
>> Yes. The whole point of my example code was to show that I can toggle
>> bitmap visibility by toggling button sensitivity. :-)
>> It's what convinced me that the effect was a feature, not a bug.
>
> Yup........After a lot of struggle with the issue, finally i'm
> successful in getting the image on button. But the solution is of
> great surprise to me :|
>
> What i found was the base widget in which i was trying to put the
> image button had SCROLL on.
> When i unset the scroll then i'm able to see the bitmapped image
> button. Yup this seems to be a wierd solution to the problem.
>
> I Would like to know the crux behind this functionality. How can the
> scroll position of base widget affect the display of bitmap in button
> widget???????????? ( or is this a bug.....?)
>
> I'v IDL 6.3
>
> Regards
> -Ritu
You can get around this by creating a child base to the base with /
SCROLL on, and making this child the parent of your button widget.
Although I'm guessing it'll make it even more tricky to get the
overall widget geometry to behave >:-(
Yup, looks like a bug to me. Or at least a restriction that should be
mentioned in the documentation, given that the work-around isn't
*that* complicated.
Well done on spotting it, sounds like a headache and a half to pick
apart...
Cheers,
Chris
|
|
|
Re: Problems with bitmapped button widget [message #59948 is a reply to message #59775] |
Tue, 22 April 2008 05:31  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
rhyme2ri2 writes:
> I Would like to know the crux behind this functionality. How can the
> scroll position of base widget affect the display of bitmap in button
> widget????????????
You haven't been working with computers very long,
have you? (I can tell by the number of question marks
you use.)
This is all just part of the Mystery. All we can do
is continue to sacrifice small animals when the moon
is full.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Problems with bitmapped button widget [message #59949 is a reply to message #59870] |
Tue, 22 April 2008 03:43  |
rhyme2ri2
Messages: 11 Registered: February 2008
|
Junior Member |
|
|
On Apr 15, 2:18 am, Spon <christoph.b...@gmail.com> wrote:
> On Apr 14, 8:29 pm, Bob Crawford <Snowma...@gmail.com> wrote:
>
>
>
>> On Apr 11, 10:38 am, Spon <christoph.b...@gmail.com> wrote:
>
>>> On Apr 11, 3:26 pm, Spon <christoph.b...@gmail.com> wrote:
>
>>>> On Apr 11, 12:56 pm, rhyme2ri2 <rhyme2...@gmail.com> wrote:
>
>>>> > Hello all,
>
>>>> > A very simple thing i'm trying to do but somehow i'm stuck with it....
>>>> > I want a bitmapped button. For this i'm using following :
>
>>>> > cmddownloadall = Widget_Button(pradar, UNAME='cmddownloadall' $
>>>> > ,XOFFSET=800 ,YOFFSET=100 ,SCR_XSIZE=30 ,SCR_YSIZE=24 $
>>>> > ,/ALIGN_CENTER,TOOLTIP='Download All files' $
>>>> > ,VALUE='downloadall.bmp' ,sensitive=0,frame=1,/BITMAP)
>
>>>> > Well this is it and i'm not able to get the image button. Issues like
>>>> > checking the availability of file or trying to provide the full path
>>>> > name of image file are already addressed by me :)
>>>> > Image is a 24-bit bitmap.
>
>>>> > What it shows is just a blank button with the frame or sometimes just
>>>> > the text written in value..(strange but true)
>
>>>> > Can any one point out where m i wrong??
>
>>>> > Thanks & Regards
>>>> > -Ritu
>
>>>> Using IDL v6.4 on Windows XP Pro, I can duplicate your problem. It
>>>> goes away when I set sensitivity = 1
>>>> I guess it might be a bug.
>>>> Can anyone else verify this?
>
>>>> Regards,
>>>> Chris
>
>>> Looking at it again, it may even be a Feature. I can merrily show and
>>> hide the bitmap at will if I stick in a second button that switches
>>> the sensitivity of the bitmap button on and off.- Hide quoted text -
>
>>> - Show quoted text -
>
>> On my system at least 'c:\windows\coffee bean.bmp' is an 8-bit
>> bitmap.
>
>> Using a 24-bit version has a slightly different effect, rather than
>> hiding the whole image the color appears to be turned on/off.
>
> Hi Bob,
>
> Yes, I should've picked a 24-bit file, I guess.
> I've tried that now, and yes, with a 24-bit file you can always tell
> the bitmaps's there even when the button isn't active. It may be grey,
> but it's not invisible, like with 8-bit ones.
>
> According to the helpfile, the bottom left hand pixel's value gets
> designated the 'background' value in 24-bit pixels, and becomes see-
> through. I'm not sure how this affects how it's displayed in its
> 'greyed-out' state, maybe it just averages across the r,g,b colour
> values for every point or something.
>
>
>
>> BTW Using your example code the image is visible when the button is
>> labelled "On". Isn't that sensitivity = 1?
>
> Yes. The whole point of my example code was to show that I can toggle
> bitmap visibility by toggling button sensitivity. :-)
> It's what convinced me that the effect was a feature, not a bug.
Yup........After a lot of struggle with the issue, finally i'm
successful in getting the image on button. But the solution is of
great surprise to me :|
What i found was the base widget in which i was trying to put the
image button had SCROLL on.
When i unset the scroll then i'm able to see the bitmapped image
button. Yup this seems to be a wierd solution to the problem.
I Would like to know the crux behind this functionality. How can the
scroll position of base widget affect the display of bitmap in button
widget???????????? ( or is this a bug.....?)
I'v IDL 6.3
Regards
-Ritu
|
|
|