Issue I am not sure how to fix... Any help appreciated.

Just starting out? Need help? Post your questions and find answers here.
User avatar
Kuron
Addict
Addict
Posts: 1626
Joined: Sat Oct 17, 2009 10:51 pm
Location: Pacific Northwest

Issue I am not sure how to fix... Any help appreciated.

Post by Kuron »

Image

I am not sure if this is a big with PB or a bug in the code. I can eliminate Kuron Code, as the issue can be found in the CanvasGadget example code. My system is set to 125% for the scale setting which is what Windows recommended.

The image button displays properly when first run, but as soon as the color is changed, it is not displaying properly. Is this a DPI issue with the gadget itself, or how the gadget is coded? How do I fix this, so it displays properly? Again, this is the CanvasGadget code as it replicates the same issue I was having.

Since my Traumatic Brain Injury in 2014, I have had to relearn a lot of things, including programming and really have not done much programming since before the TBI. Now DPI is a major obstacle for any program, so I am trying to learn how to deal with this aspect of it properly.

Thank you in advance for any help.
Best wishes to the PB community. Thank you for the memories. ♥️
User avatar
Caronte3D
Addict
Addict
Posts: 1027
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: Issue I am not sure how to fix... Any help appreciated.

Post by Caronte3D »

Use DesktopScaled to draw the box of color :wink:

Code: Select all

        Case #GADGET_Color
          CurrentColor = ColorRequester(CurrentColor)
          If StartDrawing(ImageOutput(#IMAGE_Color))
            Box(0, 0, DesktopScaledX(35), DesktopScaledY(35), CurrentColor)
            StopDrawing()
            SetGadgetAttribute(#GADGET_Color, #PB_Button_Image, ImageID(#IMAGE_Color))
          EndIf
User avatar
Kuron
Addict
Addict
Posts: 1626
Joined: Sat Oct 17, 2009 10:51 pm
Location: Pacific Northwest

Re: Issue I am not sure how to fix... Any help appreciated.

Post by Kuron »

Thank you Caronte3D, that is a huge help in understanding things and how the new DPI related commands work.

There is another issue with the CanvasGadget example that I am not sure how to fix. When you save an image and then load it again, it is not filling the entire canvas gadget. How do I properly fix this?

So far, the only things really tripping me up are DPI related and frankly, I have never had to worry about it before. I am really wanting to understand this code and how to properly make it work, as I plan on rewriting an old 2D mapping program in PB and the CanvasGadget code seems to cover just about anything I would be doing in my program.

*edit* Also doesn't seem to save the image properly, and cuts off part of it... Hmmm... I am starting to understand all the frustrations with DPI issues.



Image
Best wishes to the PB community. Thank you for the memories. ♥️
User avatar
Caronte3D
Addict
Addict
Posts: 1027
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: Issue I am not sure how to fix... Any help appreciated.

Post by Caronte3D »

If you try to load a saved image with a PC with the zoom at 100% and later you need to load that image on a PC with a diferent zoom, you neen to scale that image with "ResizeImage" function if you want to fill the whole box.

Would be better to use only vector graphics if you don't want to losse quality.

And... yes, the DPI things are a nightmare :evil:
User avatar
Kuron
Addict
Addict
Posts: 1626
Joined: Sat Oct 17, 2009 10:51 pm
Location: Pacific Northwest

Re: Issue I am not sure how to fix... Any help appreciated.

Post by Kuron »

Thank you for your help, suggestions and pointers. It is very much appreciated.
Best wishes to the PB community. Thank you for the memories. ♥️
Post Reply