Page 1 of 1
Bug on the IDE?
Posted: Tue Sep 17, 2024 8:24 pm
by ClueLess
Hi
When designing a form, you define the height and width of a gadget, but that gets changed when the code is generated. For example, on the designer you define a string gadget with width of 150 and height of 30, and in the code generated it appears 100, 25.
Is this a bug?
Than You
// Moved from "Bugs - Windows" to "Coding Questions" (Kiffi)
Re: Bug on the IDE?
Posted: Tue Sep 17, 2024 8:27 pm
by jacdelad
Geez...
...without code there are several causes that may be responsible. So before claiming for a bug here, please provide a code, that shows the problem to YOU. After confirming the bug, a mod will move the thread to the bug section.
Re: Bug on the IDE?
Posted: Tue Sep 17, 2024 8:29 pm
by Kiffi
jacdelad wrote: Tue Sep 17, 2024 8:27 pmAfter confirming the bug, a mod will move the thread to the bug section.
+1

Re: Bug on the IDE?
Posted: Tue Sep 17, 2024 9:01 pm
by ClueLess
I have no idea what code do you want me to send. Can't generate a code for the specifications of the gadget on de desiner. Unfortunatly can't send a picture
Re: Bug on the IDE?
Posted: Tue Sep 17, 2024 9:39 pm
by ChrisR
Confirmed, seems to be related to DPI scaling.
Looks good if you close the IDE, change the scaling to 100% and then restart the IDE. You can then restore your default scaling.
Re: Bug on the IDE?
Posted: Wed Sep 18, 2024 1:04 am
by jacdelad
ClueLess wrote: Tue Sep 17, 2024 9:01 pm
I have no idea what code do you want me to send. Can't generate a code for the specifications of the gadget on de desiner. Unfortunatly can't send a picture
What code? The code that shows the problem.
How do you expect us to test it without your code? All I can say is that I don't have the problem and like ChrisR said, it's probably due to dpi settings.
Re: Bug on the IDE?
Posted: Wed Sep 18, 2024 8:56 am
by Mindphazer
jacdelad wrote: Wed Sep 18, 2024 1:04 am
ClueLess wrote: Tue Sep 17, 2024 9:01 pm
I have no idea what code do you want me to send. Can't generate a code for the specifications of the gadget on de desiner. Unfortunatly can't send a picture
What code? The code that shows the problem.
How do you expect us to test it without your code? All I can say is that I don't have the problem and like ChrisR said, it's probably due to dpi settings.
There is no code because, as he said, he uses Form Designer. The code generated by FD doesn't have the same size values of the gadgets than the sizes he set on FD. So the code won't help.
Re: Bug on the IDE?
Posted: Wed Sep 18, 2024 11:38 am
by jacdelad
Oh now I understand. So you want ot create a gadget with height 30 in the form designer, but the resulting code has height 25?
Re: Bug on the IDE?
Posted: Wed Sep 18, 2024 12:49 pm
by Mindphazer
Yeah it seems so
Re: Bug on the IDE?
Posted: Wed Sep 18, 2024 1:20 pm
by TI-994A
ClueLess wrote: Tue Sep 17, 2024 8:24 pm...on the designer you define a string gadget with width of 150 and height of 30, and in the code generated it appears 100, 25.
The Form Designer conforms to DPI awareness. So, this happens when your display is scaled.
As @ChrisR had mentioned earlier in this thread,
simply reset the scaling to 100% and the gadget metrics will revert accordingly.
ChrisR wrote: Tue Sep 17, 2024 9:39 pm...close the IDE, change the scaling to 100% and then restart the IDE. You can then restore your default scaling.
Re: Bug on the IDE?
Posted: Wed Sep 18, 2024 3:50 pm
by ChrisR
Yes, but it shouldn't be like this.
IMO, If the user enters a width of 150 for a Gadget, the width in the generated code should also be 150, whatever its scale factor.
I had a quick look to the FormDesigner source code, removing all DesktopUnscaledX(Y) from codeviewer.pb and all DesktopScaledX(Y) from opensave.pb, it seems to do the trick.
I can test it a bit more and possibly create a Pull Request on github, if it is confirmed as a bug, too.
Temporarily, If anyone would like to test it,
PureBasic.exe (Windows x64)
Re: Bug on the IDE?
Posted: Wed Sep 18, 2024 4:47 pm
by TI-994A
ChrisR wrote: Wed Sep 18, 2024 3:50 pmIMO, If the user enters a width of 150 for a Gadget, the width in the generated code should also be 150, whatever its scale factor.
I believe that this is done to preserve the visual representation of the form at design time.
It is a visual designer after all. 
Re: Bug on the IDE?
Posted: Wed Sep 18, 2024 5:44 pm
by ChrisR
Yes, that's an understandable point of view
As for me, it's a bug, we should have the same values (x, y, width, height) between the grid and the generated code.
As if we were drawing to a scale of 100%. The scaling is then done according to the DPIaware compiler option, to be compatible with all possible scaling factors. That's what I do in my visual designer
Furthermore, the ScrollArea InnerWidth(Height) is not currently scaled/unscaled as for ScrollBar, ProgressBar Minimum(Maximum). It's not consistent with the other values.
My point of view, but I'm not the one who decides whether it's a bug or not.
Re: Bug on the IDE?
Posted: Wed Sep 18, 2024 5:49 pm
by HeX0R
ChrisR wrote: Wed Sep 18, 2024 5:44 pm
My point of view, but I'm not the one who decides whether it's a bug or not.
At least there is one moron who sees it the same way

Re: Bug on the IDE?
Posted: Wed Sep 18, 2024 6:19 pm
by ClueLess
It seems that someone understood what I mean