It is currently Sun Apr 22, 2018 7:33 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: [Done] ImageGadget GadgetWidth / GadgetHeight
PostPosted: Wed Dec 25, 2013 3:42 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Sun Aug 08, 2004 5:21 am
Posts: 3079
Location: Netherlands
Shouldn't at least one of those return the dimensions the gadget was created with ?
Code:
OpenWindow(0, 0, 0, 300, 200, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)

ImageGadget(1, 10, 10, 280, 180, 0)

CreateImage(0, 30, 20)
SetGadgetState(1, ImageID(0))

Debug GadgetWidth(1)
Debug GadgetHeight(1)

Debug GadgetWidth(1, #PB_Gadget_RequiredSize)
Debug GadgetHeight(1, #PB_Gadget_RequiredSize)

Repeat
  Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow

_________________
MacOS 10.13 High Sierra, PB 5.60 x64


Top
 Profile  
Reply with quote  
 Post subject: Re: ImageGadget GadgetWidth / GadgetHeight
PostPosted: Wed Dec 25, 2013 3:51 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Fri Apr 25, 2003 5:24 pm
Posts: 7581
> Shouldn't at least one of those return the dimensions the gadget was created with ?

It does. The manual for ImageGadget() says:

"The gadget adjusts its width and height to fit the displayed image."

No bug.

_________________
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.


Top
 Profile  
Reply with quote  
 Post subject: Re: ImageGadget GadgetWidth / GadgetHeight
PostPosted: Wed Dec 25, 2013 4:03 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Sun Aug 08, 2004 5:21 am
Posts: 3079
Location: Netherlands
True, but the manual also states
Quote:
The gadget adjusts its width and height to fit the displayed image. The specified width and height are only used when no image is displayed.
So if I make it display nothing, shouldn't it least in that case return the values the gadget was created with ?
It's very inconvenient if there's no possibility at all to get the dimensions the gadget was created with.
Code:
OpenWindow(0, 0, 0, 300, 200, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)

ImageGadget(1, 10, 10, 280, 180, 0)

CreateImage(0, 30, 20)
SetGadgetState(1, ImageID(0))
SetGadgetState(1, 0)

Debug GadgetWidth(1)
Debug GadgetHeight(1)

Debug GadgetWidth(1, #PB_Gadget_RequiredSize)
Debug GadgetHeight(1, #PB_Gadget_RequiredSize)

Repeat
  Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow

_________________
MacOS 10.13 High Sierra, PB 5.60 x64


Top
 Profile  
Reply with quote  
 Post subject: Re: ImageGadget GadgetWidth / GadgetHeight
PostPosted: Wed Dec 25, 2013 4:07 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Fri Apr 25, 2003 5:24 pm
Posts: 7581
> It's very inconvenient if there's no possibility at all to
> get the dimensions the gadget was created with

You created the gadget... you already know the dims! :)

As for it still returning 30,20 when no image is applied,
I guess that could be considered a bug and 0,0 should
be returned. Currently, it just returns the last known
dimensions.

_________________
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.


Top
 Profile  
Reply with quote  
 Post subject: Re: ImageGadget GadgetWidth / GadgetHeight
PostPosted: Wed Dec 25, 2013 4:22 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Sun Aug 08, 2004 5:21 am
Posts: 3079
Location: Netherlands
PB wrote:
You created the gadget... you already know the dims! :)

If I want to create a procedure that scales an image to fit and make it display, I need to be able to get the maximum dimensions (the dimensions the gadget was created with).
It's very inconvenient if you have to pass those manually to the procedure all the time. Not really a general purpose procedure in this case.
If it's not a bug, then this should be considered a feature request.
To me it is very strange if there is no way at all to get the dimensions of an image gadget it was created with or manually resized with ResizeGadget.

_________________
MacOS 10.13 High Sierra, PB 5.60 x64


Top
 Profile  
Reply with quote  
 Post subject: Re: [Done] ImageGadget GadgetWidth / GadgetHeight
PostPosted: Thu Nov 02, 2017 10:28 pm 
Offline
PureBasic Team
PureBasic Team
User avatar

Joined: Fri Apr 25, 2003 5:21 pm
Posts: 5760
Location: Germany
Works the same as on the other OS. No bug.

_________________
quidquid Latine dictum sit altum videtur


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye