restrict printer options

Post

Posted
Rating:
#1 (In Topic #1583)
Avatar
Enthusiast
sadams54 is in the usergroup ‘Enthusiast’
 I have an over zealous client that insists on changing printer options on the printer selection screen. Long story short he refuses to listen. This causes the reports to be cut off and come out strange due to changes he makes. Is there a way to set the print selection window the one from print.configure   to only give him certain options such as what pages to print and what printer to use. Basically cut off the rest? or do I need to override his settings in my code?

Also if I must override things like page orientation in code how do I do it? I tried setting the orientation to landscape in the printer select then in code set to portrait and it stayed at landscape. I really need to find a way to stop the guy from screwing it up.
Online now: No Back to the top

Post

Posted
Rating:
#2
Avatar
Administrator
gbWilly is in the usergroup ‘unknown’

sadams54 said

I have an over zealous client that insists on changing printer options on the printer selection screen. Long story short he refuses to listen. This causes the reports to be cut off and come out strange due to changes he makes. Is there a way to set the print selection window the one from print.configure   to only give him certain options such as what pages to print and what printer to use. Basically cut off the rest? or do I need to override his settings in my code?

Also if I must override things like page orientation in code how do I do it? I tried setting the orientation to landscape in the printer select then in code set to portrait and it stayed at landscape. I really need to find a way to stop the guy from screwing it up.
I have no idea how you are printing.

Does the client get a preview and reset configuration there? If so, just print directly to the printer without a preview.
That is what I generally do with reports of any kind for clients. You can set configurations for printer in code before printing and that should work just fine in my experience as I do use it.

Something like below should work (wrote it down right here, no testing):

Code (gambas)

  1. Public Sub Example()
  2.  
  3.   Dim hPrinter As Printer
  4.  
  5.   hPrinter = New Printer
  6.  
  7.   hPrinter.Orientation = Printer.Landscape
  8.   hPrinter.Paper = Printer.A4
  9.  
  10.   hPrinter.Print
  11.  
  12.  
And there are a lot of properties you can configute https://gambaswiki.org/wiki/comp/gb.qt4/printer
But if you use hPrinter.Configure to show the client the onfiguration, I guess these get overruled, why else would you show them to the client?

But maybe you mean something else, if so clarify the matter.

gbWilly
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories


… there is always a Catch if things go wrong!
Online now: No Back to the top

Post

Posted
Rating:
#3
Avatar
Enthusiast
sadams54 is in the usergroup ‘Enthusiast’
I am using a printer object on the window. I would name it something like rMemberList

Code

Public Sub btnMemberList_Click()

  If Not rMemberList.Configure() Then rMemberList.Print

End

then rMemberList_Begin is where I collate the data.
then rMemberList_draw is where I write the report.

I give the configure so they can also use the preview features and select which printer to use. however when they change the orientation on that screen it overrides my programming and of course the reports will fall off the page. I use the paint object to create the report. rMemberList.Draw is called once for each page of report.
 I tried resetting the orientation in code but to no avail. I do have orientation set in the rMemberList object but it is also overridden by the user setting. I have to allow them to choose the printer and not just go to default printers. They also need that preview that is so easy to use on the screen.
Online now: No Back to the top

Post

Posted
Rating:
#4
Avatar
Administrator
gbWilly is in the usergroup ‘unknown’

sadams54 said

I am using a printer object on the window. I would name it something like rMemberList

Code

Public Sub btnMemberList_Click()

  If Not rMemberList.Configure() Then rMemberList.Print

End

then rMemberList_Begin is where I collate the data.
then rMemberList_draw is where I write the report.

I give the configure so they can also use the preview features and select which printer to use. however when they change the orientation on that screen it overrides my programming and of course the reports will fall off the page. I use the paint object to create the report. rMemberList.Draw is called once for each page of report.
 I tried resetting the orientation in code but to no avail. I do have orientation set in the rMemberList object but it is also overridden by the user setting. I have to allow them to choose the printer and not just go to default printers. They also need that preview that is so easy to use on the screen.
As I said, I do think that showing them configure will overrule your code, unless you can do a post hack of some kind.

As to selecting printers that can be easily custom coded, I do that all the time and never show configure.
As to preview, check if rMemeberList.Preview also shows configuration (I'm not sure on that from the bottom of my head  ;)  and it might depend on the toolkit)
If no configure options in Preview then, combined with some dialog to select the printer, might be your solution.

gbWilly
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories


… there is always a Catch if things go wrong!
Online now: No Back to the top

Post

Posted
Rating:
#5
Avatar
Enthusiast
sadams54 is in the usergroup ‘Enthusiast’

gbWilly said

sadams54 said

I am using a printer object on the window. I would name it something like rMemberList

Code

Public Sub btnMemberList_Click()

  If Not rMemberList.Configure() Then rMemberList.Print

End

then rMemberList_Begin is where I collate the data.
then rMemberList_draw is where I write the report.

I give the configure so they can also use the preview features and select which printer to use. however when they change the orientation on that screen it overrides my programming and of course the reports will fall off the page. I use the paint object to create the report. rMemberList.Draw is called once for each page of report.
 I tried resetting the orientation in code but to no avail. I do have orientation set in the rMemberList object but it is also overridden by the user setting. I have to allow them to choose the printer and not just go to default printers. They also need that preview that is so easy to use on the screen.
As I said, I do think that showing them configure will overrule your code, unless you can do a post hack of some kind.

As to selecting printers that can be easily custom coded, I do that all the time and never show configure.
As to preview, check if rMemeberList.Preview also shows configuration (I'm not sure on that from the bottom of my head  ;)  and it might depend on the toolkit)
If no configure options in Preview then, combined with some dialog to select the printer, might be your solution.


Unfortunately I would have to recreate the entire configure to do this. I need to give them access to all the options including duplex. But I need to make sure orientation and paper size are always what I set them to. I can continue to try to drill and pound in their head to DO NOT TOUCH ORIENTATION OR PAPER SIZE. but they do not listen. Come back to me with portrait report printed in landscape mode complaining parts of the report like headings are missing. So if I need a hack to override the configure does anybody know how? For now I will check the configure after they hit it and see if I can detect the change and warn them
Online now: No Back to the top

Post

Posted
Rating:
#6
Avatar
Administrator
gbWilly is in the usergroup ‘unknown’

sadams54 said

Unfortunately I would have to recreate the entire configure to do this. I need to give them access to all the options including duplex. But I need to make sure orientation and paper size are always what I set them to. I can continue to try to drill and pound in their head to DO NOT TOUCH ORIENTATION OR PAPER SIZE. but they do not listen. Come back to me with portrait report printed in landscape mode complaining parts of the report like headings are missing. So if I need a hack to override the configure does anybody know how? For now I will check the configure after they hit it and see if I can detect the change and warn them
That would mean researching the source code, see what happens, how much comes from underlying toolkit, how much is gambas, what can be influenced etc.

I would almost think writing your custom configure would be less work.
Or, maybe try inheriting the Printer class and see what is possible to tweak/add etc.

Just a few suggestions from the top of my mind. Maybe others have better suggestions.

gbWilly
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories


… there is always a Catch if things go wrong!
Online now: No Back to the top

Post

Posted
Rating:
#7
Avatar
Enthusiast
sadams54 is in the usergroup ‘Enthusiast’
actually sounds like it might be easier to just beat into their heads to not touch that setting or deal with the consequences. Not sure I want to spend that much time to idiot proof that for one person.
Online now: No Back to the top

Post

Posted
Rating:
#8
Avatar
Administrator
gbWilly is in the usergroup ‘unknown’

sadams54 said

actually sounds like it might be easier to just beat into their heads to not touch that setting or deal with the consequences. Not sure I want to spend that much time to idiot proof that for one person.
:lol:  :lol:  :lol:

gbWilly
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories


… there is always a Catch if things go wrong!
Online now: No Back to the top

Post

Posted
Rating:
#9
Avatar
Regular
thatbruce is in the usergroup ‘Regular’
13000kV through the keyboard, used to work in my day.  :)
b

Online now: No Back to the top
1 guest and 0 members have just viewed this.