Lazarus

Programming => LCL => Topic started by: Spoonhorse on June 18, 2021, 07:27:25 pm

Title: Struggling with TPageSetUpDialog
Post by: Spoonhorse on June 18, 2021, 07:27:25 pm
Windows 10, latest FPC/Lazarus. A TPageSetUpDialog has a dropdown menu for the various paper sizes, and two radio buttons for portrait/landscape orientation.

Now first of all these don't seem to be part of the properties of the dialog, which is ... weird. I can't see them anywhere, I can't figure out how to get the values out once the user has set them. Maybe that's just me being dumb.

But when I tried to paper over the problem by just disabling these bits of the dialog, none of the disable options work. Surely that's a bug? They don't hide the options or even stop the users from setting them.

And none of the events fire, when I write event handlers for them nothing happens.

Thanks for any help and/or advice.
Title: Re: Struggling with TPageSetUpDialog
Post by: jamie on June 18, 2021, 11:24:51 pm
Yup, strange. I just checked that in 2.0.4 and trunk, does pretty much what you say.. events don't work..

did you include the Printer4Lazarus and Printers unit in your uses list?
Title: Re: Struggling with TPageSetUpDialog
Post by: Spoonhorse on June 19, 2021, 10:39:49 am
If it's not just me then maybe someone will fix it. Whom does one tell?

I didn't have Printers 'cos I hadn't tried to print anything but I added it and it made no difference. And after all, why would it? If something important was missing from a uses clause that would show up at compile time.
Title: Re: Struggling with TPageSetUpDialog
Post by: winni on June 19, 2021, 11:48:39 am
I If something important was missing from a uses clause that would show up at compile time.

Hi!

That is wrong. Your code compiles fine without Printers4Lazarus but will not work at run time.

Winni
Title: Re: Struggling with TPageSetUpDialog
Post by: Alextp on June 19, 2021, 12:02:14 pm
I made a fix for TPageSetupDialog on win32
https://bugs.freepascal.org/view.php?id=39020
Now psoDisable* options work on Win10.
Title: Re: Struggling with TPageSetUpDialog
Post by: Spoonhorse on June 19, 2021, 03:00:23 pm
Alextp. Thank you! That all works except that it doesn't recognize the constant PSD_NONETWORKBUTTON, and sure enough it isn't defined in my copy of defines.inc with the other PSD_* constants. Can you tell me what it should be? Thanks again. (But then, I can't see a "network button" that could be disabled, is that also a bug? So it works fine for me if I just comment that bit out.)

And can you shed some light on the original problem? The reason I wanted to shut those things off was that I can't see any way to get information in or out of them. I'd be quite happy to have them enabled if there was some way I could see and respond to the users' selections ...

Winni, thanks. I still have much to learn alas.
Title: Re: Struggling with TPageSetUpDialog
Post by: Alextp on June 19, 2021, 05:36:21 pm
My patch defines that constant! In the beginning of the same function, it declares this value PSD_NONETWORKBUTTON.
Title: Re: Struggling with TPageSetUpDialog
Post by: Alextp on June 19, 2021, 05:37:38 pm
About "TPageSetupDialog don't have enough properties"-- it has enough. look at the Delphi7 - same properties. all you need is Paper size x/y, and you have it. Portrait/etc - do you need them?
Title: Re: Struggling with TPageSetUpDialog
Post by: Spoonhorse on June 19, 2021, 08:11:12 pm
Oh, sorry, I missed it.

No, if the feature aren't there * shrug *.
Title: Re: Struggling with TPageSetUpDialog
Post by: Alextp on June 19, 2021, 08:40:05 pm
Why do you need more properties?

>About "TPageSetupDialog don't have enough properties"-- it has enough. look at the Delphi7 - same properties. all you need is Paper size x/y, and you have it.
TinyPortal © 2005-2018