
ImageButtonGadget images
- electrochrisso
- Addict
- Posts: 989
- Joined: Mon May 14, 2007 2:13 am
- Location: Darling River
Re: ImageButtonGadget images
You saved me a bit of time to work that bit out TI, so it was worth the mention. 

PureBasic! Purely the best 

Re: ImageButtonGadget images
hi
it could be like that too
Goodday
it could be like that too
Goodday
Code: Select all
#Btnpage_white_office = 1
CatchImage(0,?image)
OpenWindow(#PB_Any, 0, 0, 400, 300, "WindowTitle", #PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)
ButtonImageGadget(#Btnpage_white_office, 30, 30, 32, 32,ResizeImage(0,32,32))
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
DataSection
image:
IncludeBinary #PB_Compiler_Home+"\Examples\Sources\Data\Geebee2.bmp"
EndDataSection
- electrochrisso
- Addict
- Posts: 989
- Joined: Mon May 14, 2007 2:13 am
- Location: Darling River
Re: ImageButtonGadget images
Not really related to this posting, anyhow why have you got ResizeImage(0,32,32) as the image id for the ButtonImageGadget.kernadec wrote:hi
it could be like that too
Goodday
Code: Select all
#Btnpage_white_office = 1 CatchImage(0,?image) OpenWindow(#PB_Any, 0, 0, 400, 300, "WindowTitle", #PB_Window_MinimizeGadget|#PB_Window_ScreenCentered) ButtonImageGadget(#Btnpage_white_office, 30, 30, 32, 32,ResizeImage(0,32,32)) Repeat Until WaitWindowEvent() = #PB_Event_CloseWindow DataSection image: IncludeBinary #PB_Compiler_Home+"\Examples\Sources\Data\Geebee2.bmp" EndDataSection

PureBasic! Purely the best 

Re: ImageButtonGadget images
Hello again electrochrisso. It's because the image dimensions are larger than the button. If it is not resized to match the dimensions of the button, only a portion of the image will be drawn.electrochrisso wrote:...why have you got ResizeImage(0,32,32) as the image id for the ButtonImageGadget.
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel 

- electrochrisso
- Addict
- Posts: 989
- Joined: Mon May 14, 2007 2:13 am
- Location: Darling River
Re: ImageButtonGadget images
Yes it changes the handle to the newly resized image, I probably have used it before but forgot, I will remember that one in future.TI-994A wrote:Hello again electrochrisso. It's because the image dimensions are larger than the button. If it is not resized to match the dimensions of the button, only a portion of the image will be drawn.electrochrisso wrote:...why have you got ResizeImage(0,32,32) as the image id for the ButtonImageGadget.

PureBasic! Purely the best 

Re: ImageButtonGadget images
Wow! I answered your question without understanding it; sorry about that.electrochrisso wrote:Yes it changes the handle to the newly resized image, I probably have used it before but forgot, I will remember that one in future.
You're absolutely correct; it seems that ResizeImage() does return a new image handle - not documented though. Thank you for pointing that out.
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel 

Re: ImageButtonGadget images
why this reproach! it is not off topic@electrochrisso Not really related to this posting????
excuse me but you misjudge the code as it is in the same kind.
image data is inserted in the compilation with the same principle,
Goodday
Re: ImageButtonGadget images
But with IncludeBinary some virusscanners gone wild ...
I prefer Stargates Method with Quads ... (and his IDE Tool to make these Datasections)
All types of Images are possible, and other things...
I prefer Stargates Method with Quads ... (and his IDE Tool to make these Datasections)

-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: ImageButtonGadget images
kernadec, please see the first post - this is about an alternative to included data methods.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: ImageButtonGadget images
@IdeasVacuum, I understand the alternative,
I do not dispute your work, it was not my intention, for me just one example.
thank for the sharing.
@Bisonte, OK
would you tell me where I can find the tool, compressed data of Stargate , thanks
Good day
I do not dispute your work, it was not my intention, for me just one example.
thank for the sharing.
@Bisonte, OK

would you tell me where I can find the tool, compressed data of Stargate , thanks
Good day
- VB6_to_PBx
- Enthusiast
- Posts: 627
- Joined: Mon May 09, 2011 9:36 am
Re: ImageButtonGadget images
TI-994A wrote:Hi IdeasVacuum. Thanks for the great work!
Hi VB6_to_PBx. You'll have to either enumerate the ButtonImageGadget() or manually assign it a gadget number. Also, make sure that the ButtonImageGadget() size matches the created image size. Give this a try:VB6_to_PBx wrote:[14:38:05][COMPILER] Line 268: Constant not found: #Btnpage_white_office.
[14:41:04][COMPILER] Line 268: Constant not found: #Btnpage_white_office.
...
a short "complete actual working " source code example showing how to display the image on a button image gadget would help tremendously
Code: Select all
Enumeration #MainWindow #Btnpage_white_office EndEnumeration Procedure DrawBtnpage_white_office() ;the ButtonImageGadget() size should match this image size Protected iImage.i = CreateImage(#PB_Any, 100, 30, 24) If StartDrawing(ImageOutput(iImage)) DrawingMode(#PB_2DDrawing_Default) Plot(0000,0000,RGB(255,255,255)) ... ... ... ... StopDrawing() ;#Btnpage_white_office is the assigned constant for the ButtonImageGadget() SetGadgetAttribute(#Btnpage_white_office, #PB_Button_Image, ImageID(iImage)) EndIf EndProcedure wFlags = #PB_Window_SystemMenu | #PB_Window_ScreenCentered OpenWindow(#MainWindow, #PB_Any, #PB_Any, 300, 300, "Image Button Example", wFlags) ;create a ButtonImageGadget() with #Btnpage_white_office as the gadget number, ;assign a zero value to the ImageID and ensure that the size matches the output image ButtonImageGadget(#Btnpage_white_office, 30, 30, 100, 30, 0) DrawBtnpage_white_office() While WaitWindowEvent() ! #PB_Event_CloseWindow : CloseWindow : Wend
TI-994A ,
thank you very much for your help !
PureBasic .... making tiny electrons do what you want !
"With every mistake we must surely be learning" - George Harrison
- electrochrisso
- Addict
- Posts: 989
- Joined: Mon May 14, 2007 2:13 am
- Location: Darling River
Re: ImageButtonGadget images
Actually it is in the docs, it's further down in the remarks section, as stated:- This function changes the handle of the used image. Therefore it must be newly assigned e.g. to an ImageGadget() with SetGadgetState().TI-994A wrote:Wow! I answered your question without understanding it; sorry about that.electrochrisso wrote:Yes it changes the handle to the newly resized image, I probably have used it before but forgot, I will remember that one in future.
You're absolutely correct; it seems that ResizeImage() does return a new image handle - not documented though. Thank you for pointing that out.
I did a quick test:-
a.l=CreateImage(0,100,100)
Debug a
Debug ImageID(0)
-1140517088
-1140517088
b.l=ResizeImage(0,10,10)
Debug b
Debug ImageID(0)
537204954
537204954
PureBasic! Purely the best 

Re: ImageButtonGadget images
No problem .... : http://purebasic.fr/german/viewtopic.ph ... 45#p294445kernadec wrote:@Bisonte, OK![]()
would you tell me where I can find the tool, compressed data of Stargate , thanks
Good day
Re: ImageButtonGadget images
Hello VB6_to_PBx. I am so glad that it was helpful to you; and thank you for saying so.VB6_to_PBx wrote:TI-994A ,
thank you very much for your help !
Hello electrochrisso. You're right again. The documentation is a little confusing when it mentioned that ResizeImage() returns nonzero if the operation succeeded and zero if it failed, without indicating that the nonzero is the new handle. Regardless, it's always great to learn something new. Thank you.electrochrisso wrote:Actually it is in the docs, it's further down in the remarks section, as stated:- This function changes the handle of the used image. Therefore it must be newly assigned e.g. to an ImageGadget() with SetGadgetState().
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel 
