OberonPlace.com Forums

OberonPlace.com Forums (http://forum.oberonplace.com/index.php)
-   CorelDRAW/Corel DESIGNER VBA (http://forum.oberonplace.com/forumdisplay.php?f=16)
-   -   Showing and hiding a user form (http://forum.oberonplace.com/showthread.php?t=24632)

Harry 16-08-2013 04:47

Showing and hiding a user form
 
I have a form, which I can show and hide using userform1.show and userform1.hide.

The problem is that userform1.show causes the user form to take focus -- so that, for example, I can no longer alt-tab between open document windows or use any keyboard shortcuts.

I thought I could do this by userform1.visible = true but this gives a runtime error "function or interface marked as restricted".

So, any suggestions for displaying a form without it taking focus -- or of making it hand focus back to the document immediately afterwards.

basti.schneider 20-08-2013 04:54

Workaround
 
I had the same problem yesterday.
I don't have a solution, but a workaround.
I inserted

Application.AppWindow.Activate
Application.AppWindow.WindowState = cdrWindowMaximized

into my source code to get the focus back to CorelDraw.
This is neither nice nor fast.

I hope that someone comes up with a better solution!

Harry 20-08-2013 14:29

Thanks ... that will do for the moment.

Joe 21-08-2013 05:22

Interesting question... So I googled it and found this really simple solution - just add

Code:

AppActivate "CorelDRAW"
at the end of your form show code.


All times are GMT -5. The time now is 10:36.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com