Author |
Topic |
rrb
SQLTeam Poet Laureate
1479 Posts |
Posted - 2005-05-13 : 03:31:25
|
Is there a way to detect which mode the form is in? Ie, if the user does a print-preview on the form, can I do something during the Open event (or other) to change something about the way the form is displayed?--I hope that when I die someone will say of me "That guy sure owed me a lot of money" |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-05-13 : 06:59:41
|
Are you referring me.Modal?MadhivananFailing to plan is Planning to fail |
 |
|
rrb
SQLTeam Poet Laureate
1479 Posts |
Posted - 2005-05-16 : 19:33:37
|
Noquote: print-preview
I need to know whether the form is in print preview mode.Anyone else?--I hope that when I die someone will say of me "That guy sure owed me a lot of money" |
 |
|
rrb
SQLTeam Poet Laureate
1479 Posts |
Posted - 2005-05-16 : 22:01:53
|
Found it - in case anyone wants or needs to know.Public Function InPrintMode(f as Form) as booleanDim p as propertyFor each p in f.properties if p.Name = "Pages" then InPrintMode = True Exit For End ifNext pEnd Function Why did I need to know? - because if you try and setfocus to an enabled control on a form which is in printpreview mode, you'll get an error. So now I can check before setting focus. --I hope that when I die someone will say of me "That guy sure owed me a lot of money" |
 |
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2005-05-16 : 22:16:50
|
you can always use the good old "ON ERROR RESUME NEXT" too!- Jeff |
 |
|
rrb
SQLTeam Poet Laureate
1479 Posts |
Posted - 2005-05-16 : 22:23:32
|
Thanks Jeff, however since the code to set the focus was generic for all forms, I'd like to be able to identify what error is actually happening and avoid it. Using the On Error Resume Next is fine for hiding errors, but if there's a different error occurring you may never know what is actually going wrong.While we're on the topic - do you know how to detect whether a form has a user defined property (Get and Let type property)? It won't show in the properties collection. At the moment the only way I can tell is to try to reference it and see if I get an error. Any better suggestions?--I hope that when I die someone will say of me "That guy sure owed me a lot of money" |
 |
|
rrb
SQLTeam Poet Laureate
1479 Posts |
Posted - 2005-05-16 : 23:00:15
|
PS - and besides, my mum always told me its polite to ask first --I hope that when I die someone will say of me "That guy sure owed me a lot of money" |
 |
|
jhermiz
3564 Posts |
Posted - 2005-05-18 : 19:01:40
|
You can case out error codes, do not use the ON ERROR RESUME NEXT it will bite later on. If a specific error code happens such as Err.Number = 20 then ... print something else...do the normal error printing routine.Also you can create your own properties so I'm not sure what you mean with let and set. Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]Imperfection living for perfection -- [url]http://jhermiz.blogspot.com/[/url] |
 |
|
rrb
SQLTeam Poet Laureate
1479 Posts |
Posted - 2005-05-18 : 19:24:06
|
thanks j - do you know how to detect whether a form has a user defined property ?--I hope that when I die someone will say of me "That guy sure owed me a lot of money" |
 |
|
rrb
SQLTeam Poet Laureate
1479 Posts |
Posted - 2005-06-02 : 21:15:52
|
just feeding back in case anyone wants to know:You can tell if the form is opened printpreview mode, by checking for the existence of the .pages property, however there appears to be no catchable event which occurs when an opened form is printpreviewed.In the end, I removed the print menu option in my application, and substituted "my own", which sets a form user defined property called .PrintMode() so I can tell which way to display my form.There must of course, be some way to tell, perhaps through an API call using the form's handle (hwnd), so if anyone can tell me how, I'd still love to know...--I hope that when I die someone will say of me "That guy sure owed me a lot of money" |
 |
|
|